public class AwtRenderingBackend extends Object implements RenderingBackend
RenderingBackend.RenderingBackend.WindingRule| Constructor and Description | 
|---|
| AwtRenderingBackend(int imageWidth,
                   int imageHeight)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | arc(double x,
   double y,
   double radius,
   double startAngle,
   double endAngle,
   boolean anticlockwise)Adds a circular arc to the current sub-path. | 
| void | beginPath()Starts a new path by emptying the list of sub-paths. | 
| void | bezierCurveTo(double cp1x,
             double cp1y,
             double cp2x,
             double cp2y,
             double x,
             double y)Adds a cubic Bézier curve to the current sub-path. | 
| void | clearRect(double x,
         double y,
         double w,
         double h)Paints the specified rectangular area. | 
| void | clip(RenderingBackend.WindingRule windingRule,
    Path2D path)Turns the current or given path into the current clipping region. | 
| void | closePath()Attempts to add a straight line from the current point to the start of the current sub-path. | 
| void | drawImage(ImageData imageData,
         int sx,
         int sy,
         Integer sWidth,
         Integer sHeight,
         int dx,
         int dy,
         Integer dWidth,
         Integer dHeight)Draws images onto the context. | 
| void | ellipse(double x,
       double y,
       double radiusX,
       double radiusY,
       double rotation,
       double startAngle,
       double endAngle,
       boolean anticlockwise)Creates an elliptical arc centered at (x, y) with the radii radiusX and radiusY. | 
| String | encodeToString(String type)Constructs a base64 encoded string out of the image data. | 
| void | fill()Fills the current or given path with the current fillStyle. | 
| void | fillRect(int x,
        int y,
        int w,
        int h)Paints the specified rectangular area. | 
| void | fillText(String text,
        double x,
        double y)Fills a given text at the given (x, y) position. | 
| byte[] | getBytes(int width,
        int height,
        int sx,
        int sy)Creates a byte array containing the (4) color values of all pixels. | 
| double | getGlobalAlpha() | 
| int | getLineWidth()Returns the  lineWidthproperty. | 
| void | lineTo(double x,
      double y)Adds a straight line to the current sub-path by connecting the
 sub-path's last point to the specified (x, y) coordinates. | 
| void | moveTo(double x,
      double y)Begins a new sub-path at the point specified
 by the given (x, y) coordinates. | 
| void | putImageData(byte[] imageDataBytes,
            int imageDataWidth,
            int imageDataHeight,
            int dx,
            int dy,
            int dirtyX,
            int dirtyY,
            int dirtyWidth,
            int dirtyHeight)Paints data from the given ImageData object onto the canvas. | 
| void | quadraticCurveTo(double cpx,
                double cpy,
                double x,
                double y)Adds a quadratic Bézier curve to the current sub-path. | 
| void | rect(double x,
    double y,
    double w,
    double h)Adds a rectangle to the current path. | 
| void | restore()Restores the most recently saved canvas state by popping the top
 entry in the drawing state stack. | 
| void | rotate(double angle)Adds a rotation to the transformation matrix. | 
| void | save()Saves the entire state of the canvas by pushing
 the current state onto a stack. | 
| void | setFillStyle(String fillStyle)Sets the  fillStyleproperty. | 
| void | setGlobalAlpha(double globalAlpha)Specifies the alpha (transparency) value that is applied to shapes and images
 before they are drawn onto the canvas. | 
| void | setLineWidth(int lineWidth)Sets the  lineWidthproperty. | 
| void | setStrokeStyle(String strokeStyle)Sets the  strokeStyleproperty. | 
| void | setTransform(double m11,
            double m12,
            double m21,
            double m22,
            double dx,
            double dy)Resets (overrides) the current transformation to the identity matrix,
 and then invokes a transformation described by the arguments of this method. | 
| void | stroke()Strokes (outlines) the current or given path with the current stroke style. | 
| void | strokeRect(int x,
          int y,
          int w,
          int h)Paints the specified rectangular area. | 
| void | transform(double m11,
         double m12,
         double m21,
         double m22,
         double dx,
         double dy)Multiplies the current transformation with the matrix described by the
 arguments of this method. | 
| void | translate(int x,
         int y)Adds a translation transformation to the current matrix. | 
public AwtRenderingBackend(int imageWidth,
                           int imageHeight)
imageWidth - the widthimageHeight - the heightpublic double getGlobalAlpha()
getGlobalAlpha in interface RenderingBackendpublic void setGlobalAlpha(double globalAlpha)
setGlobalAlpha in interface RenderingBackendglobalAlpha - the new alphapublic void beginPath()
beginPath in interface RenderingBackendpublic void ellipse(double x,
                    double y,
                    double radiusX,
                    double radiusY,
                    double rotation,
                    double startAngle,
                    double endAngle,
                    boolean anticlockwise)
ellipse in interface RenderingBackendx - the xy - the yradiusX - the radiusXradiusY - the radiusYrotation - the rotationstartAngle - the start angleendAngle - the end angleanticlockwise - is anti-clockwisepublic void bezierCurveTo(double cp1x,
                          double cp1y,
                          double cp2x,
                          double cp2y,
                          double x,
                          double y)
bezierCurveTo in interface RenderingBackendcp1x - the cp1xcp1y - the cp1ycp2x - the cp2xcp2y - the cp2yx - the xy - the ypublic void arc(double x,
                double y,
                double radius,
                double startAngle,
                double endAngle,
                boolean anticlockwise)
