public class CwtSwtGraphicsContext extends java.lang.Object implements IGraphicsContext
IGraphicsContext
mapping to SWT.
It is currently not safe to use this IGraphicsContext
concurrently.
Constructor and Description |
---|
CwtSwtGraphicsContext(org.eclipse.swt.graphics.GC paramGC,
org.eclipse.swt.graphics.Device paramDevice) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyAlphaBackground() |
protected void |
applyAlphaForeground() |
protected void |
applyClip() |
protected void |
applyTransform() |
void |
clip(java.awt.Shape shape)
Clip the subsequent drawing operations to the shape.
|
protected org.eclipse.swt.graphics.Path |
createPath(java.awt.Shape s) |
void |
dispose()
Dispose the current context and all its resources.
|
void |
draw(java.awt.Shape s)
Draw
s using the current graphics context state. |
void |
drawImage(IImage image,
float x,
float y)
Draw image
image at coordinates x ,
y . |
void |
drawString(java.lang.String s,
float x,
float y)
Draw a plain text string in the graphics.
|
void |
fill(java.awt.Shape s)
Fill
s using the current graphics context state. |
java.awt.Color |
getBackgroundColor()
The current background color.
|
BlendMode |
getBlendMode() |
java.awt.Shape |
getClip()
The current clip.
|
org.eclipse.swt.graphics.Device |
getDevice() |
java.awt.Font |
getFont() |
java.awt.font.FontRenderContext |
getFontRenderContext() |
java.awt.Color |
getForegroundColor()
The current foregroumd color.
|
org.eclipse.swt.graphics.GC |
getGc() |
IGraphicsEnvironment |
getGraphicsEnvironment()
The associated
IGraphicsEnvironment |
java.awt.RenderingHints |
getRenderingHints()
The current
RenderingHints |
java.awt.geom.AffineTransform |
getTransform()
The transformatiom currentlz active.
|
protected float[] |
getTransformationValues(java.awt.geom.AffineTransform tx) |
void |
resetAdvanced() |
void |
rotate(float theta)
Rotate the currently active transformation by
theta . |
void |
scale(float x,
float y)
Scale the currently active transformation by
x ,
y |
void |
setBackgroundColor(java.awt.Color color)
Assign a new background color.
|
void |
setBackgroundColor(org.eclipse.swt.graphics.Color resource) |
void |
setBackgroundPaint(IPaint paint)
Assign a new background
IPaint . |
void |
setBackgroundPattern(org.eclipse.swt.graphics.Pattern resource) |
void |
setBlendMode(BlendMode blendMode) |
void |
setClip(java.awt.Shape shape)
Assign the new
shape as the clipping shape. |
void |
setFont(java.awt.Font awtFont)
Set the current font for writing plain text in the graphics.
|
void |
setForegroundColor(java.awt.Color color)
Assign a new foreground color.
|
void |
setForegroundColor(org.eclipse.swt.graphics.Color resource) |
void |
setForegroundPaint(IPaint paint)
Assign a new foreground
IPaint |
void |
setForegroundPattern(org.eclipse.swt.graphics.Pattern resource) |
void |
setRenderingHint(java.awt.RenderingHints.Key hintKey,
java.lang.Object hintValue)
Set a specific rendering hint.
|
void |
setRenderingHints(java.util.Map hints)
Assign the currently active rendering hints.
|
void |
setStroke(java.awt.Stroke s)
Assign the currently active
Stroke |
void |
setTransform(java.awt.geom.AffineTransform pTransform)
Set the currently active
AffineTransform |
java.awt.Point |
textExtent(java.lang.String s) |
static org.eclipse.swt.graphics.Path |
toPath(org.eclipse.swt.graphics.Device device,
java.awt.geom.PathIterator pathIterator) |
static java.awt.geom.Rectangle2D |
toRectangle2D(org.eclipse.swt.graphics.Rectangle rect) |
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..
|
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..
|
void |
transform(java.awt.geom.AffineTransform deltaTransform)
Transform the
IGraphicsEnvironment by transform |
void |
translate(float x,
float y)
translate the currently active transformation by
x ,
y |
public CwtSwtGraphicsContext(org.eclipse.swt.graphics.GC paramGC, org.eclipse.swt.graphics.Device paramDevice)
public static org.eclipse.swt.graphics.Path toPath(org.eclipse.swt.graphics.Device device, java.awt.geom.PathIterator pathIterator)
public static java.awt.geom.Rectangle2D toRectangle2D(org.eclipse.swt.graphics.Rectangle rect)
public static org.eclipse.swt.graphics.Transform toTransform(org.eclipse.swt.graphics.Device device, java.awt.geom.AffineTransform at)
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)
protected void applyAlphaBackground()
protected void applyAlphaForeground()
protected void applyClip()
protected void applyTransform()
public void clip(java.awt.Shape shape)
IGraphicsContext
clip
in interface IGraphicsContext
protected org.eclipse.swt.graphics.Path createPath(java.awt.Shape s)
public void dispose()
IGraphicsContext
dispose
in interface IGraphicsContext
public void draw(java.awt.Shape s)
IGraphicsContext
s
using the current graphics context state.draw
in interface IGraphicsContext
public void drawImage(IImage image, float x, float y)
IGraphicsContext
image
at coordinates x
,
y
.drawImage
in interface IGraphicsContext
public void drawString(java.lang.String s, float x, float y)
IGraphicsContext
drawString
in interface IGraphicsContext
public void fill(java.awt.Shape s)
IGraphicsContext
s
using the current graphics context state.fill
in interface IGraphicsContext
public java.awt.Color getBackgroundColor()
IGraphicsContext
getBackgroundColor
in interface IGraphicsContext
public BlendMode getBlendMode()
public java.awt.Shape getClip()
IGraphicsContext
getClip
in interface IGraphicsContext
public org.eclipse.swt.graphics.Device getDevice()
public java.awt.Font getFont()
public java.awt.font.FontRenderContext getFontRenderContext()
public java.awt.Color getForegroundColor()
IGraphicsContext
getForegroundColor
in interface IGraphicsContext
public org.eclipse.swt.graphics.GC getGc()
public IGraphicsEnvironment getGraphicsEnvironment()
IGraphicsContext
IGraphicsEnvironment
getGraphicsEnvironment
in interface IGraphicsContext
public java.awt.RenderingHints getRenderingHints()
IGraphicsContext
RenderingHints
getRenderingHints
in interface IGraphicsContext
public java.awt.geom.AffineTransform getTransform()
IGraphicsContext
getTransform
in interface IGraphicsContext
protected float[] getTransformationValues(java.awt.geom.AffineTransform tx)
public void resetAdvanced()
public void rotate(float theta)
IGraphicsContext
theta
.rotate
in interface IGraphicsContext
public void scale(float x, float y)
IGraphicsContext
x
,
y
scale
in interface IGraphicsContext
public void setBackgroundColor(java.awt.Color color)
IGraphicsContext
setBackgroundColor
in interface IGraphicsContext
public void setBackgroundColor(org.eclipse.swt.graphics.Color resource)
public void setBackgroundPaint(IPaint paint)
IGraphicsContext
IPaint
.setBackgroundPaint
in interface IGraphicsContext
public void setBackgroundPattern(org.eclipse.swt.graphics.Pattern resource)
public void setBlendMode(BlendMode blendMode)
public void setClip(java.awt.Shape shape)
IGraphicsContext
shape
as the clipping shape.setClip
in interface IGraphicsContext
public void setFont(java.awt.Font awtFont)
IGraphicsContext
setFont
in interface IGraphicsContext
public void setForegroundColor(java.awt.Color color)
IGraphicsContext
setForegroundColor
in interface IGraphicsContext
public void setForegroundColor(org.eclipse.swt.graphics.Color resource)
public void setForegroundPaint(IPaint paint)
IGraphicsContext
IPaint
setForegroundPaint
in interface IGraphicsContext
public void setForegroundPattern(org.eclipse.swt.graphics.Pattern resource)
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
IGraphicsContext
setRenderingHint
in interface IGraphicsContext
public void setRenderingHints(java.util.Map hints)
IGraphicsContext
setRenderingHints
in interface IGraphicsContext
public void setStroke(java.awt.Stroke s)
IGraphicsContext
Stroke
setStroke
in interface IGraphicsContext
public void setTransform(java.awt.geom.AffineTransform pTransform)
IGraphicsContext
AffineTransform
setTransform
in interface IGraphicsContext
public java.awt.Point textExtent(java.lang.String s)
public void transform(java.awt.geom.AffineTransform deltaTransform)
IGraphicsContext
IGraphicsEnvironment
by transform
transform
in interface IGraphicsContext
public void translate(float x, float y)
IGraphicsContext
x
,
y
translate
in interface IGraphicsContext