java.lang.Object
com.google.zxing.client.j2se.MatrixToImageConfig

public final class MatrixToImageConfigextends Object
Encapsulates custom configuration used in methods of MatrixToImageWriter.
  • Field Summary

    Modifier and Type
    Field
    Description
    static final int
    Default black on color.
    private final int
    ARGB of an unset module.
    private final int
    ARGB of a set module.
    static final int
    Default white off color.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a default config with on color BLACK and off color WHITE, generating normal black-on-white barcodes.
    MatrixToImageConfig(int onColor, int offColor)
    Creates a config with the given colors.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) int
    Get the buffered image color model.
    int
    Get the color that a light module is drawn in.
    int
    Get the color that a dark module is drawn in.
    private static boolean
    hasTransparency(int argb)
    True when a colour is not fully opaque.

    Methods inherited from class Object

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

    • BLACK

      public static final int BLACK
      Default black on color.
      See Also:
    • WHITE

      public static final int WHITE
      Default white off color.
      See Also:
    • onColor

      private final int onColor
      ARGB of a set module.
    • offColor

      private final int offColor
      ARGB of an unset module.
  • Constructor Details

    • MatrixToImageConfig

      public MatrixToImageConfig()
      Creates a default config with on color BLACK and off color WHITE, generating normal black-on-white barcodes.
    • MatrixToImageConfig

      public MatrixToImageConfig(int onColor, int offColor)
      Creates a config with the given colors.
      Parameters:
      onColor - pixel on color, specified as an ARGB value as an int
      offColor - pixel off color, specified as an ARGB value as an int
  • Method Details

    • getPixelOnColor

      public int getPixelOnColor()
      Get the color that a dark module is drawn in.
      Returns:
      the on color, as an ARGB value
    • getPixelOffColor

      public int getPixelOffColor()
      Get the color that a light module is drawn in.
      Returns:
      the off color, as an ARGB value
    • getBufferedImageColorModel

      int getBufferedImageColorModel()
      Get the buffered image color model.
      Returns:
      the color model type
    • hasTransparency

      private static boolean hasTransparency(int argb)
      True when a colour is not fully opaque.
      Parameters:
      argb - the colour to test
      Returns:
      true if its alpha channel is set