arc in interface RenderingBackendx - the xy - the yradius - the radiusstartAngle - the start angleendAngle - the end angleanticlockwise - is anti-clockwisepublic void clearRect(double x,
                      double y,
                      double w,
                      double h)
clearRect in interface RenderingBackendx - the xy - the yw - the widthh - the heightpublic void drawImage(ImageData imageData, int sx, int sy, Integer sWidth, Integer sHeight, int dx, int dy, Integer dWidth, Integer dHeight) throws IOException
drawImage in interface RenderingBackendimageData - the reader to read the image from 8the first one)sx - the X coordinate of the top left corner of the sub-rectangle of the source image
        to draw into the destination contextsy - the Y coordinate of the top left corner of the sub-rectangle of the source image
        to draw into the destination contextsWidth - the width of the sub-rectangle of the source image to draw into the destination contextsHeight - the height of the sub-rectangle of the source image to draw into the destination contextdx - the X coordinate in the destination canvas at which to place the top-left corner of the source imagedy - the Y coordinate in the destination canvas at which to place the top-left corner of the source imagedWidth - the width to draw the image in the destination canvas. This allows scaling of the drawn imagedHeight - the height to draw the image in the destination canvas. This allows scaling of the drawn imageIOException - in case o problemspublic String encodeToString(String type) throws IOException
encodeToString in interface RenderingBackendtype - the name of the image formatIOException - in case o problemspublic void fill()
fill in interface RenderingBackendpublic void fillRect(int x,
                     int y,
                     int w,
                     int h)
fillRect in interface RenderingBackendx - the xy - the yw - the widthh - the heightpublic void fillText(String text, double x, double y)
fillText in interface RenderingBackendtext - the textx - the xy - the ypublic byte[] getBytes(int width,
                       int height,
                       int sx,
                       int sy)
getBytes in interface RenderingBackendwidth - the widthheight - the heightsx - start point xsy - start point ypublic void lineTo(double x,
                   double y)
lineTo in interface RenderingBackendx - the xy - the ypublic void moveTo(double x,
                   double y)
moveTo in interface RenderingBackendx - the xy - the ypublic void putImageData(byte[] imageDataBytes,
                         int imageDataWidth,
                         int imageDataHeight,
                         int dx,
                         int dy,
                         int dirtyX,
                         int dirtyY,
                         int dirtyWidth,
                         int dirtyHeight)
putImageData in interface RenderingBackendimageDataBytes - an array of pixel valuesimageDataWidth - the height of the imageDataimageDataHeight - the width of the imageDatadx - horizontal position (x coordinate) at which to place the image data in the destination canvasdy - vertical position (y coordinate) at which to place the image data in the destination canvasdirtyX - horizontal position (x coordinate) of the top-left corner
        from which the image data will be extracted. Defaults to 0.dirtyY - vertical position (y coordinate) of the top-left corner
        from which the image data will be extracted. Defaults to 0.dirtyWidth - width of the rectangle to be painted.
        Defaults to the width of the image data.dirtyHeight - height of the rectangle to be painted.
        Defaults to the height of the image data.public void quadraticCurveTo(double cpx,
                             double cpy,
                             double x,
                             double y)
quadraticCurveTo in interface RenderingBackendcpx - the cpxcpy - the cpyx - the xy - the ypublic void rect(double x,
                 double y,
                 double w,
                 double h)
rect in interface RenderingBackendx - the xy - the yw - the widthh - the heightpublic void setFillStyle(String fillStyle)
fillStyle property.setFillStyle in interface RenderingBackendfillStyle - the fillStyle propertypublic void setStrokeStyle(String strokeStyle)
strokeStyle property.setStrokeStyle in interface RenderingBackendstrokeStyle - the strokeStyle propertypublic int getLineWidth()
lineWidth property.getLineWidth in interface RenderingBackendlineWidth propertypublic void restore()
restore in interface RenderingBackendpublic void rotate(double angle)
rotate in interface RenderingBackendangle - the anglepublic void save()
save in interface RenderingBackendpublic void setLineWidth(int lineWidth)
lineWidth property.setLineWidth in interface RenderingBackendlineWidth - the lineWidth propertypublic void setTransform(double m11,
                         double m12,
                         double m21,
                         double m22,
                         double dx,
                         double dy)
setTransform in interface RenderingBackendm11 - Horizontal scaling. A value of 1 results in no scalingm12 - Vertical skewingm21 - Horizontal skewingm22 - Vertical scaling. A value of 1 results in no scalingdx - Horizontal translation (moving)dy - Vertical translation (moving).public void stroke()
stroke in interface RenderingBackendpublic void strokeRect(int x,
                       int y,
                       int w,
                       int h)
strokeRect in interface RenderingBackendx - the xy - the yw - the widthh - the heightpublic void transform(double m11,
                      double m12,
                      double m21,
                      double m22,
                      double dx,
                      double dy)
transform in interface RenderingBackendm11 - Horizontal scaling. A value of 1 results in no scalingm12 - Vertical skewingm21 - Horizontal skewingm22 - Vertical scaling. A value of 1 results in no scalingdx - Horizontal translation (moving)dy - Vertical translation (moving).public void translate(int x,
                      int y)
translate in interface RenderingBackendx - the xy - the ypublic void clip(RenderingBackend.WindingRule windingRule, Path2D path)
clip in interface RenderingBackendwindingRule - the RenderingBackend.WindingRule RenderingBackend.WindingRule
        to be usedpath - the path or null if the current path should be usedpublic void closePath()
closePath in interface RenderingBackendCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.