Package com.itextpdf.layout.properties
Class BackgroundImage
java.lang.Object
com.itextpdf.layout.properties.BackgroundImage
Class to hold background-image property.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBackgroundImage(BackgroundImage backgroundImage) Creates a copy of passedBackgroundImageinstance. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]calculateBackgroundImageSize(float areaWidth, float areaHeight) Calculates width and height values for background image with a given area params.Gets background-clip.Gets background-origin.Gets background-position.Gets the background size property.Get the image's blend mode.getForm()Gets initial image if it is instanceofPdfFormXObject, otherwise returns null.getImage()Gets initial image if it is instanceofPdfImageXObject, otherwise returns null.floatGets initial image height.floatGets initial image width.Gets linearGradientBuilder.Gets imageBackgroundRepeatinstance.booleanReturns is background specified.protected float[]resolveWidthAndHeight(Float width, Float height, float areaWidth, float areaHeight) Resolves the final size of the background image in specified area.
-
Field Details
-
image
-
linearGradientBuilder
-
-
Constructor Details
-
BackgroundImage
Creates a copy of passedBackgroundImageinstance.- Parameters:
-
backgroundImage-BackgroundImagefor cloning
-
-
Method Details
-
getImage
Gets initial image if it is instanceofPdfImageXObject, otherwise returns null.- Returns:
-
PdfImageXObject
-
getForm
Gets initial image if it is instanceofPdfFormXObject, otherwise returns null.- Returns:
-
PdfFormXObject
-
calculateBackgroundImageSize
public float[] calculateBackgroundImageSize(float areaWidth, float areaHeight) Calculates width and height values for background image with a given area params.- Parameters:
-
areaWidth- width of the area of this images -
areaHeight- height of the area of this images - Returns:
- array of two float values. NOTE that first value defines width, second defines height
-
getBackgroundPosition
Gets background-position.- Returns:
-
BackgroundPosition
-
getLinearGradientBuilder
Gets linearGradientBuilder.- Returns:
-
AbstractLinearGradientBuilder
-
isBackgroundSpecified
public boolean isBackgroundSpecified()Returns is background specified.- Returns:
-
trueif background is specified, otherwise false
-
getBackgroundSize
Gets the background size property.- Returns:
-
BackgroundSizeinstance
-
getImageWidth
public float getImageWidth()Gets initial image width.- Returns:
- the initial image width
-
getImageHeight
public float getImageHeight()Gets initial image height.- Returns:
- the initial image height
-
getRepeat
Gets imageBackgroundRepeatinstance.- Returns:
- the image background repeat
-
getBlendMode
Get the image's blend mode.- Returns:
-
the
BlendModerepresentation of the image's blend mode
-
getBackgroundClip
Gets background-clip.- Returns:
-
BackgroundBox
-
getBackgroundOrigin
Gets background-origin.- Returns:
-
BackgroundBox
-
resolveWidthAndHeight
protected float[] resolveWidthAndHeight(Float width, Float height, float areaWidth, float areaHeight) Resolves the final size of the background image in specified area.- Parameters:
-
width- the intrinsic background image width -
height- the intrinsic background image height -
areaWidth- the area width in which background will be placed -
areaHeight- the area height in which background will be placed - Returns:
- the final size of the background image
-