Package com.itextpdf.layout.properties
Class BackgroundSize
- java.lang.Object
-
- com.itextpdf.layout.properties.BackgroundSize
-
public class BackgroundSize extends java.lang.ObjectClass to hold background-size property.
-
-
Field Summary
Fields Modifier and Type Field Description private UnitValuebackgroundHeightSizeHeight size for this image.private UnitValuebackgroundWidthSizeWidth size for this image.private booleancontainImage hsd a maximum size but not larger than the area.private booleancoverImage covers the entire area and its size may be more than the area.
-
Constructor Summary
Constructors Constructor Description BackgroundSize()Creates a newBackgroundSizeinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidclear()UnitValuegetBackgroundHeightSize()Gets the background height property of the image.UnitValuegetBackgroundWidthSize()Gets the background width property of the image.booleanisContain()Returns value of the "contain" property.booleanisCover()Returns value of the "cover" property.booleanisSpecificSize()Returns is size has specific property.voidsetBackgroundSizeToContain()Clears all size values and sets the "contain" propertytrue.voidsetBackgroundSizeToCover()Clears all size values and sets the "cover" propertytrue.voidsetBackgroundSizeToValues(UnitValue width, UnitValue height)Clears all current properties and sets new width and height values.
-
-
-
Field Detail
-
backgroundWidthSize
private UnitValue backgroundWidthSize
Width size for this image. IfUnitValueis in percent, then width depends on the area of the element.
-
backgroundHeightSize
private UnitValue backgroundHeightSize
Height size for this image. IfUnitValueis in percent, then height depends on the area of the element.
-
cover
private boolean cover
Image covers the entire area and its size may be more than the area.
-
contain
private boolean contain
Image hsd a maximum size but not larger than the area.
-
-
Constructor Detail
-
BackgroundSize
public BackgroundSize()
Creates a newBackgroundSizeinstance. The "cover" and "contain" properties are not set.
-
-
Method Detail
-
setBackgroundSizeToValues
public void setBackgroundSizeToValues(UnitValue width, UnitValue height)
Clears all current properties and sets new width and height values. One of the parameters can be null. Note that in this case null property will be scaled so that it becomes proportionally equal with the non-null value. If both parameters are set to null, then the default image size will be used.
-
setBackgroundSizeToContain
public void setBackgroundSizeToContain()
Clears all size values and sets the "contain" propertytrue.- See Also:
contain
-
setBackgroundSizeToCover
public void setBackgroundSizeToCover()
Clears all size values and sets the "cover" propertytrue.- See Also:
cover
-
getBackgroundWidthSize
public UnitValue getBackgroundWidthSize()
Gets the background width property of the image.- Returns:
- the
UnitValuewidth for this image. - See Also:
backgroundWidthSize
-
getBackgroundHeightSize
public UnitValue getBackgroundHeightSize()
Gets the background height property of the image.- Returns:
- the
UnitValueheight for this image. - See Also:
backgroundHeightSize
-
isSpecificSize
public boolean isSpecificSize()
Returns is size has specific property.- Returns:
trueif size set to "contain" or "cover", otherwise false.
-
isContain
public boolean isContain()
Returns value of the "contain" property.- Returns:
trueif property "contain" is set to the size, otherwise false.- See Also:
contain
-
isCover
public boolean isCover()
Returns value of the "cover" property.- Returns:
trueif property "cover" is set to the size, otherwise false.- See Also:
cover
-
clear
private void clear()
-
-