|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectloci.formats.ImageTools
A utility class with convenience methods for manipulating images. Much code was stolen and adapted from DrLaszloJamf's posts at: http://forum.java.sun.com/thread.jspa?threadID=522483
| Field Summary | |
protected static Component |
OBS
ImageObserver for working with AWT images. |
| Constructor Summary | |
ImageTools()
|
|
| Method Summary | |
static BufferedImage |
copyScaled(BufferedImage source,
BufferedImage target,
Object hint)
Copies the source image into the target, applying scaling. |
static byte[][] |
getBytes(BufferedImage image)
Extracts pixel data as arrays of unsigned bytes, one per channel. |
static GraphicsConfiguration |
getDefaultConfiguration()
Gets the default graphics configuration for the environment. |
static double[][] |
getDoubles(BufferedImage image)
Extracts pixel data as arrays of doubles, one per channel. |
static float[][] |
getFloats(BufferedImage image)
Extracts pixel data as arrays of floats, one per channel. |
static int[][] |
getInts(BufferedImage image)
Extracts pixel data as arrays of signed integers, one per channel. |
static Object |
getPixels(BufferedImage image)
Gets the image's pixel data as arrays of primitives, one per channel. |
static short[][] |
getShorts(BufferedImage image)
Extracts pixel data as arrays of unsigned shorts, one per channel. |
static Dimension |
getSize(Image image)
Gets the width and height of the given AWT image, waiting for it to finish loading if necessary. |
static boolean |
loadImage(Image image)
Ensures the given AWT image is fully loaded. |
static BufferedImage |
makeBuffered(Image image)
Creates a buffered image from the given AWT image object. |
static BufferedImage |
makeBuffered(Image image,
ColorModel cm)
Creates a buffered image possessing the given color model, from the specified AWT image object. |
static ColorModel |
makeColorModel(int c,
int dataType)
Gets a color space for the given number of color components. |
static BufferedImage |
makeCompatible(BufferedImage image,
GraphicsConfiguration gc)
Creates a buffered image compatible with the given graphics configuration, using the given buffered image as a source. |
static BufferedImage |
makeImage(byte[][] data,
int w,
int h)
Creates an image from the given unsigned byte data. |
static BufferedImage |
makeImage(byte[] data,
int w,
int h)
Creates an image from the given single-channel unsigned byte data. |
static BufferedImage |
makeImage(byte[] data,
int w,
int h,
int c,
boolean interleaved)
Creates an image from the given unsigned byte data. |
static BufferedImage |
makeImage(double[][] data,
int w,
int h)
Creates an image from the given double-precision floating point data. |
static BufferedImage |
makeImage(double[] data,
int w,
int h)
Creates an image from the given single-channel double data. |
static BufferedImage |
makeImage(double[] data,
int w,
int h,
int c,
boolean interleaved)
Creates an image from the given double data. |
static BufferedImage |
makeImage(float[][] data,
int w,
int h)
Creates an image from the given single-precision floating point data. |
static BufferedImage |
makeImage(float[] data,
int w,
int h)
Creates an image from the given single-channel float data. |
static BufferedImage |
makeImage(float[] data,
int w,
int h,
int c,
boolean interleaved)
Creates an image from the given float data. |
static BufferedImage |
makeImage(int[][] data,
int w,
int h)
Creates an image from the given signed int data. |
static BufferedImage |
makeImage(int[] data,
int w,
int h)
Creates an image from the given single-channel signed int data. |
static BufferedImage |
makeImage(int[] data,
int w,
int h,
int c,
boolean interleaved)
Creates an image from the given signed int data. |
static BufferedImage |
makeImage(short[][] data,
int w,
int h)
Creates an image from the given unsigned short data. |
static BufferedImage |
makeImage(short[] data,
int w,
int h)
Creates an image from the given single-channel unsigned short data. |
static BufferedImage |
makeImage(short[] data,
int w,
int h,
int c,
boolean interleaved)
Creates an image from the given unsigned short data. |
static BufferedImage |
makeType(BufferedImage image,
int type)
Copies the given image into a result with the specified data type. |
static BufferedImage |
mergeChannels(BufferedImage[] images)
Merges the given images into a single multi-channel image. |
static BufferedImage |
scale(BufferedImage source,
int width,
int height)
Scales the image using the most appropriate API, with the resultant image having the same color model as the original image. |
static BufferedImage |
scale2D(BufferedImage image,
int width,
int height,
Object hint,
ColorModel cm)
Scales the image using the Java2D API, with the resultant image having the given color model. |
static BufferedImage |
scale2D(BufferedImage image,
int width,
int height,
Object hint,
GraphicsConfiguration gc)
Scales the image using the Java2D API, with the resultant image optimized for the given graphics configuration. |
static Image |
scaleAWT(BufferedImage source,
int width,
int height,
int hint)
Scales the image using the AWT Image API. |
static BufferedImage[] |
splitChannels(BufferedImage image)
Splits the given multi-channel image into single-channel images. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final Component OBS
| Constructor Detail |
public ImageTools()
| Method Detail |
public static BufferedImage makeImage(byte[] data,
int w,
int h,
int c,
boolean interleaved)
public static BufferedImage makeImage(short[] data,
int w,
int h,
int c,
boolean interleaved)
public static BufferedImage makeImage(int[] data,
int w,
int h,
int c,
boolean interleaved)
public static BufferedImage makeImage(float[] data,
int w,
int h,
int c,
boolean interleaved)
public static BufferedImage makeImage(double[] data,
int w,
int h,
int c,
boolean interleaved)
public static BufferedImage makeImage(byte[][] data,
int w,
int h)
public static BufferedImage makeImage(short[][] data,
int w,
int h)
public static BufferedImage makeImage(int[][] data,
int w,
int h)
public static BufferedImage makeImage(float[][] data,
int w,
int h)
public static BufferedImage makeImage(double[][] data,
int w,
int h)
public static BufferedImage makeImage(byte[] data,
int w,
int h)
public static BufferedImage makeImage(short[] data,
int w,
int h)
public static BufferedImage makeImage(int[] data,
int w,
int h)
public static BufferedImage makeImage(float[] data,
int w,
int h)
public static BufferedImage makeImage(double[] data,
int w,
int h)
public static Object getPixels(BufferedImage image)
public static byte[][] getBytes(BufferedImage image)
public static short[][] getShorts(BufferedImage image)
public static int[][] getInts(BufferedImage image)
public static float[][] getFloats(BufferedImage image)
public static double[][] getDoubles(BufferedImage image)
public static BufferedImage makeType(BufferedImage image,
int type)
public static BufferedImage[] splitChannels(BufferedImage image)
public static BufferedImage mergeChannels(BufferedImage[] images)
public static BufferedImage copyScaled(BufferedImage source,
BufferedImage target,
Object hint)
public static BufferedImage scale2D(BufferedImage image,
int width,
int height,
Object hint,
GraphicsConfiguration gc)
public static BufferedImage scale2D(BufferedImage image,
int width,
int height,
Object hint,
ColorModel cm)
public static Image scaleAWT(BufferedImage source,
int width,
int height,
int hint)
public static BufferedImage scale(BufferedImage source,
int width,
int height)
public static BufferedImage makeBuffered(Image image)
public static BufferedImage makeBuffered(Image image,
ColorModel cm)
public static boolean loadImage(Image image)
public static Dimension getSize(Image image)
public static BufferedImage makeCompatible(BufferedImage image,
GraphicsConfiguration gc)
public static GraphicsConfiguration getDefaultConfiguration()
public static ColorModel makeColorModel(int c,
int dataType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||