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

public Class ImageLine

extends Object
Class Inheritance
Imports
jogamp.opengl.util.pngj.ImageLineHelper.ImageLineStats

Lightweight wrapper for an image scanline, used for read and write.

This object can be (usually it is) reused while iterating over the image lines.

See scanline field, to understand the format.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final int
pack-priv final int
protected FilterType
public final ImageInfo
private int
rown

tracks the current row number (from 0 to rows-1)

public final boolean
samplesUnpacked

true: each element of the scanline array represents a sample always, even for internally packed PNG formats false: if the original image was of packed type (bit depth less than 8) we keep samples packed in a single array element

public final ImageLine.SampleType
sampleType

tells if we are using BYTE or INT to store the samples.

public final int[]
scanline

The 'scanline' is an array of integers, corresponds to an image line (row).

public final byte[]
scanlineb

Same as scanline, but with one byte per sample.

Constructor Summary

AccessConstructor and Description
public
ImageLine(final ImageInfo imgInfo)

default mode: INT packed

public
ImageLine(final ImageInfo
Inmutable ImageInfo, basic parameter of the image we are reading or writing
imgInfo
,
final ImageLine.SampleType
INT or BYTE : this determines which scanline is the really used one
stype
,
final boolean
If true, we use unpacked format, even for packed original images
unpackedMode
)

pack-priv
ImageLine(final ImageInfo imgInfo, final ImageLine.SampleType stype, final boolean unpackedMode, final int[] sci, final byte[] scb)

If a preallocated array is passed, the copy is shallow

Method Summary

Modifier and TypeMethod and Description
public FilterType
public int
getRown()

This row number inside the image (0 is top)

public byte[]
public int[]
pack-priv static void
packInplaceByte(final ImageInfo iminfo, final byte[] src, final byte[] dst, final boolean scaled)

size original: samplesPerRow sizeFinal: samplesPerRowPacked (trailing elements are trash!)

pack-priv static void
packInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scaled)

public ImageLine
packToNewImageLine()

Creates a new ImageLine similar to this, but packed The caller must be sure that the original was really unpacked

public void
public void
setRown(final int n)

Sets row number (0 : Rows-1)

public static void
showLineInfo(final ImageLine line)

Prints some statistics - just for debugging

public String
toString()

Overrides java.lang.Object.toString.

Basic info
pack-priv static void
unpackInplaceByte(final ImageInfo iminfo, final byte[] src, final byte[] dst, final boolean scale)

pack-priv static void
unpackInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scale)

public ImageLine
unpackToNewImageLine()

Creates a new ImageLine similar to this, but unpacked The caller must be sure that the original was really packed

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bitDepthback to summary
pack-priv final int bitDepth
channelsback to summary
pack-priv final int channels
elementsPerRowback to summary
pack-priv final int elementsPerRow
filterUsedback to summary
protected FilterType filterUsed
imgInfoback to summary
public final ImageInfo imgInfo
rownback to summary
private int rown

tracks the current row number (from 0 to rows-1)

samplesUnpackedback to summary
public final boolean samplesUnpacked

true: each element of the scanline array represents a sample always, even for internally packed PNG formats false: if the original image was of packed type (bit depth less than 8) we keep samples packed in a single array element

sampleTypeback to summary
public final ImageLine.SampleType sampleType

tells if we are using BYTE or INT to store the samples.

scanlineback to summary
public final int[] scanline

The 'scanline' is an array of integers, corresponds to an image line (row).

Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each int is a "sample" (one for channel), (0-255 or 0-65535) in the corresponding PNG sequence: R G B R G B... or R G B A R G B A... or g g g ... or i i i (palette index)

For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED byte!

To convert a indexed line to RGB balues, see ImageLineHelper.palIdx2RGB() (you can't do the reverse)

scanlinebback to summary
public final byte[] scanlineb

Same as scanline, but with one byte per sample. Only one of scanline and scanlineb is valid - this depends on sampleType

Constructor Detail

ImageLineback to summary
public ImageLine(final ImageInfo imgInfo)

default mode: INT packed

ImageLineback to summary
public ImageLine(final ImageInfo imgInfo, final ImageLine.SampleType stype, final boolean unpackedMode)
Parameters
imgInfo:ImageInfo

Inmutable ImageInfo, basic parameter of the image we are reading or writing

stype:ImageLine.SampleType

INT or BYTE : this determines which scanline is the really used one

unpackedMode:boolean

If true, we use unpacked format, even for packed original images

ImageLineback to summary
pack-priv ImageLine(final ImageInfo imgInfo, final ImageLine.SampleType stype, final boolean unpackedMode, final int[] sci, final byte[] scb)

If a preallocated array is passed, the copy is shallow

Method Detail

getFilterUsedback to summary
public FilterType getFilterUsed()
getRownback to summary
public int getRown()

This row number inside the image (0 is top)

getScanlineByteback to summary
public byte[] getScanlineByte()
getScanlineIntback to summary
public int[] getScanlineInt()
packInplaceByteback to summary
pack-priv static void packInplaceByte(final ImageInfo iminfo, final byte[] src, final byte[] dst, final boolean scaled)

size original: samplesPerRow sizeFinal: samplesPerRowPacked (trailing elements are trash!)

packInplaceIntback to summary
pack-priv static void packInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scaled)
packToNewImageLineback to summary
public ImageLine packToNewImageLine()

Creates a new ImageLine similar to this, but packed The caller must be sure that the original was really unpacked

setFilterUsedback to summary
public void setFilterUsed(final FilterType ft)
setRownback to summary
public void setRown(final int n)

Sets row number (0 : Rows-1)

showLineInfoback to summary
public static void showLineInfo(final ImageLine line)

Prints some statistics - just for debugging

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Basic info

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override
unpackInplaceByteback to summary
pack-priv static void unpackInplaceByte(final ImageInfo iminfo, final byte[] src, final byte[] dst, final boolean scale)
unpackInplaceIntback to summary
pack-priv static void unpackInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scale)
unpackToNewImageLineback to summary
public ImageLine unpackToNewImageLine()

Creates a new ImageLine similar to this, but unpacked The caller must be sure that the original was really packed

jogamp.opengl.util.pngj back to summary

public final Enum ImageLine.SampleType

extends Enum<ImageLine.SampleType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ImageLine.SampleType
public static final ImageLine.SampleType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ImageLine.SampleType
public static ImageLine.SampleType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BYTEback to summary
public static final ImageLine.SampleType BYTE
INTback to summary
public static final ImageLine.SampleType INT

Constructor Detail

SampleTypeback to summary
private SampleType()

Method Detail

valueOfback to summary
public static ImageLine.SampleType valueOf(String name)
valuesback to summary
public static ImageLine.SampleType[] values()