Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 2.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.render.java2d
Class Java2DGraphicsState

    java.lang.Object
      org.apache.fop.render.java2d.Java2DGraphicsState

    public class Java2DGraphicsState

extends java.lang.Object

Keeps information about the current state of the Graphics2D currentGraphics. It is also used as a stack to hold a graphics context.

The graphics context is updated with the updateXXX() methods.

Constructor Summary
`Java2DGraphicsState(java.awt.Graphics2D graphics, FontInfo fontInfo, java.awt.geom.AffineTransform at)` State for storing graphics state.
`Java2DGraphicsState(Java2DGraphicsState org)` Copy constructor.

Method Summary
`void` | `dispose()` Frees resources allocated by the current Graphics2D instance.
`java.awt.Color` | `getColor()`
`java.awt.Font` | `getFont()`
`java.awt.Graphics2D` | `getGraph()`
`java.awt.BasicStroke` | `getStroke()`
`java.awt.geom.AffineTransform` | `getTransform()` Get the current transform.
`java.lang.String` | `toString()`
`void` | `transform(java.awt.geom.AffineTransform tf)` Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.
`boolean` | `updateClip(java.awt.Shape cl)` Set the current clip.
`boolean` | `updateColor(java.awt.Color col)` Set the current background color.
`boolean` | `updateFont(java.lang.String name, int size)` Set the current font name.
`boolean` | `updatePaint(java.awt.Paint p)` Set the current paint.
`boolean` | `updateStroke(float width, int style)` Sets the current Stroke.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Java2DGraphicsState

    public Java2DGraphicsState(java.awt.Graphics2D graphics,
                               FontInfo fontInfo,
                               java.awt.geom.AffineTransform at)

  State for storing graphics state.

  Parameters:
    `graphics` - the graphics associated with the BufferedImage
    `fontInfo` - the FontInfo from the renderer
    `at` - the initial AffineTransform containing the scale transformation

### Java2DGraphicsState

    public Java2DGraphicsState(Java2DGraphicsState org)

  Copy constructor.

  Parameters:
    `org` - the instance to copy

Method Detail

### getGraph

    public java.awt.Graphics2D getGraph()

  Returns:
    the currently valid state

### dispose

    public void dispose()

  Frees resources allocated by the current Graphics2D instance.

### updateColor

    public boolean updateColor(java.awt.Color col)

  Set the current background color. Check if the background color will change and then set the new color.

  Parameters:
    `col` - the new color as a java.awt.Color
  Returns:
    true if the background color has changed

### getColor

    public java.awt.Color getColor()

  Returns:
    the current java.awt.Color

### updateFont

    public boolean updateFont(java.lang.String name,
                              int size)

  Set the current font name. Check if the font name will change and then set the new name.

  Parameters:
    `name` - the new font name
    `size` - the font size
  Returns:
    true if the new Font changes the current Font

### getFont

    public java.awt.Font getFont()

  Returns:
    the current java.awt.Font

### updateStroke

    public boolean updateStroke(float width,
                                int style)

  Sets the current Stroke. The line width should be set with updateLineWidth() before calling this method

  Parameters:
    `width` - the line width
    `style` - the constant for the style of the line as an int
  Returns:
    true if the new Stroke changes the current Stroke

### getStroke

    public java.awt.BasicStroke getStroke()

  Returns:
    the currently active Stroke

### updatePaint

    public boolean updatePaint(java.awt.Paint p)

  Set the current paint. This checks if the paint will change and then sets the current paint.

  Parameters:
    `p` - the new paint
  Returns:
    true if the new paint changes the current paint

### updateClip

    public boolean updateClip(java.awt.Shape cl)

  Set the current clip. This either sets a new clip or sets the clip to the intersect of the old clip and the new clip.

  Parameters:
    `cl` - the new clip in the current state
  Returns:
    true if the clip shape needed to be updated

### transform

    public void transform(java.awt.geom.AffineTransform tf)

  Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.

  Parameters:
    `tf` - the transform to concatenate to the current level transform
  See Also:
    `Graphics2D.transform(AffineTransform)`

### getTransform

    public java.awt.geom.AffineTransform getTransform()

  Get the current transform. This gets the combination of all transforms in the current state.

  Returns:
    the calculate combined transform for the current state

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 2.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.