|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.utils.gifutils.ImageQuant
public class ImageQuant
Class to quantise an RGB image into fewer colours. Suitable for conversion of a 24 bit to 8 bit colour image. Based on the 'Greedy Orthogonal Bipartition algorithm' by Xiaolin Wu. See Graphics Gems vol. II, pp.126-133.
Constructor Summary | |
---|---|
ImageQuant(Image inputImage,
int maxColours,
int width,
int height)
Converts the given image into its quantised equivalent. |
Method Summary | |
---|---|
static byte[] |
getAlpha(int[] argbArray)
Extracts the alpha component from an ARGB image array. |
static byte[] |
getBlue(int[] argbArray)
Extracts the blue component from an ARGB image array. |
String |
getErrorMessage()
Reports the current error message or an empty string if none. |
static byte[] |
getGreen(int[] argbArray)
Extracts the green component from an ARGB image array. |
int[] |
getQuantImageArray()
Returns the quantized image as an RGB array. |
static byte[] |
getRed(int[] argbArray)
Extracts the red component from an ARGB image array. |
boolean |
hasErrors()
Reports whether conversion has any errors. |
static int[] |
imageToArray(Image img,
int numRows,
int numCols)
Converts a Java Image into an array holding ARGB values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageQuant(Image inputImage, int maxColours, int width, int height)
inputImage
- Original Image to convert.maxColours
- Maximum number of colours to quantize.width
- Width of quantized image.height
- Height of quantized image.Method Detail |
---|
public int[] getQuantImageArray()
public boolean hasErrors()
public String getErrorMessage()
public static int[] imageToArray(Image img, int numRows, int numCols)
img
- Image to convert.numRows
- Number of rows for new image.numCols
- Number of columns for new image.
public static byte[] getAlpha(int[] argbArray)
argbArray
- Array containing ARGB values.
public static byte[] getRed(int[] argbArray)
argbArray
- Array containing ARGB values.
public static byte[] getGreen(int[] argbArray)
argbArray
- Array containing ARGB values.
public static byte[] getBlue(int[] argbArray)
argbArray
- Array containing ARGB values.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |