Package com.itextpdf.layout.properties
Class BackgroundRepeat
- java.lang.Object
-
- com.itextpdf.layout.properties.BackgroundRepeat
-
public class BackgroundRepeat extends java.lang.Object
Class to hold background-repeat property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BackgroundRepeat.BackgroundRepeatValue
Defines all possible background repeat values for one axis.
-
Field Summary
Fields Modifier and Type Field Description private BackgroundRepeat.BackgroundRepeatValue
xAxisRepeat
private BackgroundRepeat.BackgroundRepeatValue
yAxisRepeat
-
Constructor Summary
Constructors Constructor Description BackgroundRepeat()
Creates a newBackgroundRepeat
instance.BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue repeat)
Creates a newBackgroundRepeat
instance based on oneBackgroundRepeat
instance.BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue xAxisRepeat, BackgroundRepeat.BackgroundRepeatValue yAxisRepeat)
Creates a newBackgroundRepeat
instance based on twoBackgroundRepeat
instance.
-
Method Summary
-
-
-
Field Detail
-
xAxisRepeat
private final BackgroundRepeat.BackgroundRepeatValue xAxisRepeat
-
yAxisRepeat
private final BackgroundRepeat.BackgroundRepeatValue yAxisRepeat
-
-
Constructor Detail
-
BackgroundRepeat
public BackgroundRepeat()
Creates a newBackgroundRepeat
instance. The axis will have the valueBackgroundRepeat.BackgroundRepeatValue.REPEAT
.
-
BackgroundRepeat
public BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue repeat)
Creates a newBackgroundRepeat
instance based on oneBackgroundRepeat
instance.- Parameters:
repeat
- the repeat value that will be set for for both axes
-
BackgroundRepeat
public BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue xAxisRepeat, BackgroundRepeat.BackgroundRepeatValue yAxisRepeat)
Creates a newBackgroundRepeat
instance based on twoBackgroundRepeat
instance.- Parameters:
xAxisRepeat
- the repeat value that will be set for for X axisyAxisRepeat
- the repeat value that will be set for for Y axis
-
-
Method Detail
-
getXAxisRepeat
public BackgroundRepeat.BackgroundRepeatValue getXAxisRepeat()
Gets theBackgroundRepeat.BackgroundRepeatValue
value for X axis.- Returns:
- the repeat value for X axis.
-
getYAxisRepeat
public BackgroundRepeat.BackgroundRepeatValue getYAxisRepeat()
Gets theBackgroundRepeat.BackgroundRepeatValue
value for Y axis.- Returns:
- the repeat value for Y axis.
-
isNoRepeatOnXAxis
public boolean isNoRepeatOnXAxis()
Checks whether theBackgroundRepeat.BackgroundRepeatValue.NO_REPEAT
value is set on X axis or not.- Returns:
- is the X axis have
BackgroundRepeat.BackgroundRepeatValue.NO_REPEAT
value
-
isNoRepeatOnYAxis
public boolean isNoRepeatOnYAxis()
Checks whether theBackgroundRepeat.BackgroundRepeatValue.NO_REPEAT
value is set on Y axis or not.- Returns:
- is the Y axis have
BackgroundRepeat.BackgroundRepeatValue.NO_REPEAT
value
-
prepareRectangleToDrawingAndGetWhitespace
public Point prepareRectangleToDrawingAndGetWhitespace(Rectangle imageRectangle, Rectangle backgroundArea, BackgroundSize backgroundSize)
Prepares the image rectangle for drawing. This means that the size and position of the image rectangle will be changed to match theBackgroundRepeat.BackgroundRepeatValue
values for the axes.- Parameters:
imageRectangle
- the image rectangle which will be changedbackgroundArea
- the background available areabackgroundSize
- the image background size property- Returns:
- the necessary whitespace between backgrounds
-
processSpaceValueAndCalculateWhitespace
private Point processSpaceValueAndCalculateWhitespace(Rectangle imageRectangle, Rectangle backgroundArea)
-
calculateRatio
private static int calculateRatio(float areaSize, float backgroundSize)
-
calculateWhitespace
private static float calculateWhitespace(float areaSize, float backgroundSize)
-
-