|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Graphics
java.awt.Graphics2D
org.jfree.experimental.swt.SWTGraphics2D
public class SWTGraphics2D
This is a class utility to draw Graphics2D stuff on a swt composite. It is presently developed to use JFreeChart with the Standard Widget Toolkit but may be of a wider use later.
| Constructor Summary | |
|---|---|
SWTGraphics2D(GC gc)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addRenderingHints(java.util.Map hints)
Adds the hints in the specified map to the graphics context, replacing any existing hints. |
void |
clearRect(int x,
int y,
int width,
int height)
Fills the specified rectangle with the current background colour. |
void |
clip(java.awt.Shape s)
|
void |
clipRect(int x,
int y,
int width,
int height)
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
|
java.awt.Graphics |
create()
|
void |
dispose()
|
void |
draw(java.awt.Shape shape)
Draws the outline of the specified shape using the current stroke and paint settings. |
void |
drawArc(int x,
int y,
int width,
int height,
int arcStart,
int arcAngle)
Draws an arc that is part of an ellipse that fits within the specified framing rectangle. |
void |
drawGlyphVector(java.awt.font.GlyphVector g,
float x,
float y)
|
void |
drawImage(java.awt.image.BufferedImage image,
java.awt.image.BufferedImageOp op,
int x,
int y)
|
boolean |
drawImage(java.awt.Image image,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver obs)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
|
boolean |
drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
|
void |
drawImage(org.eclipse.swt.graphics.Image image,
int x,
int y)
Draws an image at (x, y). |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line from (x1, y1) to (x2, y2) using the current stroke and paint settings. |
void |
drawOval(int x,
int y,
int width,
int height)
Draws an oval that fits within the specified rectangular region. |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int npoints)
Draws the outline of the polygon specified by the given points, using the current paint and stroke settings. |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int npoints)
Draws a sequence of connected lines specified by the given points, using the current paint and stroke settings. |
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage image,
java.awt.geom.AffineTransform xform)
|
void |
drawRenderedImage(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform)
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rectangle with rounded corners that fits within the specified framing rectangle. |
void |
drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
|
void |
drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
|
void |
drawString(java.lang.String text,
float x,
float y)
|
void |
drawString(java.lang.String text,
int x,
int y)
Draws a string on the receiver. note that to be consistent with the awt method, the y has to be modified with the ascent of the font. |
void |
fill(java.awt.Shape shape)
Fills the specified shape using the current paint. |
void |
fillArc(int x,
int y,
int width,
int height,
int arcStart,
int arcAngle)
Fills an arc that is part of an ellipse that fits within the specified framing rectangle. |
void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval that fits within the specified rectangular region. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int npoints)
|
void |
fillRect(int x,
int y,
int width,
int height)
Fill a rectangle area on the swt graphic composite. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rectangle with rounded corners that fits within the specified framing rectangle. |
java.awt.Color |
getBackground()
|
java.awt.Shape |
getClip()
|
java.awt.Rectangle |
getClipBounds()
|
java.awt.Color |
getColor()
Returns the current color for this graphics context. |
java.awt.Composite |
getComposite()
Returns the current composite. |
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
|
java.awt.Font |
getFont()
Returns the font in form of an awt font created with the parameters of the font of the swt graphic composite. |
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font)
|
java.awt.font.FontRenderContext |
getFontRenderContext()
|
java.awt.Paint |
getPaint()
Returns the current paint for this graphics context. |
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key hintKey)
Returns the current value for the specified hint key, or null if no value is set. |
java.awt.RenderingHints |
getRenderingHints()
Returns a copy of the hints collection for this graphics context. |
java.awt.Stroke |
getStroke()
Returns the current stroke for this graphics context. |
java.awt.geom.AffineTransform |
getTransform()
|
boolean |
hit(java.awt.Rectangle rect,
java.awt.Shape text,
boolean onStroke)
|
void |
rotate(double theta)
|
void |
rotate(double theta,
double x,
double y)
|
void |
scale(double scaleX,
double scaleY)
|
void |
setBackground(java.awt.Color color)
|
void |
setClip(int x,
int y,
int width,
int height)
|
void |
setClip(java.awt.Shape clip)
|
void |
setColor(java.awt.Color color)
Sets the current color for this graphics context. |
void |
setComposite(java.awt.Composite comp)
Sets the current composite. |
void |
setFont(java.awt.Font font)
Set the font swt graphic composite from the specified awt font. |
void |
setPaint(java.awt.Paint paint)
Sets the paint for this graphics context. |
void |
setPaintMode()
|
void |
setRenderingHint(java.awt.RenderingHints.Key hintKey,
java.lang.Object hintValue)
Sets the value for a rendering hint. |
void |
setRenderingHints(java.util.Map hints)
Replaces the existing hints with those contained in the specified map. |
void |
setStroke(java.awt.Stroke stroke)
Sets the stroke for this graphics context. |
void |
setTransform(java.awt.geom.AffineTransform Tx)
|
void |
setXORMode(java.awt.Color color)
|
void |
shear(double shearX,
double shearY)
|
void |
transform(java.awt.geom.AffineTransform Tx)
|
void |
translate(double tx,
double ty)
|
void |
translate(int x,
int y)
|
| Methods inherited from class java.awt.Graphics2D |
|---|
draw3DRect, fill3DRect |
| Methods inherited from class java.awt.Graphics |
|---|
create, drawBytes, drawChars, drawPolygon, drawRect, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SWTGraphics2D(GC gc)
gc - the graphics context.| Method Detail |
|---|
public java.awt.Graphics create()
create in class java.awt.Graphicspublic java.awt.GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration in class java.awt.Graphics2Dpublic java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
null if no value is set.
getRenderingHint in class java.awt.Graphics2DhintKey - the hint key (null permitted).
null.#setRenderingHint(Key, Object)
public void setRenderingHint(java.awt.RenderingHints.Key hintKey,
java.lang.Object hintValue)
setRenderingHint in class java.awt.Graphics2DhintKey - the key (null not permitted).hintValue - the value (must be compatible with the specified key).
java.lang.IllegalArgumentException - if hintValue is not
compatible with the hintKey.#getRenderingHint(Key)public java.awt.RenderingHints getRenderingHints()
getRenderingHints in class java.awt.Graphics2Dpublic void addRenderingHints(java.util.Map hints)
addRenderingHints in class java.awt.Graphics2Dhints - the hints (null not permitted).setRenderingHints(Map)public void setRenderingHints(java.util.Map hints)
setRenderingHints in class java.awt.Graphics2Dhints - the hints (null not permitted).addRenderingHints(Map)public java.awt.Paint getPaint()
getPaint in class java.awt.Graphics2DsetPaint(Paint)public void setPaint(java.awt.Paint paint)
Color.
setPaint in class java.awt.Graphics2Dpaint - the paint (null not permitted).getPaint(),
setColor(Color)public java.awt.Color getColor()
getColor in class java.awt.GraphicssetColor(Color)public void setColor(java.awt.Color color)
setColor in class java.awt.Graphicscolor - the color.getColor()public void setBackground(java.awt.Color color)
setBackground in class java.awt.Graphics2Dpublic java.awt.Color getBackground()
getBackground in class java.awt.Graphics2Dpublic void setPaintMode()
setPaintMode in class java.awt.Graphicspublic void setXORMode(java.awt.Color color)
setXORMode in class java.awt.Graphicspublic java.awt.Composite getComposite()
getComposite in class java.awt.Graphics2DsetComposite(Composite)public void setComposite(java.awt.Composite comp)
AlphaComposite class.
setComposite in class java.awt.Graphics2Dcomp - the composite.public java.awt.Stroke getStroke()
getStroke in class java.awt.Graphics2DsetStroke(Stroke)public void setStroke(java.awt.Stroke stroke)
BasicStroke class.
setStroke in class java.awt.Graphics2Dstroke - the stroke (null not permitted).getStroke()public void clip(java.awt.Shape s)
clip in class java.awt.Graphics2Dpublic java.awt.Rectangle getClipBounds()
getClipBounds in class java.awt.Graphics
public void clipRect(int x,
int y,
int width,
int height)
clipRect in class java.awt.Graphicspublic java.awt.Shape getClip()
getClip in class java.awt.Graphicspublic void setClip(java.awt.Shape clip)
setClip in class java.awt.Graphics
public void setClip(int x,
int y,
int width,
int height)
setClip in class java.awt.Graphicspublic java.awt.geom.AffineTransform getTransform()
getTransform in class java.awt.Graphics2Dpublic void setTransform(java.awt.geom.AffineTransform Tx)
setTransform in class java.awt.Graphics2Dpublic void transform(java.awt.geom.AffineTransform Tx)
transform in class java.awt.Graphics2D
public void translate(int x,
int y)
translate in class java.awt.Graphics2D
public void translate(double tx,
double ty)
translate in class java.awt.Graphics2Dpublic void rotate(double theta)
rotate in class java.awt.Graphics2D
public void rotate(double theta,
double x,
double y)
rotate in class java.awt.Graphics2D
public void scale(double scaleX,
double scaleY)
scale in class java.awt.Graphics2D
public void shear(double shearX,
double shearY)
shear in class java.awt.Graphics2Dpublic void draw(java.awt.Shape shape)
draw in class java.awt.Graphics2Dshape - the shape (null not permitted).getPaint(),
getStroke(),
fill(Shape)
public void drawLine(int x1,
int y1,
int x2,
int y2)
drawLine in class java.awt.Graphicsx1 - the x-coordinate for the starting point.y1 - the y-coordinate for the starting point.x2 - the x-coordinate for the ending point.y2 - the y-coordinate for the ending point.draw(Shape)
public void drawPolygon(int[] xPoints,
int[] yPoints,
int npoints)
drawPolygon in class java.awt.GraphicsxPoints - the x-coordinates.yPoints - the y-coordinates.npoints - the number of points in the polygon.draw(Shape)
public void drawPolyline(int[] xPoints,
int[] yPoints,
int npoints)
drawPolyline in class java.awt.GraphicsxPoints - the x-coordinates.yPoints - the y-coordinates.npoints - the number of points in the polygon.draw(Shape)
public void drawOval(int x,
int y,
int width,
int height)
drawOval in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.fillOval(int, int, int, int),
draw(Shape)
public void drawArc(int x,
int y,
int width,
int height,
int arcStart,
int arcAngle)
drawArc in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.arcStart - the arc starting point, in degrees.arcAngle - the extent of the arc.fillArc(int, int, int, int, int, int)
public void drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
drawRoundRect in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.arcWidth - the width of the arc defining the roundedness of the
rectangle's corners.arcHeight - the height of the arc defining the roundedness of the
rectangle's corners.fillRoundRect(int, int, int, int, int, int)public void fill(java.awt.Shape shape)
fill in class java.awt.Graphics2Dshape - the shape (null not permitted).getPaint(),
draw(Shape)
public void fillRect(int x,
int y,
int width,
int height)
fillRectangle method of the GC
class uses the background color so we must switch colors.
fillRect in class java.awt.GraphicsGraphics.fillRect(int, int, int, int)
public void clearRect(int x,
int y,
int width,
int height)
clearRect in class java.awt.Graphicsx - the x-coordinate for the rectangle.y - the y-coordinate for the rectangle.width - the width.height - the height.fillRect(int, int, int, int)
public void fillPolygon(int[] xPoints,
int[] yPoints,
int npoints)
fillPolygon in class java.awt.Graphics
public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
fillRoundRect in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.arcWidth - the width of the arc defining the roundedness of the
rectangle's corners.arcHeight - the height of the arc defining the roundedness of the
rectangle's corners.drawRoundRect(int, int, int, int, int, int)
public void fillOval(int x,
int y,
int width,
int height)
fillOval in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.drawOval(int, int, int, int),
fill(Shape)
public void fillArc(int x,
int y,
int width,
int height,
int arcStart,
int arcAngle)
fillArc in class java.awt.Graphicsx - the x-coordinate.y - the y-coordinate.width - the frame width.height - the frame height.arcStart - the arc starting point, in degrees.arcAngle - the extent of the arc.drawArc(int, int, int, int, int, int)public java.awt.Font getFont()
getFont in class java.awt.GraphicsGraphics.getFont()public void setFont(java.awt.Font font)
setFont in class java.awt.GraphicsGraphics.setFont(java.awt.Font)public java.awt.FontMetrics getFontMetrics(java.awt.Font font)
getFontMetrics in class java.awt.Graphicspublic java.awt.font.FontRenderContext getFontRenderContext()
getFontRenderContext in class java.awt.Graphics2D
public void drawGlyphVector(java.awt.font.GlyphVector g,
float x,
float y)
drawGlyphVector in class java.awt.Graphics2D
public void drawString(java.lang.String text,
int x,
int y)
drawString in class java.awt.Graphics2DGraphics.drawString(java.lang.String, int, int)
public void drawString(java.lang.String text,
float x,
float y)
drawString in class java.awt.Graphics2D
public void drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
drawString in class java.awt.Graphics2D
public void drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
drawString in class java.awt.Graphics2D
public boolean hit(java.awt.Rectangle rect,
java.awt.Shape text,
boolean onStroke)
hit in class java.awt.Graphics2D
public void copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
copyArea in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver obs)
drawImage in class java.awt.Graphics2D
public void drawImage(java.awt.image.BufferedImage image,
java.awt.image.BufferedImageOp op,
int x,
int y)
drawImage in class java.awt.Graphics2D
public void drawImage(org.eclipse.swt.graphics.Image image,
int x,
int y)
image - the image.x - the x-coordinate.y - the y-coordinate.
public void drawRenderedImage(java.awt.image.RenderedImage image,
java.awt.geom.AffineTransform xform)
drawRenderedImage in class java.awt.Graphics2D
public void drawRenderableImage(java.awt.image.renderable.RenderableImage image,
java.awt.geom.AffineTransform xform)
drawRenderableImage in class java.awt.Graphics2D
public boolean drawImage(java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphics
public boolean drawImage(java.awt.Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicspublic void dispose()
dispose in class java.awt.Graphics
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||