Top Description Fields Constructors Methods
jogamp.opengl.util.pngj

public Class ImageInfo

extends Object
Class Inheritance

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

Modifier and TypeField and Description
public final boolean
alpha

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

public final int
bitDepth

Bits per sample (per channel) in the buffer (1-2-4-8-16).

public final int
bitspPixel

Bits used for each pixel in the buffer: channel * bitDepth

public final int
bytesPerRow

ceil(bitspp*cols/8)

public final int
bytesPixel

rounded up value: this is only used internally for filter

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.

public final int
cols

Cols= Image width, in pixels.

public final boolean
greyscale

Flag: true if is grayscale (G/GA)

public final boolean
indexed

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

private static final int
public final boolean
packed

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

public final int
rows

Rows= Image height, in pixels

public final int
samplesPerRow

Equals cols * channels

public final int
samplesPerRowPacked

Amount of "packed samples" : when several samples are stored in a single byte (bitdepth 1,2 4) they are counted as one "packed sample".

Constructor Summary

AccessConstructor and Description
public
ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha)

Short constructor: assumes truecolor (RGB/RGBA)

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

Full constructor

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

alphaback to summary
public final boolean alpha

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

bitDepthback to summary
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)

bitspPixelback to summary
public final int bitspPixel

Bits used for each pixel in the buffer: channel * bitDepth

bytesPerRowback to summary
public final int bytesPerRow

ceil(bitspp*cols/8)

bytesPixelback to summary
public final int bytesPixel

rounded up value: this is only used internally for filter

channelsback to summary
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.

colsback to summary
public final int cols

Cols= Image width, in pixels.

greyscaleback to summary
public final boolean greyscale

Flag: true if is grayscale (G/GA)

indexedback to summary
public final boolean indexed

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

MAX_COLS_ROWS_VALback to summary
private static final int MAX_COLS_ROWS_VAL
packedback to summary
public final boolean packed

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

rowsback to summary
public final int rows

Rows= Image height, in pixels

samplesPerRowback to summary
public final int samplesPerRow

Equals cols * channels

samplesPerRowPackedback to summary
public final int samplesPerRowPacked

Amount of "packed samples" : when several samples are stored in a single byte (bitdepth 1,2 4) they are counted as one "packed sample". This is less that samplesPerRow only when bitdepth is 1-2-4 (flag packed = true)

This equals the number of elements in the scanline array if working with packedMode=true

For internal use, client code should rarely access this.

Constructor Detail

ImageInfoback to summary
public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha)

Short constructor: assumes truecolor (RGB/RGBA)

ImageInfoback to summary
public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha, final boolean grayscale, final boolean indexed)

Full constructor

Parameters
cols:int

Width in pixels

rows:int

Height in pixels

bitdepth:int

Bits per sample, in the buffer : 8-16 for RGB true color and greyscale

alpha:boolean

Flag: has an alpha channel (RGBA or GA)

grayscale:boolean

Flag: is gray scale (any bitdepth, with or without alpha)

indexed:boolean

Flag: has palette

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override