Package com.itextpdf.layout.properties
Class BackgroundRepeat
- java.lang.Object
-
- com.itextpdf.layout.properties.BackgroundRepeat
-
public class BackgroundRepeat extends java.lang.ObjectClass to hold background-repeat property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBackgroundRepeat.BackgroundRepeatValueDefines all possible background repeat values for one axis.
-
Field Summary
Fields Modifier and Type Field Description private BackgroundRepeat.BackgroundRepeatValuexAxisRepeatprivate BackgroundRepeat.BackgroundRepeatValueyAxisRepeat
-
Constructor Summary
Constructors Constructor Description BackgroundRepeat()Creates a newBackgroundRepeatinstance.BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue repeat)Creates a newBackgroundRepeatinstance based on oneBackgroundRepeatinstance.BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue xAxisRepeat, BackgroundRepeat.BackgroundRepeatValue yAxisRepeat)Creates a newBackgroundRepeatinstance based on twoBackgroundRepeatinstance.
-
Method Summary
-
-
-
Field Detail
-
xAxisRepeat
private final BackgroundRepeat.BackgroundRepeatValue xAxisRepeat
-
yAxisRepeat
private final BackgroundRepeat.BackgroundRepeatValue yAxisRepeat
-
-
Constructor Detail
-
BackgroundRepeat
public BackgroundRepeat()
Creates a newBackgroundRepeatinstance. The axis will have the valueBackgroundRepeat.BackgroundRepeatValue.REPEAT.
-
BackgroundRepeat
public BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue repeat)
Creates a newBackgroundRepeatinstance based on oneBackgroundRepeatinstance.- Parameters:
repeat- the repeat value that will be set for for both axes
-
BackgroundRepeat
public BackgroundRepeat(BackgroundRepeat.BackgroundRepeatValue xAxisRepeat, BackgroundRepeat.BackgroundRepeatValue yAxisRepeat)
Creates a newBackgroundRepeatinstance based on twoBackgroundRepeatinstance.- 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.BackgroundRepeatValuevalue for X axis.- Returns:
- the repeat value for X axis.
-
getYAxisRepeat
public BackgroundRepeat.BackgroundRepeatValue getYAxisRepeat()
Gets theBackgroundRepeat.BackgroundRepeatValuevalue for Y axis.- Returns:
- the repeat value for Y axis.
-
isNoRepeatOnXAxis
public boolean isNoRepeatOnXAxis()
Checks whether theBackgroundRepeat.BackgroundRepeatValue.NO_REPEATvalue is set on X axis or not.- Returns:
- is the X axis have
BackgroundRepeat.BackgroundRepeatValue.NO_REPEATvalue
-
isNoRepeatOnYAxis
public boolean isNoRepeatOnYAxis()
Checks whether theBackgroundRepeat.BackgroundRepeatValue.NO_REPEATvalue is set on Y axis or not.- Returns:
- is the Y axis have
BackgroundRepeat.BackgroundRepeatValue.NO_REPEATvalue
-
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.BackgroundRepeatValuevalues 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)
-
-