Class TransparentColor

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

public class TransparentColor extends Object
Represents a color with the specified opacity.
  • Field Details

    • color

      private Color color
    • opacity

      private float opacity
  • Constructor Details

    • TransparentColor

      public TransparentColor(Color color)
      Creates a new TransparentColor instance of certain fully opaque color.
      Parameters:
      color - the Color of the created TransparentColor object
    • TransparentColor

      public TransparentColor(Color color, float opacity)
      Creates a new TransparentColor.
      Parameters:
      color - the Color of the created TransparentColor object
      opacity - a float defining the opacity of the color; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
  • Method Details

    • getColor

      public Color getColor()
      Gets the color.
      Returns:
      a Color
    • getOpacity

      public float getOpacity()
      Gets the opacity of color.
      Returns:
      a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
    • applyFillTransparency

      public void applyFillTransparency(PdfCanvas canvas)
      Sets the opacity value for non-stroking operations in the transparent imaging model.
      Parameters:
      canvas - the PdfCanvas to be written to
    • applyStrokeTransparency

      public void applyStrokeTransparency(PdfCanvas canvas)
      Sets the opacity value for stroking operations in the transparent imaging model.
      Parameters:
      canvas - the PdfCanvas to be written to
    • applyTransparency

      private void applyTransparency(PdfCanvas canvas, boolean isStroke)
    • isTransparent

      private boolean isTransparent()