GraphicsPainter (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.render.intermediate

## Interface GraphicsPainter

- All Known Implementing Classes:
    PDFGraphicsPainter, PSGraphicsPainter

      public interface GraphicsPainter

  Used primarily by `BorderPainter`, implementations are created for rendering primitive graphical operations.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `arcTo(double startAngle, double endAngle, int cx, int cy, int width, int height)` Draws an arc on the ellipse centered at (cx, cy) with width width and height height from start angle startAngle (with respect to the x-axis counter-clockwise) to the end angle endAngle.
    `void` | `clip()` Reduces the current clipping region to the current path.
    `void` | `closePath()` Closes the current path.
    `void` | `drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, boolean startOrBefore, int style, Color color)` Draws a border line.
    `void` | `drawLine(Point start, Point end, int width, Color color, RuleStyle style)` Draws a line/rule.
    `void` | `lineTo(int x, int y)` Draws a line from the current cursor position to the given coordinates.
    `void` | `moveTo(int x, int y)` Moves the cursor to the given coordinate.
    `void` | `restoreGraphicsState()` Restore the last graphics state from the stack.
    `void` | `rotateCoordinates(double angle)` Rotate the coordinate frame
    `void` | `saveGraphicsState()` Save the graphics state on the stack.
    `void` | `scaleCoordinates(float xScale, float yScale)` Scale the coordinate frame
    `void` | `translateCoordinates(int xTranslate, int yTranslate)` Translate the coordinate frame

- - ### Method Detail

    - #### drawBorderLine

          void drawBorderLine(int x1,
                              int y1,
                              int x2,
                              int y2,
                              boolean horz,
                              boolean startOrBefore,
                              int style,
                              Color color)
                       throws IOException

      Draws a border line.
      Parameters:
        `x1` - X coordinate of the upper left corner of the line's bounding rectangle (in millipoints)
        `y1` - start Y coordinate of the upper left corner of the line's bounding rectangle (in millipoints)
        `x2` - end X coordinate of the lower right corner of the line's bounding rectangle (in millipoints)
        `y2` - end y coordinate of the lower right corner of the line's bounding rectangle (in millipoints)
        `horz` - true if it is a horizontal line
        `startOrBefore` - true if the line is the start or end edge of a border box
        `style` - the border style
        `color` - the border color
      Throws:
        `IOException` - if an I/O error occurs

    - #### drawLine

          void drawLine(Point start,
                        Point end,
                        int width,
                        Color color,
                        RuleStyle style)
                 throws IOException

      Draws a line/rule.
      Parameters:
        `start` - start point (coordinates in millipoints)
        `end` - end point (coordinates in millipoints)
        `width` - width of the line
        `color` - the line color
        `style` - the rule style
      Throws:
        `IOException` - if an I/O error occurs

    - #### moveTo

          void moveTo(int x,
                      int y)
               throws IOException

      Moves the cursor to the given coordinate.
      Parameters:
        `x` - the X coordinate (in millipoints)
        `y` - the Y coordinate (in millipoints)
      Throws:
        `IOException` - if an I/O error occurs

    - #### lineTo

          void lineTo(int x,
                      int y)
               throws IOException

      Draws a line from the current cursor position to the given coordinates.
      Parameters:
        `x` - the X coordinate (in millipoints)
        `y` - the Y coordinate (in millipoints)
      Throws:
        `IOException` - if an I/O error occurs

    - #### arcTo

          void arcTo(double startAngle,
                     double endAngle,
                     int cx,
                     int cy,
                     int width,
                     int height)
              throws IOException

      Draws an arc on the ellipse centered at (cx, cy) with width width and height height from start angle startAngle (with respect to the x-axis counter-clockwise) to the end angle endAngle. The ellipses major axis are assumed to coincide with the coordinate axis. The current position MUST coincide with the starting position on the ellipse.
      Parameters:
        `startAngle` - the start angle
        `endAngle` - the end angle
        `cx` - the x coordinate of the ellipse center
        `cy` - the y coordinate of the ellipse center
        `width` - the extent of the ellipse in the x direction
        `height` - the extent of the ellipse in the y direction
      Throws:
        `IOException` - if an I/O error occurs

    - #### rotateCoordinates

          void rotateCoordinates(double angle)
                          throws IOException

      Rotate the coordinate frame
      Parameters:
        `angle` - angle in radians to rotate the coordinate frame
      Throws:
        `IOException` - if an I/O error occurs

    - #### translateCoordinates

          void translateCoordinates(int xTranslate,
                                    int yTranslate)
                             throws IOException

      Translate the coordinate frame
      Parameters:
        `xTranslate` - translation in the x direction
        `yTranslate` - translation in the y direction
      Throws:
        `IOException` - if an I/O error occurs

    - #### scaleCoordinates

          void scaleCoordinates(float xScale,
                                float yScale)
                         throws IOException

      Scale the coordinate frame
      Parameters:
        `xScale` - scale factor in the x direction
        `yScale` - scale factor in the y direction
      Throws:
        `IOException` - if an I/O error occurs

    - #### closePath

          void closePath()
                  throws IOException

      Closes the current path.
      Throws:
        `IOException` - if an I/O error occurs

    - #### clip

          void clip()
             throws IOException

      Reduces the current clipping region to the current path.
      Throws:
        `IOException` - if an I/O error occurs

    - #### saveGraphicsState

          void saveGraphicsState()
                          throws IOException

      Save the graphics state on the stack.
      Throws:
        `IOException` - if an I/O error occurs

    - #### restoreGraphicsState

          void restoreGraphicsState()
                             throws IOException

      Restore the last graphics state from the stack.
      Throws:
        `IOException` - if an I/O error occurs

Copyright © 2025 Apache Software Foundation. All rights reserved.