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

public Class ImageLineHelper

extends Object
Class Inheritance
Imports
jogamp.opengl.util.pngj.ImageLine.SampleType, jogamp.opengl.util.pngj.chunks.PngChunkPLTE, .PngChunkTRNS

Bunch of utility static methods to process/analyze an image line at the pixel level.

Not essential at all, some methods are probably to be removed if future releases.

Warning

most methods for getting/setting values work currently only for integer base imageLines

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ImageLineHelper.ImageLineStats

Computes some statistics for the line.

Field Summary

Modifier and TypeField and Description
private static final double
private static final double

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
clampTo_0_255(final int i)

public static int
clampTo_0_65535(final int i)

public static int
clampTo_128_127(final int x)

public static int
double2int(final ImageLine line, double d)

public static int
double2intClamped(final ImageLine line, double d)

pack-priv static int
getMaskForPackedFormats(final int bitDepth)

pack-priv static int
getMaskForPackedFormatsLs(final int bitDepth)

public static int
getPixelARGB8(final ImageLine line, final int column)

public static int
getPixelRGB8(final ImageLine line, final int column)

integer packed R G B only for bitdepth=8!

public static String
infoFirstLastPixels(final ImageLine line)

Just for basic info or debugging.

public static String
infoFull(final ImageLine line)

public static double
int2double(final ImageLine line, final int p)

public static double
int2doubleClamped(final ImageLine line, final int p)

public static int
interpol(final int a, final int b, final int c, final int d, final double dx, final double dy)

public static int[]
pack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale)

Packs scanline (for bitdepth 1-2-4) from array into the scanline

If scale==true, it scales the value (just a bit shift).

public static byte[]
pack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale)

public static int[]

Returns:

R G B (A), one sample 0-255 per array element. Ready for pngw.writeRowInt()
palette2rgb
(ImageLine
ImageLine as returned from PngReader
line
,
final PngChunkPLTE
Palette chunk
pal
,
final PngChunkTRNS trns, int[]
Preallocated array, optional
buf
)

Given an indexed line with a palette, unpacks as a RGB array, or RGBA if a non nul PngChunkTRNS chunk is passed

public static int[]
palette2rgb(final ImageLine line, final PngChunkPLTE pal, final int[] buf)

public static void
setPixelRGB8(final ImageLine line, int col, final int r, final int g, final int b)

public static void
setPixelRGB8(final ImageLine line, final int col, final int rgb)

public static void
setPixelRGBA8(final ImageLine line, int col, final int r, final int g, final int b, final int a)

public static void
setPixelRGBA8(final ImageLine line, final int col, final int rgb)

public static void
setPixelsRGB8(final ImageLine line, final int[] rgb)

public static void
setPixelsRGBA8(final ImageLine line, final int[] rgb)

public static void
setValD(final ImageLine line, final int i, final double d)

public static int[]
unpack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale)

Unpacks scanline (for bitdepth 1-2-4) into a array int[]

You can (OPTIONALLY) pass an preallocated array, that will be filled and returned.

public static byte[]
unpack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BIG_VALUEback to summary
private static final double BIG_VALUE
BIG_VALUE_NEGback to summary
private static final double BIG_VALUE_NEG

Constructor Detail

ImageLineHelperback to summary
public ImageLineHelper()

Method Detail

clampTo_0_255back to summary
public static int clampTo_0_255(final int i)
clampTo_0_65535back to summary
public static int clampTo_0_65535(final int i)
clampTo_128_127back to summary
public static int clampTo_128_127(final int x)
double2intback to summary
public static int double2int(final ImageLine line, double d)
double2intClampedback to summary
public static int double2intClamped(final ImageLine line, double d)
getMaskForPackedFormatsback to summary
pack-priv static int getMaskForPackedFormats(final int bitDepth)
getMaskForPackedFormatsLsback to summary
pack-priv static int getMaskForPackedFormatsLs(final int bitDepth)
getPixelARGB8back to summary
public static int getPixelARGB8(final ImageLine line, final int column)
getPixelRGB8back to summary
public static int getPixelRGB8(final ImageLine line, final int column)

integer packed R G B only for bitdepth=8! (does not check!)

infoFirstLastPixelsback to summary
public static String infoFirstLastPixels(final ImageLine line)

Just for basic info or debugging. Shows values for first and last pixel. Does not include alpha

infoFullback to summary
public static String infoFull(final ImageLine line)
int2doubleback to summary
public static double int2double(final ImageLine line, final int p)
int2doubleClampedback to summary
public static double int2doubleClamped(final ImageLine line, final int p)
interpolback to summary
public static int interpol(final int a, final int b, final int c, final int d, final double dx, final double dy)
packback to summary
public static int[] pack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale)

Packs scanline (for bitdepth 1-2-4) from array into the scanline

If scale==true, it scales the value (just a bit shift). You probably should use ImageLine#packToNewImageLine()

packback to summary
public static byte[] pack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale)
palette2rgbback to summary
public static int[] palette2rgb(ImageLine line, final PngChunkPLTE pal, final PngChunkTRNS trns, int[] buf)

Given an indexed line with a palette, unpacks as a RGB array, or RGBA if a non nul PngChunkTRNS chunk is passed

Parameters
line:ImageLine

ImageLine as returned from PngReader

pal:PngChunkPLTE

Palette chunk

buf:int[]

Preallocated array, optional

Returns:int[]

R G B (A), one sample 0-255 per array element. Ready for pngw.writeRowInt()

palette2rgbback to summary
public static int[] palette2rgb(final ImageLine line, final PngChunkPLTE pal, final int[] buf)
setPixelRGB8back to summary
public static void setPixelRGB8(final ImageLine line, int col, final int r, final int g, final int b)
setPixelRGB8back to summary
public static void setPixelRGB8(final ImageLine line, final int col, final int rgb)
setPixelRGBA8back to summary
public static void setPixelRGBA8(final ImageLine line, int col, final int r, final int g, final int b, final int a)
setPixelRGBA8back to summary
public static void setPixelRGBA8(final ImageLine line, final int col, final int rgb)
setPixelsRGB8back to summary
public static void setPixelsRGB8(final ImageLine line, final int[] rgb)
setPixelsRGBA8back to summary
public static void setPixelsRGBA8(final ImageLine line, final int[] rgb)
setValDback to summary
public static void setValD(final ImageLine line, final int i, final double d)
unpackback to summary
public static int[] unpack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale)

Unpacks scanline (for bitdepth 1-2-4) into a array int[]

You can (OPTIONALLY) pass an preallocated array, that will be filled and returned. If null, it will be allocated

If scale==true, it scales the value (just a bit shift) towards 0-255.

You probably should use ImageLine#unpackToNewImageLine()

unpackback to summary
public static byte[] unpack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale)
jogamp.opengl.util.pngj back to summary

pack-priv Class ImageLineHelper.ImageLineStats

extends Object
Class Inheritance

Computes some statistics for the line. Not very efficient or elegant, mainly for tests. Only for RGB/RGBA Outputs values as doubles (0.0 - 1.0)

Field Summary

Modifier and TypeField and Description
public final int
public double[]
public double
public double[]
public double
public double[]
public double[]
public double

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

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

Field Detail

channelsback to summary
public final int channels
maxdifback to summary
public double[] maxdif
maxlumback to summary
public double maxlum
maxvback to summary
public double[] maxv
minlumback to summary
public double minlum
minvback to summary
public double[] minv
promback to summary
public double[] prom
promlumback to summary
public double promlum

Constructor Detail

ImageLineStatsback to summary
public ImageLineStats(final ImageLine line)

Method Detail

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