com.mxgraph.canvas

## Class mxImageCanvas

- java.lang.Object
- - com.mxgraph.canvas.mxImageCanvas

- All Implemented Interfaces:
    mxICanvas

      public class mxImageCanvas
      extends java.lang.Object
      implements mxICanvas

  An implementation of a canvas that uses Graphics2D for painting. To use an image canvas for an existing graphics canvas and create an image the following code is used: `BufferedImage image = mxCellRenderer.createBufferedImage(graph, cells, 1, Color.white, true, null, canvas);`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected mxGraphics2DCanvas` | `canvas`
    `protected java.awt.image.BufferedImage` | `image`
    `protected java.awt.Graphics2D` | `previousGraphics`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias)`
    `mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias, boolean textAntiAlias)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.image.BufferedImage` | `destroy()`
    `java.lang.Object` | `drawCell(mxCellState state)` Draws the given cell.
    `java.lang.Object` | `drawLabel(java.lang.String label, mxCellState state, boolean html)` Draws the given label.
    `mxGraphics2DCanvas` | `getGraphicsCanvas()`
    `java.awt.image.BufferedImage` | `getImage()`
    `double` | `getScale()` Returns the scale.
    `mxPoint` | `getTranslate()` Returns the current translation.
    `void` | `setScale(double scale)` Sets the scale for the following drawing requests.
    `void` | `setTranslate(double dx, double dy)` Sets the translation for the following drawing requests.

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

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

- - ### Field Detail

    - #### canvas

          protected mxGraphics2DCanvas canvas

    - #### previousGraphics

          protected java.awt.Graphics2D previousGraphics

    - #### image

          protected java.awt.image.BufferedImage image

  - ### Constructor Detail

    - #### mxImageCanvas

          public mxImageCanvas(mxGraphics2DCanvas canvas,
                       int width,
                       int height,
                       java.awt.Color background,
                       boolean antiAlias)

    - #### mxImageCanvas

          public mxImageCanvas(mxGraphics2DCanvas canvas,
                       int width,
                       int height,
                       java.awt.Color background,
                       boolean antiAlias,
                       boolean textAntiAlias)

  - ### Method Detail

    - #### getGraphicsCanvas

          public mxGraphics2DCanvas getGraphicsCanvas()

    - #### getImage

          public java.awt.image.BufferedImage getImage()

    - #### drawCell

          public java.lang.Object drawCell(mxCellState state)

      Description copied from interface: `mxICanvas`
      Draws the given cell.
      Specified by:
        `drawCell` in interface `mxICanvas`
      Parameters:
        `state` - State of the cell to be painted.
      Returns:
        Object that represents the cell.

    - #### drawLabel

          public java.lang.Object drawLabel(java.lang.String label,
                                   mxCellState state,
                                   boolean html)

      Description copied from interface: `mxICanvas`
      Draws the given label.
      Specified by:
        `drawLabel` in interface `mxICanvas`
      Parameters:
        `label` - String that represents the label.
        `state` - State of the cell whose label is to be painted.
        `html` - Specifies if the label contains HTML markup.
      Returns:
        Object that represents the label.

    - #### getScale

          public double getScale()

      Description copied from interface: `mxICanvas`
      Returns the scale.
      Specified by:
        `getScale` in interface `mxICanvas`

    - #### getTranslate

          public mxPoint getTranslate()

      Description copied from interface: `mxICanvas`
      Returns the current translation.
      Specified by:
        `getTranslate` in interface `mxICanvas`
      Returns:
        Returns the current translation.

    - #### setScale

          public void setScale(double scale)

      Description copied from interface: `mxICanvas`
      Sets the scale for the following drawing requests.
      Specified by:
        `setScale` in interface `mxICanvas`

    - #### setTranslate

          public void setTranslate(double dx,
                          double dy)

      Description copied from interface: `mxICanvas`
      Sets the translation for the following drawing requests.
      Specified by:
        `setTranslate` in interface `mxICanvas`

    - #### destroy

          public java.awt.image.BufferedImage destroy()

Copyright (c) 2010 Gaudenz Alder. All rights reserved.