public class Graphics2DGraphicContext extends Object implements GraphicContext
GraphicContext implementation using the Swing Graphics2D to draw on
whatever you like.| Constructor and Description |
|---|
Graphics2DGraphicContext(Graphics2D graphics) |
| Modifier and Type | Method and Description |
|---|---|
Area |
calculateTextSize(String text) |
void |
clip(Area rect) |
Graphics2DGraphicContext |
delegate(Graphics2D newDelegate)
Sets the Graphics2D.
|
void |
drawLine(double x1,
double y1,
double x2,
double y2) |
void |
drawPolyline(double[] x,
double[] y) |
void |
drawText(double x,
double y,
String text) |
void |
fillArc(double x,
double y,
double width,
double height,
double startAngle,
double arcAngle) |
void |
fillOval(double x,
double y,
double width,
double height) |
void |
fillPolygon(double[] x,
double[] y) |
void |
fillRectangle(double x,
double y,
double width,
double height) |
int |
getColor() |
Graphics2D |
getDelegate()
Returns the Graphics2D.
|
Font |
getFont() |
void |
scale(double x,
double y) |
void |
setColor(int color) |
void |
setDelegate(Graphics2D delegate)
Sets the Graphics2D.
|
void |
setFont(Font fontAsEnum) |
void |
translate(double x,
double y) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdrawRectangle, drawRectangle, fillRectangle, scalepublic Graphics2DGraphicContext(Graphics2D graphics)
public void setColor(int color)
setColor in interface GraphicContextpublic int getColor()
getColor in interface GraphicContextpublic void setFont(Font fontAsEnum)
setFont in interface GraphicContextpublic Font getFont()
getFont in interface GraphicContextpublic Area calculateTextSize(String text)
calculateTextSize in interface GraphicContextpublic void translate(double x,
double y)
translate in interface GraphicContextpublic void scale(double x,
double y)
scale in interface GraphicContextpublic void clip(Area rect)
clip in interface GraphicContextpublic void drawLine(double x1,
double y1,
double x2,
double y2)
drawLine in interface GraphicContextpublic void fillRectangle(double x,
double y,
double width,
double height)
fillRectangle in interface GraphicContextpublic void drawPolyline(double[] x,
double[] y)
drawPolyline in interface GraphicContextpublic void fillPolygon(double[] x,
double[] y)
fillPolygon in interface GraphicContextpublic void drawText(double x,
double y,
String text)
drawText in interface GraphicContextpublic void fillOval(double x,
double y,
double width,
double height)
fillOval in interface GraphicContextpublic void fillArc(double x,
double y,
double width,
double height,
double startAngle,
double arcAngle)
fillArc in interface GraphicContextpublic Graphics2D getDelegate()
public Graphics2DGraphicContext delegate(Graphics2D newDelegate)
newDelegate - the Graphics2D to draw on; cannot be nullpublic void setDelegate(Graphics2D delegate)
delegate - the Graphics2D to draw on; cannot be nullCopyright © 2020. All rights reserved.