org.apache.fop.render.pcl

## Class PCLGraphics2D

- java.lang.Object
- - java.awt.Graphics
  - - java.awt.Graphics2D
    - - org.apache.xmlgraphics.java2d.AbstractGraphics2D
      - - org.apache.fop.render.pcl.PCLGraphics2D

- All Implemented Interfaces:
    Cloneable

      public class PCLGraphics2D
      extends org.apache.xmlgraphics.java2d.AbstractGraphics2D

  Graphics2D implementation implementing PCL and HP GL/2. Note: This class cannot be used stand-alone to create full PCL documents.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected PCLGenerator` | `gen` The PCL generator

    - ### Fields inherited from class org.apache.xmlgraphics.java2d.AbstractGraphics2D

      `gc, inPossibleRecursion, textAsShapes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PCLGraphics2D(PCLGenerator gen)` Create a new PCLGraphics2D.
    `PCLGraphics2D(PCLGraphics2D g)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `applyPaint(Paint paint)` Applies a new Paint object.
    `protected void` | `applyStroke(Stroke stroke)` Applies a new Stroke object.
    `protected BufferedImage` | `buildBufferedImage(Dimension size)` Creates a buffered image.
    `void` | `copyArea(int x, int y, int width, int height, int dx, int dy)`
    `Graphics` | `create()`
    `void` | `dispose()`
    `void` | `draw(Shape s)`
    `boolean` | `drawImage(Image img, int x, int y, ImageObserver observer)`
    `boolean` | `drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)`
    `void` | `drawRenderableImage(RenderableImage img, AffineTransform xform)`
    `void` | `drawRenderedImage(RenderedImage img, AffineTransform xform)`
    `void` | `drawString(AttributedCharacterIterator iterator, float x, float y)`
    `void` | `drawString(String s, float x, float y)`
    `void` | `fill(Shape s)`
    `GraphicsConfiguration` | `getDeviceConfiguration()`
    `FontMetrics` | `getFontMetrics(Font f)`
    `void` | `handleIOException(IOException ioe)` Central handler for IOExceptions for this class.
    `protected void` | `handleUnsupportedFeature(String msg)` Raises an UnsupportedOperationException if this instance is configured to do so and an unsupported feature has been requested.
    `void` | `processPathIteratorFill(PathIterator iter)` Processes a path iterator generating the nexessary painting operations.
    `void` | `processPathIteratorStroke(PathIterator iter)` Processes a path iterator generating the nexessary painting operations.
    `void` | `setClippingDisabled(boolean value)` Allows to disable all clipping operations.
    `void` | `setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)` Sets the GraphicContext
    `void` | `setXORMode(Color c1)`

    - ### Methods inherited from class org.apache.xmlgraphics.java2d.AbstractGraphics2D

      `addRenderingHints, clearRect, clip, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getBackground, getClip, getClipBounds, getColor, getComposite, getFont, getFontRenderContext, getGraphicContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setBackground, setClip, setClip, setColor, setComposite, setFont, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate`

    - ### Methods inherited from class java.awt.Graphics2D

      `draw3DRect, fill3DRect`

    - ### Methods inherited from class java.awt.Graphics

      `create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### gen

          protected PCLGenerator gen

      The PCL generator

  - ### Constructor Detail

    - #### PCLGraphics2D

          public PCLGraphics2D(PCLGenerator gen)

      Create a new PCLGraphics2D.
      Parameters:
        `gen` - the PCL Generator to paint with

    - #### PCLGraphics2D

          public PCLGraphics2D(PCLGraphics2D g)

      Copy constructor
      Parameters:
        `g` - parent PCLGraphics2D

  - ### Method Detail

    - #### create

          public Graphics create()

      Specified by:
        `create` in class `Graphics`

    - #### dispose

          public void dispose()

      Specified by:
        `dispose` in class `Graphics`

    - #### setGraphicContext

          public void setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)

      Sets the GraphicContext
      Parameters:
        `c` - GraphicContext to use

    - #### setClippingDisabled

          public void setClippingDisabled(boolean value)

      Allows to disable all clipping operations.
      Parameters:
        `value` - true if clipping should be disabled.

    - #### handleIOException

          public void handleIOException(IOException ioe)

      Central handler for IOExceptions for this class.
      Parameters:
        `ioe` - IOException to handle

    - #### handleUnsupportedFeature

          protected void handleUnsupportedFeature(String msg)

      Raises an UnsupportedOperationException if this instance is configured to do so and an unsupported feature has been requested. Clients can make use of this to fall back to a more compatible way of painting a PCL graphic.
      Parameters:
        `msg` - the error message to be displayed

    - #### getDeviceConfiguration

          public GraphicsConfiguration getDeviceConfiguration()

      Specified by:
        `getDeviceConfiguration` in class `Graphics2D`

    - #### applyStroke

          protected void applyStroke(Stroke stroke)
                              throws IOException

      Applies a new Stroke object.
      Parameters:
        `stroke` - Stroke object to use
      Throws:
        `IOException` - In case of an I/O problem

    - #### applyPaint

          protected void applyPaint(Paint paint)
                             throws IOException

      Applies a new Paint object.
      Parameters:
        `paint` - Paint object to use
      Throws:
        `IOException` - In case of an I/O problem

    - #### draw

          public void draw(Shape s)

      Specified by:
        `draw` in class `Graphics2D`

    - #### fill

          public void fill(Shape s)

      Specified by:
        `fill` in class `Graphics2D`

    - #### processPathIteratorStroke

          public void processPathIteratorStroke(PathIterator iter)
                                         throws IOException

      Processes a path iterator generating the nexessary painting operations.
      Parameters:
        `iter` - PathIterator to process
      Throws:
        `IOException` - In case of an I/O problem.

    - #### processPathIteratorFill

          public void processPathIteratorFill(PathIterator iter)
                                       throws IOException

      Processes a path iterator generating the nexessary painting operations.
      Parameters:
        `iter` - PathIterator to process
      Throws:
        `IOException` - In case of an I/O problem.

    - #### drawString

          public void drawString(String s,
                                 float x,
                                 float y)

      Specified by:
        `drawString` in class `Graphics2D`

    - #### drawString

          public void drawString(AttributedCharacterIterator iterator,
                                 float x,
                                 float y)

      Overrides:
        `drawString` in class `org.apache.xmlgraphics.java2d.AbstractGraphics2D`

    - #### drawRenderedImage

          public void drawRenderedImage(RenderedImage img,
                                        AffineTransform xform)

      Specified by:
        `drawRenderedImage` in class `Graphics2D`

    - #### drawRenderableImage

          public void drawRenderableImage(RenderableImage img,
                                          AffineTransform xform)

      Specified by:
        `drawRenderableImage` in class `Graphics2D`

    - #### drawImage

          public boolean drawImage(Image img,
                                   int x,
                                   int y,
                                   int width,
                                   int height,
                                   ImageObserver observer)

      Specified by:
        `drawImage` in class `Graphics`

    - #### drawImage

          public boolean drawImage(Image img,
                                   int x,
                                   int y,
                                   ImageObserver observer)

      Specified by:
        `drawImage` in class `Graphics`

    - #### copyArea

          public void copyArea(int x,
                               int y,
                               int width,
                               int height,
                               int dx,
                               int dy)

      Specified by:
        `copyArea` in class `Graphics`

    - #### setXORMode

          public void setXORMode(Color c1)

      Specified by:
        `setXORMode` in class `Graphics`

    - #### buildBufferedImage

          protected BufferedImage buildBufferedImage(Dimension size)

      Creates a buffered image.
      Parameters:
        `size` - dimensions of the image to be created
      Returns:
        the buffered image

    - #### getFontMetrics

          public FontMetrics getFontMetrics(Font f)

      Specified by:
        `getFontMetrics` in class `Graphics`

Copyright © 2025 Apache Software Foundation. All rights reserved.