Package com.itextpdf.layout.properties
Class Background
- java.lang.Object
-
- com.itextpdf.layout.properties.Background
-
public class Background extends java.lang.Object
A specialized class holding configurable properties related to anIElement
's background. This class is meant to be used as the value for theProperty.BACKGROUND
key in anIPropertyContainer
. Allows to define a background color, and positive or negative changes to the location of the edges of the background coloring.
-
-
Field Summary
Fields Modifier and Type Field Description private BackgroundBox
backgroundClip
protected float
extraBottom
protected float
extraLeft
protected float
extraRight
protected float
extraTop
protected TransparentColor
transparentColor
-
Constructor Summary
Constructors Constructor Description Background(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BackgroundBox
getBackgroundClip()
Gets background clip value.Color
getColor()
Gets the background's color.float
getExtraBottom()
Gets the extra space that must be filled at the bottom of the Element.float
getExtraLeft()
Gets the extra space that must be filled to the left of the Element.float
getExtraRight()
Gets the extra space that must be filled to the right of the Element.float
getExtraTop()
Gets the extra space that must be filled at the top of the Element.float
getOpacity()
Gets the opacity of the background.
-
-
-
Field Detail
-
transparentColor
protected TransparentColor transparentColor
-
extraLeft
protected float extraLeft
-
extraRight
protected float extraRight
-
extraTop
protected float extraTop
-
extraBottom
protected float extraBottom
-
backgroundClip
private BackgroundBox backgroundClip
-
-
Constructor Detail
-
Background
public Background(Color color)
Creates a background with a specified color.- Parameters:
color
- the background color
-
Background
public Background(Color color, float opacity)
Creates a background with a specified color and opacity.- Parameters:
color
- the background coloropacity
- 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 colorextraLeft
- extra coloring to the left sideextraTop
- extra coloring at the topextraRight
- extra coloring to the right sideextraBottom
- 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 coloropacity
- the opacity of the background color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparentextraLeft
- extra coloring to the left sideextraTop
- extra coloring at the topextraRight
- extra coloring to the right sideextraBottom
- extra coloring at the bottom
-
Background
public Background(Color color, float opacity, BackgroundBox clip)
Creates a background with a specified color, opacity and clip value.- Parameters:
color
- the background coloropacity
- the opacity of the background color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparentclip
- the value to clip the background color
-
-
Method Detail
-
getColor
public Color 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
public BackgroundBox getBackgroundClip()
Gets background clip value.- Returns:
- background clip value
-
-