Package com.itextpdf.layout.properties
Class Background
java.lang.Object
com.itextpdf.layout.properties.Background
A specialized class holding configurable properties related to an
IElement
's background. This class is meant to be used as the value for the Property.BACKGROUND
key in an IPropertyContainer
. Allows to define a background color, and positive or negative changes to the location of the edges of the background coloring.
-
Field Summary
Modifier and TypeFieldDescriptionprotected float
protected float
protected float
protected float
protected TransparentColor
-
Constructor Summary
ConstructorDescriptionBackground
(Color color) Creates a background with a specified color.Background
(Color color, float opacity) Creates a background with a specified color and opacity.Background
(Color color, float extraLeft, float extraTop, float extraRight, float extraBottom) Creates a background with a specified color, and extra space that must be counted as part of the background and therefore colored.Background
(Color color, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom) Creates a background with a specified color, and extra space that must be counted as part of the background and therefore colored.Background
(Color color, float opacity, BackgroundBox clip) Creates a background with a specified color, opacity and clip value. -
Method Summary
Modifier and TypeMethodDescriptionGets background clip value.getColor()
Gets the background's color.float
Gets the extra space that must be filled at the bottom of the Element.float
Gets the extra space that must be filled to the left of the Element.float
Gets the extra space that must be filled to the right of the Element.float
Gets the extra space that must be filled at the top of the Element.float
Gets the opacity of the background.
-
Field Details
-
transparentColor
-
extraLeft
protected float extraLeft -
extraRight
protected float extraRight -
extraTop
protected float extraTop -
extraBottom
protected float extraBottom
-
-
Constructor Details
-
Background
Creates a background with a specified color.- Parameters:
-
color
- the background color
-
Background
Creates a background with a specified color and opacity.- Parameters:
-
color
- the background color -
opacity
- the opacity of the background color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
-
Background
public Background(Color color, float extraLeft, float extraTop, float extraRight, float extraBottom) Creates a background with a specified color, and extra space that must be counted as part of the background and therefore colored. These values are allowed to be negative.- Parameters:
-
color
- the background color -
extraLeft
- extra coloring to the left side -
extraTop
- extra coloring at the top -
extraRight
- extra coloring to the right side -
extraBottom
- extra coloring at the bottom
-
Background
public Background(Color color, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom) Creates a background with a specified color, and extra space that must be counted as part of the background and therefore colored. These values are allowed to be negative.- Parameters:
-
color
- the background color -
opacity
- the opacity of the background color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent -
extraLeft
- extra coloring to the left side -
extraTop
- extra coloring at the top -
extraRight
- extra coloring to the right side -
extraBottom
- extra coloring at the bottom
-
Background
Creates a background with a specified color, opacity and clip value.- Parameters:
-
color
- the background color -
opacity
- the opacity of the background color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent -
clip
- the value to clip the background color
-
-
Method Details
-
getColor
Gets the background's color.- Returns:
-
a
Color
of any supported kind
-
getOpacity
public float getOpacity()Gets the opacity of the background.- Returns:
- a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
-
getExtraLeft
public float getExtraLeft()Gets the extra space that must be filled to the left of the Element.- Returns:
- a float value
-
getExtraRight
public float getExtraRight()Gets the extra space that must be filled to the right of the Element.- Returns:
- a float value
-
getExtraTop
public float getExtraTop()Gets the extra space that must be filled at the top of the Element.- Returns:
- a float value
-
getExtraBottom
public float getExtraBottom()Gets the extra space that must be filled at the bottom of the Element.- Returns:
- a float value
-
getBackgroundClip
Gets background clip value.- Returns:
- background clip value
-