Package de.intarsys.cwt.swt.environment
Class CwtSwtGraphicsContext
- java.lang.Object
-
- de.intarsys.cwt.swt.environment.CwtSwtGraphicsContext
-
- All Implemented Interfaces:
IGraphicsContext
public class CwtSwtGraphicsContext extends java.lang.Object implements IGraphicsContext
AnIGraphicsContextmapping to SWT.It is currently not safe to use this
IGraphicsContextconcurrently.
-
-
Constructor Summary
Constructors Constructor Description CwtSwtGraphicsContext(org.eclipse.swt.graphics.GC paramGC, org.eclipse.swt.graphics.Device paramDevice)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyAlphaBackground()protected voidapplyAlphaForeground()protected voidapplyClip()protected voidapplyTransform()voidclip(java.awt.Shape shape)Clip the subsequent drawing operations to the shape.protected org.eclipse.swt.graphics.PathcreatePath(java.awt.Shape s)voiddispose()Dispose the current context and all its resources.voiddraw(java.awt.Shape s)Drawsusing the current graphics context state.voiddrawImage(IImage image, float x, float y)Draw imageimageat coordinatesx,y.voiddrawString(java.lang.String s, float x, float y)Draw a plain text string in the graphics.voidfill(java.awt.Shape s)Fillsusing the current graphics context state.java.awt.ColorgetBackgroundColor()The current background color.BlendModegetBlendMode()java.awt.ShapegetClip()The current clip.org.eclipse.swt.graphics.DevicegetDevice()java.awt.FontgetFont()java.awt.font.FontRenderContextgetFontRenderContext()java.awt.ColorgetForegroundColor()The current foregroumd color.org.eclipse.swt.graphics.GCgetGc()IGraphicsEnvironmentgetGraphicsEnvironment()The associatedIGraphicsEnvironmentjava.awt.RenderingHintsgetRenderingHints()The currentRenderingHintsjava.awt.geom.AffineTransformgetTransform()The transformatiom currentlz active.protected float[]getTransformationValues(java.awt.geom.AffineTransform tx)voidresetAdvanced()voidrotate(float theta)Rotate the currently active transformation bytheta.voidscale(float x, float y)Scale the currently active transformation byx,yvoidsetBackgroundColor(java.awt.Color color)Assign a new background color.voidsetBackgroundColor(org.eclipse.swt.graphics.Color resource)voidsetBackgroundPaint(IPaint paint)Assign a new backgroundIPaint.voidsetBackgroundPattern(org.eclipse.swt.graphics.Pattern resource)voidsetBlendMode(BlendMode blendMode)voidsetClip(java.awt.Shape shape)Assign the newshapeas the clipping shape.voidsetFont(java.awt.Font awtFont)Set the current font for writing plain text in the graphics.voidsetForegroundColor(java.awt.Color color)Assign a new foreground color.voidsetForegroundColor(org.eclipse.swt.graphics.Color resource)voidsetForegroundPaint(IPaint paint)Assign a new foregroundIPaintvoidsetForegroundPattern(org.eclipse.swt.graphics.Pattern resource)voidsetRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)Set a specific rendering hint.voidsetRenderingHints(java.util.Map hints)Assign the currently active rendering hints.voidsetStroke(java.awt.Stroke s)Assign the currently activeStrokevoidsetTransform(java.awt.geom.AffineTransform pTransform)Set the currently activeAffineTransformjava.awt.PointtextExtent(java.lang.String s)static org.eclipse.swt.graphics.PathtoPath(org.eclipse.swt.graphics.Device device, java.awt.geom.PathIterator pathIterator)static java.awt.geom.Rectangle2DtoRectangle2D(org.eclipse.swt.graphics.Rectangle rect)static org.eclipse.swt.graphics.TransformtoTransform(org.eclipse.swt.graphics.Device device, java.awt.geom.AffineTransform at)This methods intentionally duplicated to avoid compile time dependency..static org.eclipse.swt.graphics.TransformtoTransform(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Transform st, java.awt.geom.AffineTransform at)This methods intentionally duplicated to avoid compile time dependency..voidtransform(java.awt.geom.AffineTransform deltaTransform)Transform theIGraphicsEnvironmentbytransformvoidtranslate(float x, float y)translate the currently active transformation byx,y
-
-
-
Method Detail
-
toPath
public static org.eclipse.swt.graphics.Path toPath(org.eclipse.swt.graphics.Device device, java.awt.geom.PathIterator pathIterator)
-
toRectangle2D
public static java.awt.geom.Rectangle2D toRectangle2D(org.eclipse.swt.graphics.Rectangle rect)
-
toTransform
public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, java.awt.geom.AffineTransform at)This methods intentionally duplicated to avoid compile time dependency..
-
toTransform
public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Transform st, java.awt.geom.AffineTransform at)This methods intentionally duplicated to avoid compile time dependency..
-
applyAlphaBackground
protected void applyAlphaBackground()
-
applyAlphaForeground
protected void applyAlphaForeground()
-
applyClip
protected void applyClip()
-
applyTransform
protected void applyTransform()
-
clip
public void clip(java.awt.Shape shape)
Description copied from interface:IGraphicsContextClip the subsequent drawing operations to the shape. This adds the new clip shape to the existing one.- Specified by:
clipin interfaceIGraphicsContext
-
createPath
protected org.eclipse.swt.graphics.Path createPath(java.awt.Shape s)
-
dispose
public void dispose()
Description copied from interface:IGraphicsContextDispose the current context and all its resources.- Specified by:
disposein interfaceIGraphicsContext
-
draw
public void draw(java.awt.Shape s)
Description copied from interface:IGraphicsContextDrawsusing the current graphics context state.- Specified by:
drawin interfaceIGraphicsContext
-
drawImage
public void drawImage(IImage image, float x, float y)
Description copied from interface:IGraphicsContextDraw imageimageat coordinatesx,y.- Specified by:
drawImagein interfaceIGraphicsContext
-
drawString
public void drawString(java.lang.String s, float x, float y)Description copied from interface:IGraphicsContextDraw a plain text string in the graphics.- Specified by:
drawStringin interfaceIGraphicsContext
-
fill
public void fill(java.awt.Shape s)
Description copied from interface:IGraphicsContextFillsusing the current graphics context state.- Specified by:
fillin interfaceIGraphicsContext
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
Description copied from interface:IGraphicsContextThe current background color.- Specified by:
getBackgroundColorin interfaceIGraphicsContext- Returns:
-
getBlendMode
public BlendMode getBlendMode()
-
getClip
public java.awt.Shape getClip()
Description copied from interface:IGraphicsContextThe current clip.- Specified by:
getClipin interfaceIGraphicsContext- Returns:
-
getDevice
public org.eclipse.swt.graphics.Device getDevice()
-
getFont
public java.awt.Font getFont()
-
getFontRenderContext
public java.awt.font.FontRenderContext getFontRenderContext()
-
getForegroundColor
public java.awt.Color getForegroundColor()
Description copied from interface:IGraphicsContextThe current foregroumd color.- Specified by:
getForegroundColorin interfaceIGraphicsContext- Returns:
-
getGc
public org.eclipse.swt.graphics.GC getGc()
-
getGraphicsEnvironment
public IGraphicsEnvironment getGraphicsEnvironment()
Description copied from interface:IGraphicsContextThe associatedIGraphicsEnvironment- Specified by:
getGraphicsEnvironmentin interfaceIGraphicsContext- Returns:
-
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
Description copied from interface:IGraphicsContextThe currentRenderingHints- Specified by:
getRenderingHintsin interfaceIGraphicsContext- Returns:
-
getTransform
public java.awt.geom.AffineTransform getTransform()
Description copied from interface:IGraphicsContextThe transformatiom currentlz active.- Specified by:
getTransformin interfaceIGraphicsContext- Returns:
-
getTransformationValues
protected float[] getTransformationValues(java.awt.geom.AffineTransform tx)
-
resetAdvanced
public void resetAdvanced()
-
rotate
public void rotate(float theta)
Description copied from interface:IGraphicsContextRotate the currently active transformation bytheta.- Specified by:
rotatein interfaceIGraphicsContext
-
scale
public void scale(float x, float y)Description copied from interface:IGraphicsContextScale the currently active transformation byx,y- Specified by:
scalein interfaceIGraphicsContext
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color color)
Description copied from interface:IGraphicsContextAssign a new background color.- Specified by:
setBackgroundColorin interfaceIGraphicsContext
-
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color resource)
-
setBackgroundPaint
public void setBackgroundPaint(IPaint paint)
Description copied from interface:IGraphicsContextAssign a new backgroundIPaint.- Specified by:
setBackgroundPaintin interfaceIGraphicsContext
-
setBackgroundPattern
public void setBackgroundPattern(org.eclipse.swt.graphics.Pattern resource)
-
setBlendMode
public void setBlendMode(BlendMode blendMode)
-
setClip
public void setClip(java.awt.Shape shape)
Description copied from interface:IGraphicsContextAssign the newshapeas the clipping shape.- Specified by:
setClipin interfaceIGraphicsContext
-
setFont
public void setFont(java.awt.Font awtFont)
Description copied from interface:IGraphicsContextSet the current font for writing plain text in the graphics.- Specified by:
setFontin interfaceIGraphicsContext
-
setForegroundColor
public void setForegroundColor(java.awt.Color color)
Description copied from interface:IGraphicsContextAssign a new foreground color.- Specified by:
setForegroundColorin interfaceIGraphicsContext
-
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color resource)
-
setForegroundPaint
public void setForegroundPaint(IPaint paint)
Description copied from interface:IGraphicsContextAssign a new foregroundIPaint- Specified by:
setForegroundPaintin interfaceIGraphicsContext
-
setForegroundPattern
public void setForegroundPattern(org.eclipse.swt.graphics.Pattern resource)
-
setRenderingHint
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)Description copied from interface:IGraphicsContextSet a specific rendering hint.- Specified by:
setRenderingHintin interfaceIGraphicsContext
-
setRenderingHints
public void setRenderingHints(java.util.Map hints)
Description copied from interface:IGraphicsContextAssign the currently active rendering hints.- Specified by:
setRenderingHintsin interfaceIGraphicsContext
-
setStroke
public void setStroke(java.awt.Stroke s)
Description copied from interface:IGraphicsContextAssign the currently activeStroke- Specified by:
setStrokein interfaceIGraphicsContext
-
setTransform
public void setTransform(java.awt.geom.AffineTransform pTransform)
Description copied from interface:IGraphicsContextSet the currently activeAffineTransform- Specified by:
setTransformin interfaceIGraphicsContext
-
textExtent
public java.awt.Point textExtent(java.lang.String s)
-
transform
public void transform(java.awt.geom.AffineTransform deltaTransform)
Description copied from interface:IGraphicsContextTransform theIGraphicsEnvironmentbytransform- Specified by:
transformin interfaceIGraphicsContext
-
translate
public void translate(float x, float y)Description copied from interface:IGraphicsContexttranslate the currently active transformation byx,y- Specified by:
translatein interfaceIGraphicsContext
-
-