Class Background

java.lang.Object
com.itextpdf.layout.properties.Background

public class Background extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected 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

    Modifier and Type
    Method
    Description
    Gets background clip value.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • transparentColor

      protected TransparentColor transparentColor
    • extraLeft

      protected float extraLeft
    • extraRight

      protected float extraRight
    • extraTop

      protected float extraTop
    • extraBottom

      protected float extraBottom
  • Constructor Details

    • 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 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

      public Background (Color color, float opacity, BackgroundBox clip)
      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

      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