public abstract class ImageWorker extends Object
| Constructor and Description |
|---|
ImageWorker() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void | clip(int x,
int y,
int width,
int height)Set the clipping region for drawing operations. |
(package private) void | dispose()Dispose of the graphics context. |
(package private) void | drawLine(int x1,
int y1,
int x2,
int y2,
Paint paint,
Stroke stroke)Draw a line with the given paint and stroke. |
(package private) void | drawPolyline(double[] x,
double[] y,
Paint paint,
Stroke stroke)Draw a polyline with the given paint and stroke. |
(package private) void | drawString(String text,
int x,
int y,
Font font,
Paint paint)Draw a string at the given position with the specified font and paint. |
(package private) void | fillPolygon(double[] x,
double[] yBottom,
double[] yTop,
Paint paint)Fill a polygon with variable bottom points. |
(package private) void | fillPolygon(double[] x,
double yBottom,
double[] yTop,
Paint paint)Fill a polygon with a flat bottom. |
(package private) void | fillRect(int x,
int y,
int width,
int height,
Paint paint)Fill a rectangle with the given paint. |
(package private) double | getFontAscent(Font font)Get the ascent of the given font. |
(package private) double | getFontHeight(Font font)Get the total height of the given font. |
(package private) byte[] | getImageBytes()Get the image as a byte array. |
(package private) double | getStringWidth(String text,
Font font)Get the width of the given text in the specified font. |
(package private) void | loadImage(RrdGraphDef.ImageSource imageSource,
int x,
int y,
int w,
int h)Load and draw an image from the given source. |
(package private) abstract void | makeImage(OutputStream os)Write the image to the given output stream. |
(package private) void | makeImage(Path path)Write the image to the given path. |
(package private) void | reset()Reset the graphics state. |
protected abstract void | reset(Graphics2D g2d)Reset the graphics state using the given context. |
protected void | resetState()Resets cached state tracking. |
(package private) abstract void | resize(int width,
int height)Resize the image to the given dimensions. |
(package private) void | saveImage(String path)Save the image to the given file path. |
(package private) void | setAntiAliasing(boolean enable)Enable or disable anti-aliasing. |
protected void | setG2d(Graphics2D g2d)Sets the graphics context for drawing operations. |
(package private) void | setTextAntiAliasing(boolean enable)Enable or disable text anti-aliasing. |
(package private) void | transform(int x,
int y,
double angle)Apply a translation and rotation transform. |
void clip(int x,
int y,
int width,
int height)x - the x coordinatey - the y coordinatewidth - the widthheight - the heightvoid dispose()
void drawLine(int x1,
int y1,
int x2,
int y2,
Paint paint,
Stroke stroke)x1 - the starting x coordinatey1 - the starting y coordinatex2 - the ending x coordinatey2 - the ending y coordinatepaint - the paintstroke - the strokevoid drawPolyline(double[] x,
double[] y,
Paint paint,
Stroke stroke)x - the x coordinatesy - the y coordinatespaint - the paintstroke - the strokevoid drawString(String text, int x, int y, Font font, Paint paint)
text - the text to drawx - the x coordinatey - the y coordinatefont - the fontpaint - the paintvoid fillPolygon(double[] x,
double[] yBottom,
double[] yTop,
Paint paint)x - the x coordinatesyBottom - the bottom y coordinatesyTop - the top y coordinatespaint - the paint to fill withvoid fillPolygon(double[] x,
double yBottom,
double[] yTop,
Paint paint)x - the x coordinatesyBottom - the bottom y coordinateyTop - the top y coordinatespaint - the paint to fill withvoid fillRect(int x,
int y,
int width,
int height,
Paint paint)x - the x coordinatey - the y coordinatewidth - the widthheight - the heightpaint - the paint to fill withdouble getFontAscent(Font font)
font - the fontdouble getFontHeight(Font font)
font - the fontbyte[] getImageBytes()
throws IOExceptionIOException - if an I/O error occursdouble getStringWidth(String text, Font font)
text - the textfont - the fontvoid loadImage(RrdGraphDef.ImageSource imageSource, int x, int y, int w, int h) throws IOException
imageSource - the image sourcex - the x coordinatey - the y coordinatew - the widthh - the heightIOException - if an I/O error occursabstract void makeImage(OutputStream os) throws IOException
os - the output streamIOException - if an I/O error occursvoid makeImage(Path path) throws IOException
path - the output pathIOException - if an I/O error occursvoid reset()
protected abstract void reset(Graphics2D g2d)
g2d - the graphics contextprotected void resetState()
abstract void resize(int width,
int height)width - the new widthheight - the new heightvoid saveImage(String path) throws IOException
path - the file pathIOException - if an I/O error occursvoid setAntiAliasing(boolean enable)
enable - true to enable, false to disableprotected void setG2d(Graphics2D g2d)
g2d - new graphics contextvoid setTextAntiAliasing(boolean enable)
enable - true to enable, false to disablevoid transform(int x,
int y,
double angle)x - the x translationy - the y translationangle - the rotation angle