ar.com.hjg.pngj
Class ImageInfo

java.lang.Object
  extended by ar.com.hjg.pngj.ImageInfo

public class ImageInfo
extends java.lang.Object

Simple immutable wrapper for basic image info.

Some parameters are redundant, but the constructor receives an 'orthogonal' subset.

ref: http://www.w3.org/TR/PNG/#11IHDR


Field Summary
 boolean alpha
          Flag: true if has alpha channel (RGBA/GA)
 int bitDepth
          Bits per sample (per channel) in the buffer (1-2-4-8-16).
 int bitspPixel
          Bits used for each pixel in the buffer: channel * bitDepth
 int bytesPerRow
          ceil(bitspp*cols/8)
 int bytesPixel
          rounded up value: this is only used internally for filter
 int channels
          Number of channels, as used internally: 3 for RGB, 4 for RGBA, 2 for GA (gray with alpha), 1 for grayscale or indexed.
 int cols
          Cols= Image width, in pixels.
 boolean greyscale
          Flag: true if is grayscale (G/GA)
 boolean indexed
          Flag: true if image is indexed, i.e., it has a palette
 boolean packed
          Flag: true if image internally uses less than one byte per sample (bit depth 1-2-4)
 int rows
          Rows= Image height, in pixels
 int samplesPerRow
          Equals cols * channels
 
Constructor Summary
ImageInfo(int cols, int rows, int bitdepth, boolean alpha)
          Short constructor: assumes truecolor (RGB/RGBA)
ImageInfo(int cols, int rows, int bitdepth, boolean alpha, boolean grayscale, boolean indexed)
          Full constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

alpha

public final boolean alpha
Flag: true if has alpha channel (RGBA/GA)


bitDepth

public final int bitDepth
Bits per sample (per channel) in the buffer (1-2-4-8-16). This is 8-16 for RGB/ARGB images, 1-2-4-8 for grayscale. For indexed images, number of bits per palette index (1-2-4-8)


bitspPixel

public final int bitspPixel
Bits used for each pixel in the buffer: channel * bitDepth


bytesPerRow

public final int bytesPerRow
ceil(bitspp*cols/8)


bytesPixel

public final int bytesPixel
rounded up value: this is only used internally for filter


channels

public final int channels
Number of channels, as used internally: 3 for RGB, 4 for RGBA, 2 for GA (gray with alpha), 1 for grayscale or indexed.


cols

public final int cols
Cols= Image width, in pixels.


greyscale

public final boolean greyscale
Flag: true if is grayscale (G/GA)


indexed

public final boolean indexed
Flag: true if image is indexed, i.e., it has a palette


packed

public final boolean packed
Flag: true if image internally uses less than one byte per sample (bit depth 1-2-4)


rows

public final int rows
Rows= Image height, in pixels


samplesPerRow

public final int samplesPerRow
Equals cols * channels

Constructor Detail

ImageInfo

public ImageInfo(int cols,
                 int rows,
                 int bitdepth,
                 boolean alpha)
Short constructor: assumes truecolor (RGB/RGBA)


ImageInfo

public ImageInfo(int cols,
                 int rows,
                 int bitdepth,
                 boolean alpha,
                 boolean grayscale,
                 boolean indexed)
Full constructor

Parameters:
cols - Width in pixels
rows - Height in pixels
bitdepth - Bits per sample, in the buffer : 8-16 for RGB true color and greyscale
alpha - Flag: has an alpha channel (RGBA or GA)
grayscale - Flag: is gray scale (any bitdepth, with or without alpha)
indexed - Flag: has palette
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object