Interface IGraphics
-
- All Known Implementing Classes:
SvgGraphics
public interface IGraphics
Interface for graphics context that provides methods for drawing graphics primitives.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clears all drawing operations.void
drawCircle(double x, double y, double radius)
Draws the outline of a circle.void
drawLine(double x1, double y1, double x2, double y2)
Draws a line from point (x1,y1) to point (x2,y2).void
drawPolygon(List<Point> points)
Draws the outline of a polygon defined by a list of points.void
drawRectangle(double x, double y, double width, double height)
Draws the outline of a rectangle.void
drawText(String text, double x, double y)
Draws text at the specified position.void
fillCircle(double x, double y, double radius)
Fills a circle with the current fill color.void
fillPolygon(List<Point> points)
Fills a polygon defined by a list of points with the current fill color.void
fillRectangle(double x, double y, double width, double height)
Fills a rectangle with the current fill color.void
setFillColor(Color color)
Sets the color used for filling shapes.void
setFont(String fontFamily, double fontSize)
Sets the font used for drawing text.void
setStrokeColor(Color color)
Sets the color used for drawing outlines.void
setStrokeWidth(double width)
Sets the width of the stroke used for drawing outlines.String
toSvg()
Generates the SVG representation of all drawing operations.
-
-
-
Method Detail
-
drawLine
void drawLine(double x1, double y1, double x2, double y2)
Draws a line from point (x1,y1) to point (x2,y2).- Parameters:
x1
- The x coordinate of the first point.y1
- The y coordinate of the first point.x2
- The x coordinate of the second point.y2
- The y coordinate of the second point.
-
drawRectangle
void drawRectangle(double x, double y, double width, double height)
Draws the outline of a rectangle.- Parameters:
x
- The x coordinate of the upper-left corner of the rectangle.y
- The y coordinate of the upper-left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.
-
fillRectangle
void fillRectangle(double x, double y, double width, double height)
Fills a rectangle with the current fill color.- Parameters:
x
- The x coordinate of the upper-left corner of the rectangle.y
- The y coordinate of the upper-left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.
-
drawCircle
void drawCircle(double x, double y, double radius)
Draws the outline of a circle.- Parameters:
x
- The x coordinate of the center of the circle.y
- The y coordinate of the center of the circle.radius
- The radius of the circle.
-
fillCircle
void fillCircle(double x, double y, double radius)
Fills a circle with the current fill color.- Parameters:
x
- The x coordinate of the center of the circle.y
- The y coordinate of the center of the circle.radius
- The radius of the circle.
-
drawPolygon
void drawPolygon(List<Point> points)
Draws the outline of a polygon defined by a list of points.- Parameters:
points
- List of points defining the polygon.
-
fillPolygon
void fillPolygon(List<Point> points)
Fills a polygon defined by a list of points with the current fill color.- Parameters:
points
- List of points defining the polygon.
-
drawText
void drawText(String text, double x, double y)
Draws text at the specified position.- Parameters:
text
- The text to draw.x
- The x coordinate where to draw the text.y
- The y coordinate where to draw the text.
-
setStrokeColor
void setStrokeColor(Color color)
Sets the color used for drawing outlines.- Parameters:
color
- The color to use for drawing outlines.
-
setFillColor
void setFillColor(Color color)
Sets the color used for filling shapes.- Parameters:
color
- The color to use for filling shapes.
-
setStrokeWidth
void setStrokeWidth(double width)
Sets the width of the stroke used for drawing outlines.- Parameters:
width
- The width of the stroke.
-
setFont
void setFont(String fontFamily, double fontSize)
Sets the font used for drawing text.- Parameters:
fontFamily
- The font family name.fontSize
- The font size.
-
toSvg
String toSvg()
Generates the SVG representation of all drawing operations.- Returns:
- A string containing the SVG representation.
-
clear
void clear()
Clears all drawing operations.
-
-