|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.refractions.udig.ui.graphics.AWTSWTImageUtils
public final class AWTSWTImageUtils
Provides a bunch of Utility methods for converting between AWT and SWT
Constructor Summary | |
---|---|
AWTSWTImageUtils()
|
Method Summary | |
---|---|
static org.eclipse.swt.graphics.Font |
awtFontToSwt(java.awt.Font font,
FontRegistry fontRegistry)
Converts an AWTFont to a SWT Font |
static ImageDescriptor |
awtIcon2ImageDescriptor(javax.swing.Icon icon)
Converts a Swing Icon to an ImageDescriptor |
static java.awt.image.BufferedImage |
convertToAWT(Image image)
Convert an SWT Image to a BufferedImage - this one rips the ImageData out of the live Image; and then copies it into a BufferedImage. |
static Path |
convertToPath(java.awt.Shape shape,
Device device)
Converts the shape to a path object. |
static Image |
convertToSWTImage(java.awt.image.BufferedImage image)
Converts a BufferedImage to an SWT Image. |
static java.awt.image.BufferedImage |
createBufferedImage(int w,
int h)
Create a buffered image that can be be converted to SWTland later |
static Image |
createDefaultImage(Device device,
int width,
int height)
Creates an image with a depth of 24 and has a transparency channel. |
static ImageData |
createImageData(java.awt.image.BufferedImage image)
Creates an ImageData from the 0,0,width,height section of the source BufferedImage. |
static ImageData |
createImageData(java.awt.image.RenderedImage image)
Creates an ImageData from the source RenderedImage. |
static ImageData |
createImageData(java.awt.image.RenderedImage image,
boolean transparent)
|
static ImageDescriptor |
createImageDescriptor(java.awt.image.BufferedImage image)
Creates an image descriptor that from the source image. |
static ImageDescriptor |
createImageDescriptor(java.awt.image.RenderedImage image,
boolean transparent)
|
static Path |
createPath(java.awt.geom.PathIterator p,
Device device)
|
static Image |
createSWTImage(java.awt.image.RenderedImage image)
Converts a RenderedImage to an SWT Image. |
static Image |
createSWTImage(java.awt.image.RenderedImage image,
boolean transparent)
|
static javax.swing.Icon |
imageDescriptor2awtIcon(ImageDescriptor imageDescriptor)
|
static java.awt.Color |
swtColor2awtColor(GC gc,
Color swt)
|
static java.awt.Font |
swtFontToAwt(FontData fontData)
Converts SWT FontData to a AWT Font |
static int |
toFontStyle(java.awt.Font f)
Takes an AWT Font. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AWTSWTImageUtils()
Method Detail |
---|
public static java.awt.image.BufferedImage convertToAWT(Image image)
public static Path convertToPath(java.awt.Shape shape, Device device)
shape
-
Path
object.public static Path createPath(java.awt.geom.PathIterator p, Device device)
public static Image createDefaultImage(Device device, int width, int height)
device
- device to use for creating the imagewidth
- the width of the final imageheight
- the height of the final image
public static java.awt.image.BufferedImage createBufferedImage(int w, int h)
public static Image createSWTImage(java.awt.image.RenderedImage image, boolean transparent)
public static ImageData createImageData(java.awt.image.RenderedImage image, boolean transparent)
public static ImageDescriptor createImageDescriptor(java.awt.image.RenderedImage image, boolean transparent)
public static ImageDescriptor createImageDescriptor(java.awt.image.BufferedImage image)
image
- source image
public static Image convertToSWTImage(java.awt.image.BufferedImage image)
image
- source image.
public static ImageData createImageData(java.awt.image.BufferedImage image)
This method is faster than creating the ImageData from a RenderedImage so use this method if possible.
image
- source image.
public static Image createSWTImage(java.awt.image.RenderedImage image)
SWTGraphics#createSWTImage(BufferedImage, int, int)
.
image
- source image.width
- the width of the final imageheight
- the height of the final image
public static ImageData createImageData(java.awt.image.RenderedImage image)
This method is slower than using createImageData
.
image
- source image.
public static java.awt.Color swtColor2awtColor(GC gc, Color swt)
public static java.awt.Font swtFontToAwt(FontData fontData)
fontData
- the font data
public static org.eclipse.swt.graphics.Font awtFontToSwt(java.awt.Font font, FontRegistry fontRegistry)
font
- and AWT FontfontRegistry
-
public static int toFontStyle(java.awt.Font f)
style
-
public static javax.swing.Icon imageDescriptor2awtIcon(ImageDescriptor imageDescriptor)
public static ImageDescriptor awtIcon2ImageDescriptor(javax.swing.Icon icon)
Icon
to an ImageDescriptor
icon
- icon to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |