Package de.intarsys.cwt.swt.environment
Class CwtSwtGraphicsContext
java.lang.Object
de.intarsys.cwt.swt.environment.CwtSwtGraphicsContext
- All Implemented Interfaces:
IGraphicsContext
An
IGraphicsContext
mapping to SWT.
It is currently not safe to use this IGraphicsContext
concurrently.
-
Constructor Summary
ConstructorsConstructorDescriptionCwtSwtGraphicsContext
(org.eclipse.swt.graphics.GC paramGC, org.eclipse.swt.graphics.Device paramDevice) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
protected void
void
Clip the subsequent drawing operations to the shape.protected org.eclipse.swt.graphics.Path
createPath
(Shape s) void
dispose()
Dispose the current context and all its resources.void
Draws
using the current graphics context state.void
Draw imageimage
at coordinatesx
,y
.void
drawString
(String s, float x, float y) Draw a plain text string in the graphics.void
Fills
using the current graphics context state.The current background color.getClip()
The current clip.org.eclipse.swt.graphics.Device
getFont()
The current foregroumd color.org.eclipse.swt.graphics.GC
getGc()
The associatedIGraphicsEnvironment
The currentRenderingHints
The transformatiom currentlz active.protected float[]
void
void
rotate
(float theta) Rotate the currently active transformation bytheta
.void
scale
(float x, float y) Scale the currently active transformation byx
,y
void
setBackgroundColor
(Color color) Assign a new background color.void
setBackgroundColor
(org.eclipse.swt.graphics.Color resource) void
setBackgroundPaint
(IPaint paint) Assign a new backgroundIPaint
.void
setBackgroundPattern
(org.eclipse.swt.graphics.Pattern resource) void
setBlendMode
(BlendMode blendMode) void
Assign the newshape
as the clipping shape.void
Set the current font for writing plain text in the graphics.void
setForegroundColor
(Color color) Assign a new foreground color.void
setForegroundColor
(org.eclipse.swt.graphics.Color resource) void
setForegroundPaint
(IPaint paint) Assign a new foregroundIPaint
void
setForegroundPattern
(org.eclipse.swt.graphics.Pattern resource) void
setRenderingHint
(RenderingHints.Key hintKey, Object hintValue) Set a specific rendering hint.void
setRenderingHints
(Map hints) Assign the currently active rendering hints.void
Assign the currently activeStroke
void
setTransform
(AffineTransform pTransform) Set the currently activeAffineTransform
textExtent
(String s) static org.eclipse.swt.graphics.Path
toPath
(org.eclipse.swt.graphics.Device device, PathIterator pathIterator) static Rectangle2D
toRectangle2D
(org.eclipse.swt.graphics.Rectangle rect) static org.eclipse.swt.graphics.Transform
toTransform
(org.eclipse.swt.graphics.Device device, AffineTransform at) This methods intentionally duplicated to avoid compile time dependency..static org.eclipse.swt.graphics.Transform
toTransform
(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Transform st, AffineTransform at) This methods intentionally duplicated to avoid compile time dependency..void
transform
(AffineTransform deltaTransform) Transform theIGraphicsEnvironment
bytransform
void
translate
(float x, float y) translate the currently active transformation byx
,y
-
Constructor Details
-
CwtSwtGraphicsContext
public CwtSwtGraphicsContext(org.eclipse.swt.graphics.GC paramGC, org.eclipse.swt.graphics.Device paramDevice)
-
-
Method Details
-
toPath
public static org.eclipse.swt.graphics.Path toPath(org.eclipse.swt.graphics.Device device, PathIterator pathIterator) -
toRectangle2D
-
toTransform
public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, 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, 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
Description copied from interface:IGraphicsContext
Clip the subsequent drawing operations to the shape. This adds the new clip shape to the existing one.- Specified by:
clip
in interfaceIGraphicsContext
- Parameters:
shape
-
-
createPath
-
dispose
public void dispose()Description copied from interface:IGraphicsContext
Dispose the current context and all its resources.- Specified by:
dispose
in interfaceIGraphicsContext
-
draw
Description copied from interface:IGraphicsContext
Draws
using the current graphics context state.- Specified by:
draw
in interfaceIGraphicsContext
- Parameters:
s
-
-
drawImage
Description copied from interface:IGraphicsContext
Draw imageimage
at coordinatesx
,y
.- Specified by:
drawImage
in interfaceIGraphicsContext
- Parameters:
image
-x
-y
-
-
drawString
Description copied from interface:IGraphicsContext
Draw a plain text string in the graphics.- Specified by:
drawString
in interfaceIGraphicsContext
- Parameters:
s
-x
-y
-
-
fill
Description copied from interface:IGraphicsContext
Fills
using the current graphics context state.- Specified by:
fill
in interfaceIGraphicsContext
- Parameters:
s
-
-
getBackgroundColor
Description copied from interface:IGraphicsContext
The current background color.- Specified by:
getBackgroundColor
in interfaceIGraphicsContext
- Returns:
-
getBlendMode
-
getClip
Description copied from interface:IGraphicsContext
The current clip.- Specified by:
getClip
in interfaceIGraphicsContext
- Returns:
-
getDevice
public org.eclipse.swt.graphics.Device getDevice() -
getFont
-
getFontRenderContext
-
getForegroundColor
Description copied from interface:IGraphicsContext
The current foregroumd color.- Specified by:
getForegroundColor
in interfaceIGraphicsContext
- Returns:
-
getGc
public org.eclipse.swt.graphics.GC getGc() -
getGraphicsEnvironment
Description copied from interface:IGraphicsContext
The associatedIGraphicsEnvironment
- Specified by:
getGraphicsEnvironment
in interfaceIGraphicsContext
- Returns:
-
getRenderingHints
Description copied from interface:IGraphicsContext
The currentRenderingHints
- Specified by:
getRenderingHints
in interfaceIGraphicsContext
- Returns:
-
getTransform
Description copied from interface:IGraphicsContext
The transformatiom currentlz active.- Specified by:
getTransform
in interfaceIGraphicsContext
- Returns:
-
getTransformationValues
-
resetAdvanced
public void resetAdvanced() -
rotate
public void rotate(float theta) Description copied from interface:IGraphicsContext
Rotate the currently active transformation bytheta
.- Specified by:
rotate
in interfaceIGraphicsContext
- Parameters:
theta
-
-
scale
public void scale(float x, float y) Description copied from interface:IGraphicsContext
Scale the currently active transformation byx
,y
- Specified by:
scale
in interfaceIGraphicsContext
-
setBackgroundColor
Description copied from interface:IGraphicsContext
Assign a new background color.- Specified by:
setBackgroundColor
in interfaceIGraphicsContext
- Parameters:
color
-
-
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color resource) -
setBackgroundPaint
Description copied from interface:IGraphicsContext
Assign a new backgroundIPaint
.- Specified by:
setBackgroundPaint
in interfaceIGraphicsContext
- Parameters:
paint
-
-
setBackgroundPattern
public void setBackgroundPattern(org.eclipse.swt.graphics.Pattern resource) -
setBlendMode
-
setClip
Description copied from interface:IGraphicsContext
Assign the newshape
as the clipping shape.- Specified by:
setClip
in interfaceIGraphicsContext
- Parameters:
shape
-
-
setFont
Description copied from interface:IGraphicsContext
Set the current font for writing plain text in the graphics.- Specified by:
setFont
in interfaceIGraphicsContext
- Parameters:
awtFont
-
-
setForegroundColor
Description copied from interface:IGraphicsContext
Assign a new foreground color.- Specified by:
setForegroundColor
in interfaceIGraphicsContext
- Parameters:
color
-
-
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color resource) -
setForegroundPaint
Description copied from interface:IGraphicsContext
Assign a new foregroundIPaint
- Specified by:
setForegroundPaint
in interfaceIGraphicsContext
- Parameters:
paint
-
-
setForegroundPattern
public void setForegroundPattern(org.eclipse.swt.graphics.Pattern resource) -
setRenderingHint
Description copied from interface:IGraphicsContext
Set a specific rendering hint.- Specified by:
setRenderingHint
in interfaceIGraphicsContext
- Parameters:
hintKey
-hintValue
-
-
setRenderingHints
Description copied from interface:IGraphicsContext
Assign the currently active rendering hints.- Specified by:
setRenderingHints
in interfaceIGraphicsContext
- Parameters:
hints
-
-
setStroke
Description copied from interface:IGraphicsContext
Assign the currently activeStroke
- Specified by:
setStroke
in interfaceIGraphicsContext
- Parameters:
s
-
-
setTransform
Description copied from interface:IGraphicsContext
Set the currently activeAffineTransform
- Specified by:
setTransform
in interfaceIGraphicsContext
- Parameters:
pTransform
-
-
textExtent
-
transform
Description copied from interface:IGraphicsContext
Transform theIGraphicsEnvironment
bytransform
- Specified by:
transform
in interfaceIGraphicsContext
- Parameters:
deltaTransform
-
-
translate
public void translate(float x, float y) Description copied from interface:IGraphicsContext
translate the currently active transformation byx
,y
- Specified by:
translate
in interfaceIGraphicsContext
-