Package com.iizigo.swt
Class GraphicsGC
java.lang.Object
com.iizigo.swt.GraphicsGC
Class to transpose a Graphics2D onto an SWT Graphics Context (GC). This class is not thread safe. The class retains the buffered images for AWT and SWT if possible so they can be reused. The class must be disposed of by calling 
dispose.- Author:
- Christopher Mindus
- Field SummaryFields
- Constructor SummaryConstructorsConstructorDescriptionConstructs the Graphics to GC transfer for images without transparency.- GraphicsGC- (int color) Constructs the Graphics to GC transfer for images with specified transparency color.- GraphicsGC- (int width, int height) Constructs the Graphics to GC transfer for use with- getImage().- GraphicsGC- (int width, int height, int color) Constructs the Graphics to GC transfer for use with- getImage().
- Method SummaryModifier and TypeMethodDescription- void- dispose()Dispose the resources for this instance.Returns the Graphics2D context to use.- getImage()Gets an SWT Image for what is drawn.- void- initialize- (int x, int y, int cx, int cy) Initialize the AWT off-screen image for the drawing of the rectangle.- void- initialize- (GC gc) Initialize drawing on a SWT graphics context.- voidInitialize the AWT off-screen image for the drawing of the rectangle.- voidTransfer the Graphics2D data onto the SWT Graphics Context.- voidTransfer the Graphics2D data onto the SWT Graphics Context.
- Field Details- PALETTE_DATA
 
- Constructor Details- GraphicsGCpublic GraphicsGC()Constructs the Graphics to GC transfer for images without transparency.
- GraphicsGCpublic GraphicsGC- (int color) Constructs the Graphics to GC transfer for images with specified transparency color.- Parameters:
- color- RGB value to use as transparent color for SWT, -1 for none.
 
- GraphicsGCpublic GraphicsGC- (int width, int height) Constructs the Graphics to GC transfer for use with- getImage().- Parameters:
- width- The width of the image.
- height- The height of the image.
 
- GraphicsGCpublic GraphicsGC- (int width, int height, int color) Constructs the Graphics to GC transfer for use with- getImage().- Parameters:
- width- The width of the image.
- height- The height of the image.
- color- RGB value to use as transparent color for SWT, -1 for none.
 
 
- Method Details- initializeInitialize drawing on a SWT graphics context.
- initializeInitialize the AWT off-screen image for the drawing of the rectangle.
- initializepublic void initialize- (int x, int y, int cx, int cy) Initialize the AWT off-screen image for the drawing of the rectangle.
- getGraphicsReturns the Graphics2D context to use.
- transferTransfer the Graphics2D data onto the SWT Graphics Context.
- transferTransfer the Graphics2D data onto the SWT Graphics Context.
- getImageGets an SWT Image for what is drawn. Note that the image must be disposed of. This call can only be done once, and once called, this instance is disposed of.- Returns:
- The SWT Image, or null if called a second time.
 
- disposepublic void dispose()Dispose the resources for this instance.