|
JIDE 3.3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.chart.util.ChartUtils
public class ChartUtils
Some utility methods for working with charts (and other components)
| Constructor Summary | |
|---|---|
ChartUtils()
|
|
| Method Summary | |
|---|---|
static void |
assertEDT()
|
static void |
clearBufferedImage(BufferedImage img,
Color color)
|
static void |
copyImageToClipboard(Component component)
This method copies a 'screenshot' of the given component (such as a Chart object) to the system clipboard as a PNG image. |
static BufferedImage |
createImage(Component component)
Creates a buffered image of type TYPE_INT_RGB from the supplied component. |
static BufferedImage |
createImage(Component component,
int imageType)
Creates a buffered image (of the specified type) from the supplied component. |
static Image |
createImage(String path)
Creates an image from a file on the classpath |
static TexturePaint |
createTexture(JComponent observer,
String fileName)
Utility method to create a texture paint from a graphics file |
static ImageIcon |
createThumbnail(Component component,
int width,
int height)
Creates a thumbnail from the supplied component (such as a chart). |
static Image |
createThumbnailImage(Component component,
int width,
int height)
Creates a thumbnail from the supplied component (such as a chart). |
static int[] |
getPixels(BufferedImage img,
int x,
int y,
int w,
int h,
int[] pixels)
Returns an array of pixels, stored as integers, from a BufferedImage. |
static boolean |
isAssertingEDTViolations()
|
static boolean |
isHardwareAccelerated(Image image)
|
static void |
runOnEdt(Runnable r)
|
static void |
setAssertEDTViolations(boolean assertViolations)
|
static void |
setPixels(BufferedImage img,
int x,
int y,
int w,
int h,
int[] pixels)
Writes a rectangular area of pixels in the destination BufferedImage. |
static void |
writeGifToFile(Component c,
File file)
Writes a GIF image of the supplied component to the given file. |
static void |
writeJpegToFile(Component c,
File file)
Writes a JPEG image of the supplied component to the given file. |
static void |
writePngToFile(Component c,
File file)
Writes a PNG image of the supplied component to the given file. |
static void |
writeToStream(Component c,
OutputStream stream)
Paints the component as a PNG image to the supplied output stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChartUtils()
| Method Detail |
|---|
public static void setAssertEDTViolations(boolean assertViolations)
public static boolean isAssertingEDTViolations()
public static void assertEDT()
public static void runOnEdt(Runnable r)
public static void writeGifToFile(Component c,
File file)
throws FileNotFoundException
c - the component to save as an imagefile - the file to save it to
FileNotFoundException
public static void writeJpegToFile(Component c,
File file)
throws FileNotFoundException
c - the component to save as an imagefile - the file to save it to
FileNotFoundException
public static void writePngToFile(Component c,
File file)
throws FileNotFoundException
c - the component to save as an imagefile - the file to save it to
FileNotFoundException
public static void writeToStream(Component c,
OutputStream stream)
c - the component to capture as a PNG imagestream - the stream to write the PNG data topublic static BufferedImage createImage(Component component)
component - the component to draw
public static BufferedImage createImage(Component component,
int imageType)
component - the component to drawimageType - the type of buffered image to draw
public static Image createThumbnailImage(Component component,
int width,
int height)
component - the component from which we would like to generate a thumbnailwidth - the width of the thumbnailheight - the height of the thumbnail
public static ImageIcon createThumbnail(Component component,
int width,
int height)
component - the component from which we would like to generate a thumbnailwidth - the width of the thumbnailheight - the height of the thumbnail
public static TexturePaint createTexture(JComponent observer,
String fileName)
observer - the observer to be informed when the texture image has been drawnfileName - the name of a file on the classpath, e.g., com/mycompany/project/images/widget.gif
public static Image createImage(String path)
path - the path to the file
public static void clearBufferedImage(BufferedImage img,
Color color)
public static boolean isHardwareAccelerated(Image image)
public static int[] getPixels(BufferedImage img,
int x,
int y,
int w,
int h,
int[] pixels)
Returns an array of pixels, stored as integers, from a BufferedImage. The pixels are grabbed from
a rectangular area defined by a location and two dimensions. Calling this method on an image of type different
from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB will unmanage the
image.
img - the source imagex - the x location at which to start grabbing pixelsy - the y location at which to start grabbing pixelsw - the width of the rectangle of pixels to grabh - the height of the rectangle of pixels to grabpixels - a pre-allocated array of pixels of size w*h; can be null
pixels if non-null, a new array of integers otherwise
IllegalArgumentException - is pixels is non-null and of length < w*h
public static void setPixels(BufferedImage img,
int x,
int y,
int w,
int h,
int[] pixels)
Writes a rectangular area of pixels in the destination BufferedImage. Calling this method on an
image of type different from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB
will unmanage the image.
img - the destination imagex - the x location at which to start storing pixelsy - the y location at which to start storing pixelsw - the width of the rectangle of pixels to storeh - the height of the rectangle of pixels to storepixels - an array of pixels, stored as integers
IllegalArgumentException - is pixels is non-null and of length < w*hpublic static void copyImageToClipboard(Component component)
component - the component to take a screen-dump of
|
JIDE 3.3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||