Class BackgroundImage
java.lang.Object
com.itextpdf.layout.properties.BackgroundImage
Class to hold background-image property.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BackgroundBoxprivate final BackgroundBoxprivate final BackgroundSizeprivate BlendModeprivate static final BlendModeprivate static final floatprotected PdfXObjectprotected AbstractLinearGradientBuilderprivate static final UnitValueprivate final BackgroundPositionprivate final BackgroundRepeat -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBackgroundImage(PdfXObject image, BackgroundRepeat repeat, BackgroundPosition position, BackgroundSize backgroundSize, AbstractLinearGradientBuilder linearGradientBuilder, BlendMode blendMode, BackgroundBox clip, BackgroundBox origin) Creates a newBackgroundImageinstance.BackgroundImage(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.private static BackgroundSizecalculateBackgroundSizeForArea(BackgroundImage image, float areaWidth, float areaHeight) private static BackgroundSizecreateBackgroundSizeWithMaxValueSide(boolean maxWidth) 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
-
PERCENT_VALUE_100
-
EPS
private static final float EPS- See Also:
-
DEFAULT_BLEND_MODE
-
image
-
linearGradientBuilder
-
blendMode
-
repeat
-
position
-
backgroundSize
-
backgroundClip
-
backgroundOrigin
-
-
Constructor Details
-
BackgroundImage
Creates a copy of passedBackgroundImageinstance.- Parameters:
backgroundImage-BackgroundImagefor cloning
-
BackgroundImage
private BackgroundImage(PdfXObject image, BackgroundRepeat repeat, BackgroundPosition position, BackgroundSize backgroundSize, AbstractLinearGradientBuilder linearGradientBuilder, BlendMode blendMode, BackgroundBox clip, BackgroundBox origin) Creates a newBackgroundImageinstance.- Parameters:
image- background-image property.PdfXObjectinstance.repeat- background-repeat property.BackgroundRepeatinstance.position- background-position property.BackgroundPositioninstance.backgroundSize- background-size property.BackgroundSizeinstance.linearGradientBuilder- background-image property.AbstractLinearGradientBuilderinstance.blendMode- the image's blend mode.BlendModeinstance.clip- background-clip property.BackgroundBoxinstance.origin- background-origin property.BackgroundBoxinstance.
-
-
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 imagesareaHeight- 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
-
getBackgroundClip
-
getBackgroundOrigin
-
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 widthheight- the intrinsic background image heightareaWidth- the area width in which background will be placedareaHeight- the area height in which background will be placed- Returns:
- the final size of the background image
-
calculateBackgroundSizeForArea
private static BackgroundSize calculateBackgroundSizeForArea(BackgroundImage image, float areaWidth, float areaHeight) -
createBackgroundSizeWithMaxValueSide
-