Class DeviceRgb

java.lang.Object
com.itextpdf.kernel.colors.Color
com.itextpdf.kernel.colors.DeviceRgb

public class DeviceRgb extends Color
Color space to specify colors according to RGB color model.
  • Field Details

    • BLACK

      public static final Color BLACK
      Predefined black DeviceRgb color
    • WHITE

      public static final Color WHITE
      Predefined white DeviceRgb color
    • RED

      public static final Color RED
      Predefined red DeviceRgb color
    • GREEN

      public static final Color GREEN
      Predefined green DeviceRgb color
    • BLUE

      public static final Color BLUE
      Predefined blue DeviceRgb color
  • Constructor Details

    • DeviceRgb

      public DeviceRgb (int r, int g, int b)
      Creates DeviceRgb color by intensities of red, green and blue colorants. The intensities are considered to be in [0, 255] gap, if not, the intensity will be considered as 255 (when colorant's value is bigger than 255) or 0 (when colorant's value is less than 0).
      Parameters:
      r - the intensity of red colorant
      g - the intensity of green colorant
      b - the intensity of blue colorant
    • DeviceRgb

      public DeviceRgb (float r, float g, float b)
      Creates DeviceRgb color by intensities of red, green and blue colorants. The intensities are considered to be in [0, 1] interval, if not, the intensity will be considered as 1 (when colorant's value is bigger than 1) or 0 (when colorant's value is less than 0).
      Parameters:
      r - the intensity of red colorant
      g - the intensity of green colorant
      b - the intensity of blue colorant
    • DeviceRgb

      public DeviceRgb (Color color)
      Create DeviceRGB color from R, G, B values of java.awt.Color

      Note, that alpha chanel is ignored, but opacity still can be achieved in some places by using 'setOpacity' method or 'TransparentColor' class.

      Parameters:
      color - the color which RGB values are used
    • DeviceRgb

      public DeviceRgb()
      Creates DeviceRgb color with all colorants intensities initialised as zeroes.
  • Method Details

    • makeLighter

      public static DeviceRgb makeLighter (DeviceRgb rgbColor)
      Returns DeviceRgb color which is lighter than given one
      Parameters:
      rgbColor - the DeviceRgb color to be made lighter
      Returns:
      lighter color
    • makeDarker

      public static DeviceRgb makeDarker (DeviceRgb rgbColor)
      Returns DeviceRgb color which is darker than given one
      Parameters:
      rgbColor - the DeviceRgb color to be made darker
      Returns:
      darker color