|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGraphics
org.eclipse.graphiti.export.batik.GraphicsToGraphics2DAdaptor
public class GraphicsToGraphics2DAdaptor
Objects of this class can be used with draw2d to render to a Graphics2D object.
Nested Class Summary | |
---|---|
private static class |
GraphicsToGraphics2DAdaptor.State
|
Field Summary | |
---|---|
(package private) static int |
ADVANCED_GRAPHICS_MASK
|
(package private) static int |
ADVANCED_SHIFT
|
private float |
angle
current rotation angle |
private GraphicsToGraphics2DAdaptor.State |
appliedState
|
private GraphicsToGraphics2DAdaptor.State |
currentState
|
(package private) static int |
FILL_RULE_MASK
|
(package private) static int |
FILL_RULE_SHIFT
|
(package private) static int |
FILL_RULE_WHOLE_NUMBER
|
private java.awt.Graphics2D |
graphics2D
|
private Image |
image
|
protected boolean |
paintNotCompatibleStringsAsBitmaps
Some strings, Asian string in particular, are painted differently between SWT and AWT. |
private Rectangle |
relativeClipRegion
|
private int |
rotateX
The x coordinate of the rotation point |
private int |
rotateY
The y coordinate of the rotation point |
private java.util.Stack<GraphicsToGraphics2DAdaptor.State> |
states
|
private java.awt.BasicStroke |
stroke
|
private SWTGraphics |
swtGraphics
|
private static TextUtilities |
TEXT_UTILITIES
|
private int |
transX
x coordinate for graphics translation |
private int |
transY
y coordinate for graphics translation |
private org.eclipse.swt.graphics.Rectangle |
viewBox
|
Constructor Summary | |
---|---|
GraphicsToGraphics2DAdaptor(java.awt.Graphics2D graphics,
Rectangle viewPort)
Constructor |
Method Summary | |
---|---|
protected void |
checkState()
Verifies that the applied state is up to date with the current state and updates the applied state accordingly. |
void |
clipPath(Path path)
|
void |
clipRect(Rectangle rect)
|
private void |
cloneGC(GC gc)
|
private java.awt.geom.GeneralPath |
createPathAWT(Path path)
|
private java.awt.Polygon |
createPolygon(PointList pointList)
|
private java.awt.Stroke |
createStroke()
Sets and retirns AWT Stroke based on the value of LineAttributes within the current state object |
private void |
createSWTGraphics()
This is a helper method used to create the SWT Graphics object |
void |
dispose()
|
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int endAngle)
|
void |
drawFocus(int x,
int y,
int w,
int h)
|
void |
drawImage(Image srcImage,
int xpos,
int ypos)
|
void |
drawImage(Image srcImage,
int x1,
int y1,
int w1,
int h1,
int x2,
int y2,
int w2,
int h2)
|
void |
drawLine(int x1,
int y1,
int x2,
int y2)
|
void |
drawOval(int x,
int y,
int w,
int h)
|
void |
drawPath(Path path)
|
void |
drawPolygon(PointList pointList)
|
void |
drawPolyline(PointList pointList)
|
void |
drawRectangle(int x,
int y,
int w,
int h)
|
void |
drawRoundRectangle(Rectangle rect,
int arcWidth,
int arcHeight)
|
void |
drawString(java.lang.String s,
int x,
int y)
|
void |
drawText(java.lang.String s,
int x,
int y)
|
void |
drawTextLayout(TextLayout layout,
int x,
int y,
int selectionStart,
int selectionEnd,
Color selectionForeground,
Color selectionBackground)
|
void |
fillArc(int x,
int y,
int w,
int h,
int offset,
int length)
|
void |
fillGradient(int x,
int y,
int w,
int h,
boolean vertical)
|
void |
fillOval(int x,
int y,
int w,
int h)
|
void |
fillPath(Path path)
|
void |
fillPolygon(PointList pointList)
|
void |
fillRectangle(int x,
int y,
int width,
int height)
|
void |
fillRoundRectangle(Rectangle rect,
int arcWidth,
int arcHeight)
|
void |
fillString(java.lang.String s,
int x,
int y)
|
void |
fillText(java.lang.String s,
int x,
int y)
|
boolean |
getAdvanced()
|
int |
getAlpha()
|
int |
getAntialias()
|
Color |
getBackgroundColor()
|
Rectangle |
getClip(Rectangle rect)
|
protected java.awt.Color |
getColor(Color toConvert)
This method is used to convert an SWT Color to an AWT Color. |
int |
getFillRule()
|
Font |
getFont()
|
FontMetrics |
getFontMetrics()
|
Color |
getForegroundColor()
|
protected java.awt.Graphics2D |
getGraphics2D()
|
int |
getInterpolation()
|
LineAttributes |
getLineAttributes()
|
int |
getLineStyle()
|
int |
getLineWidth()
|
float |
getLineWidthFloat()
|
Dimension |
getMaximumRenderSize()
|
protected java.awt.BasicStroke |
getStroke()
|
private SWTGraphics |
getSWTGraphics()
|
int |
getTextAntialias()
|
protected Point |
getTranslationOffset()
Accessor method to return the translation offset for the graphics object |
boolean |
getXORMode()
|
private void |
init()
This method should only be called by the constructor. |
private void |
initSVGGraphics(java.awt.Graphics2D graphics)
Create the SVG graphics object and initializes it with the current line stlye and width |
private boolean |
isFontStrikeout(Font f)
|
private boolean |
isFontUnderlined(Font f)
|
void |
popState()
|
void |
pushState()
|
void |
restoreState()
|
private void |
restoreState(GraphicsToGraphics2DAdaptor.State state)
|
void |
rotate(float degrees)
|
void |
scale(double amount)
|
void |
setAdvanced(boolean value)
|
void |
setAlpha(int alpha)
|
void |
setAntialias(int value)
|
void |
setBackgroundColor(Color rgb)
|
void |
setClip(Rectangle rect)
|
private void |
setClipAbsolute(int x,
int y,
int width,
int height)
Sets the current clip values |
void |
setFillRule(int rule)
|
void |
setFont(Font f)
|
void |
setForegroundColor(Color rgb)
|
void |
setLineAttributes(LineAttributes lineAttributes)
|
void |
setLineCap(int cap)
ignored |
void |
setLineDash(float[] dash)
|
void |
setLineDash(int[] dash)
Sets the dash pattern when the custom line style is in use. |
void |
setLineJoin(int join)
ignored |
void |
setLineMiterLimit(float miterLimit)
ignored |
void |
setLineStyle(int style)
|
void |
setLineWidth(int width)
|
void |
setLineWidthFloat(float width)
|
protected void |
setStroke(java.awt.BasicStroke stroke)
|
private void |
setTranslation(int x,
int y)
Sets the current translation values |
void |
setXORMode(boolean xorMode)
|
boolean |
shouldAllowDelayRender()
|
void |
translate(int dx,
int dy)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int ADVANCED_GRAPHICS_MASK
static final int ADVANCED_SHIFT
static final int FILL_RULE_MASK
static final int FILL_RULE_SHIFT
static final int FILL_RULE_WHOLE_NUMBER
private SWTGraphics swtGraphics
private java.awt.Graphics2D graphics2D
private java.awt.BasicStroke stroke
private java.util.Stack<GraphicsToGraphics2DAdaptor.State> states
private final GraphicsToGraphics2DAdaptor.State currentState
private final GraphicsToGraphics2DAdaptor.State appliedState
protected boolean paintNotCompatibleStringsAsBitmaps
true
then once SWT and AWT string width are
not equal, a bitmap of the SWT string will be painted. Otherwise the
string is always painted with AWT Graphics 2D string rendering.
private static final TextUtilities TEXT_UTILITIES
private Rectangle relativeClipRegion
private org.eclipse.swt.graphics.Rectangle viewBox
private Image image
private int transX
private int transY
private float angle
private int rotateX
private int rotateY
Constructor Detail |
---|
public GraphicsToGraphics2DAdaptor(java.awt.Graphics2D graphics, Rectangle viewPort)
graphics
- the Graphics2D
object that this object is
delegating calls to.viewPort
- the Rectangle
that defines the logical area being
rendered by the graphics object.Method Detail |
---|
private void createSWTGraphics()
private void initSVGGraphics(java.awt.Graphics2D graphics)
private void init()
protected void checkState()
public void clipRect(Rectangle rect)
public void dispose()
protected java.awt.Color getColor(Color toConvert)
toConvert
- SWT Color to convert
public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle)
public void fillArc(int x, int y, int w, int h, int offset, int length)
public void drawFocus(int x, int y, int w, int h)
public void drawTextLayout(TextLayout layout, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground)
private void cloneGC(GC gc)
public int getInterpolation()
public LineAttributes getLineAttributes()
public int getTextAntialias()
public void drawImage(Image srcImage, int xpos, int ypos)
public void drawImage(Image srcImage, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
public void drawLine(int x1, int y1, int x2, int y2)
public void drawOval(int x, int y, int w, int h)
public void fillOval(int x, int y, int w, int h)
private java.awt.Polygon createPolygon(PointList pointList)
public void drawPolygon(PointList pointList)
public void fillPolygon(PointList pointList)
public void drawPolyline(PointList pointList)
public void drawRectangle(int x, int y, int w, int h)
public void fillRectangle(int x, int y, int width, int height)
public void drawRoundRectangle(Rectangle rect, int arcWidth, int arcHeight)
public void fillRoundRectangle(Rectangle rect, int arcWidth, int arcHeight)
public void drawText(java.lang.String s, int x, int y)
public void drawString(java.lang.String s, int x, int y)
public void fillString(java.lang.String s, int x, int y)
public void fillText(java.lang.String s, int x, int y)
public Color getBackgroundColor()
public Rectangle getClip(Rectangle rect)
public Font getFont()
public FontMetrics getFontMetrics()
public Color getForegroundColor()
public int getLineStyle()
public int getLineWidth()
public float getLineWidthFloat()
public boolean getXORMode()
public void popState()
public void pushState()
public void restoreState()
private void restoreState(GraphicsToGraphics2DAdaptor.State state)
public void scale(double amount)
public void setBackgroundColor(Color rgb)
public void setClip(Rectangle rect)
private void setClipAbsolute(int x, int y, int width, int height)
x
- the x valuey
- the y valuewidth
- the width valueheight
- the height valueprivate boolean isFontUnderlined(Font f)
private boolean isFontStrikeout(Font f)
public void setFont(Font f)
public void setForegroundColor(Color rgb)
public void setLineDash(int[] dash)
pushState()
and popState()
.
dash
- the pixel patternpublic void setLineDash(float[] dash)
public void setLineStyle(int style)
public void setLineMiterLimit(float miterLimit)
public void setLineCap(int cap)
public void setLineJoin(int join)
public void setLineWidth(int width)
public void setLineWidthFloat(float width)
public void setLineAttributes(LineAttributes lineAttributes)
public void setXORMode(boolean xorMode)
private void setTranslation(int x, int y)
x
- the x translation valuey
- the y translation valuepublic void translate(int dx, int dy)
protected java.awt.Graphics2D getGraphics2D()
Graphics2D
that this is delegating to.private SWTGraphics getSWTGraphics()
public void fillGradient(int x, int y, int w, int h, boolean vertical)
public void drawPath(Path path)
public void fillPath(Path path)
public int getFillRule()
public void setFillRule(int rule)
private java.awt.geom.GeneralPath createPathAWT(Path path)
public boolean shouldAllowDelayRender()
public Dimension getMaximumRenderSize()
protected Point getTranslationOffset()
Point
x coordinate for graphics translationpublic int getAntialias()
public void setAntialias(int value)
public int getAlpha()
public void setAlpha(int alpha)
protected java.awt.BasicStroke getStroke()
protected void setStroke(java.awt.BasicStroke stroke)
private java.awt.Stroke createStroke()
LineAttributes
within the current state object
public boolean getAdvanced()
public void setAdvanced(boolean value)
public void clipPath(Path path)
public void rotate(float degrees)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |