|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.awt.AWTImageOperations
The AWTImageOperations class provides some basic functionalities used
when working with the sun swing toolkit.
| Constructor Summary | |
AWTImageOperations()
Private constructor to avoid instantiation. |
|
| Method Summary | |
static boolean |
canWriteFormat(java.lang.String formatName)
Returns true if the specified format name can be written |
Raster |
convertImageToRaster(java.awt.Image image)
Converts the Image given by image to a
Raster object. |
byte[] |
jpegEncode(int width,
int height,
int[] pixels,
float quality,
boolean forceBaseline)
Encodes the given pixel data to JPEG data. |
java.awt.Image |
loadAWTImage(java.lang.String imagepath)
|
java.awt.Image |
loadAWTImage(java.net.URL imagepath)
|
java.awt.Image |
loadAWTImageResource(java.lang.Class refClass,
java.lang.String imagepath)
|
java.awt.Image |
loadAWTImageResource(java.lang.String imagepath)
|
Raster |
loadImage(java.lang.String imagepath)
Loads the image from the source given by imagepath. |
Raster |
loadImage(java.net.URL imagepath)
|
Raster |
loadImageResource(java.lang.Class referenceclass,
java.lang.String imagepath)
|
Raster |
loadImageResource(java.lang.String imagepath)
Loads the image from the source given by imagepath. |
void |
registerReferenceClass(java.lang.Class refClass)
Registers the reference class that is used when loading images. |
void |
registerReferenceComponent(java.awt.Component component)
Registers the reference component that is used when loading images. |
void |
registerReferenceObject(java.lang.Object object)
Registers the reference object that is used when loading images. |
static boolean |
saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.OutputStream os)
Saves the given image in File file using GIF
-encoding. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AWTImageOperations()
| Method Detail |
public final void registerReferenceComponent(java.awt.Component component)
This Component can be any swing component, the reference
is used for internally managing a MediaTracker.
component - the Component to use for loading.public final void registerReferenceObject(java.lang.Object object)
The images are loaded by means of the
Class.getResource(java.lang.String) method. An image
is specified by a name that is passed to this method. The method
is invoked on a class object however, which delivers the
beginning of the internally used url that specifies the absolute
location of the image (or any resource in general).
This method sets the class that is used for determing the
beginning of the path.
object - the object to use as the beginning of the url
path that is used for loading images.public final void registerReferenceClass(java.lang.Class refClass)
The images are loaded by means of the
Class.getResource(java.lang.String) method. An image
is specified by a name that is passed to this method. The method
is invoked on a class object however, which delivers the
beginning of the internally used url that specifies the absolute
location of the image (or any resource in general).
This method sets the class that is used for determing the
beginning of the path.
refClass - the class to use as the beginning of the url
path that is used for loading images.public final Raster loadImage(java.lang.String imagepath)
imagepath.
loadImage in interface ImageOperationsimagepath - the complete path of the image to load
public final Raster loadImageResource(java.lang.String imagepath)
imagepath.
loadImageResource in interface ImageOperationsimagepath - the complete path of the image to load
public final Raster loadImageResource(java.lang.Class referenceclass,
java.lang.String imagepath)
loadImageResource in interface ImageOperationspublic final Raster loadImage(java.net.URL imagepath)
loadImage in interface ImageOperationspublic final java.awt.Image loadAWTImage(java.lang.String imagepath)
public final java.awt.Image loadAWTImageResource(java.lang.String imagepath)
public final java.awt.Image loadAWTImageResource(java.lang.Class refClass,
java.lang.String imagepath)
public final java.awt.Image loadAWTImage(java.net.URL imagepath)
public final Raster convertImageToRaster(java.awt.Image image)
Image given by image to a
Raster object.
image - the Image to convert
Rasterpublic static boolean canWriteFormat(java.lang.String formatName)
true if the specified format name can be written
formatName - the name of the format, for example gif.
true iff the format can be written.
public byte[] jpegEncode(int width,
int height,
int[] pixels,
float quality,
boolean forceBaseline)
ImageOperations
jpegEncode in interface ImageOperationswidth - The width of the imageheight - The height of the imagepixels - The pixel array width a size of width*height
containing the colors encoded as 0xRRGGBBquality - The JPEG quality (0.0f - 1.0f)forceBaseline - The force baseline setting for the JPEG encoder
public static boolean saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.OutputStream os)
File file using GIF
-encoding.
image - the image to save.os - The stream to write to
true, if saving was successful.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||