# Class Canvas

java.lang.Object
com.codename1.charts.compat.Canvas

public class Canvas extends Object

An internal compatibility class for use by the Charts library. Since the library was ported from an Android library, it made use of Canvas and Paint, so rather than rewriting all of this, we added a Canvas and Paint compatibility layer.

DO NOT USE DIRECTLY

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `int`
  `absoluteX`
  `int`
  `absoluteY`
  `Rectangle`
  `bounds`
  `Graphics`
  `g`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Canvas()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `drawArc(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint)`
  `void`
  `drawArcWithGradient(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint, GradientDrawable gradient)`
  `void`
  `drawBitmap(Image img, float left, float top, Paint paint)`
  `void`
  `drawCircle(float cx, float cy, float r, Paint paint)`
  `void`
  `drawLine(float x1, float y1, float x2, float y2, Paint paint)`
  `void`
  `drawPath(Shape p, Paint paint)`
  `void`
  `drawPoint(Float get, Float get0, Paint paint)`
  `void`
  `drawRect(float left, float top, float right, float bottom, Paint paint)`
  `void`
  `drawRoundRect(Rectangle2D rect, float rx, float ry, Paint mPaint)`
  `void`
  `drawText(String string, float x, float y, Paint paint)`
  `void`
  `getClipBounds(Rectangle mRect)`
  `int`
  `getHeight()`
  `int`
  `getWidth()`
  `boolean`
  `isShapeClipSupported()`
  `void`
  `rotate(float angle, float x, float y)`
  `void`
  `scale(float x, float y)`
  `void`
  `translate(float x, float y)`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### g

    public Graphics g

  - ### bounds

    public Rectangle bounds

  - ### absoluteX

    public int absoluteX

  - ### absoluteY

    public int absoluteY

- ## Constructor Details

  - ### Canvas

    public Canvas()

- ## Method Details

  - ### getClipBounds

    public void getClipBounds(Rectangle mRect)

  - ### drawRect

    public void drawRect(float left, float top, float right, float bottom, Paint paint)

  - ### drawText

    public void drawText(String string, float x, float y, Paint paint)

  - ### getHeight

    public int getHeight()

  - ### getWidth

    public int getWidth()

  - ### drawPath

    public void drawPath(Shape p, Paint paint)

  - ### drawLine

    public void drawLine(float x1, float y1, float x2, float y2, Paint paint)

  - ### rotate

    public void rotate(float angle, float x, float y)

  - ### scale

    public void scale(float x, float y)

  - ### translate

    public void translate(float x, float y)

  - ### drawCircle

    public void drawCircle(float cx, float cy, float r, Paint paint)

  - ### drawArc

    public void drawArc(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint)

  - ### drawArcWithGradient

    public void drawArcWithGradient(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint, GradientDrawable gradient)

  - ### drawPoint

    public void drawPoint(Float get, Float get0, Paint paint)

  - ### drawRoundRect

    public void drawRoundRect(Rectangle2D rect, float rx, float ry, Paint mPaint)

  - ### drawBitmap

    public void drawBitmap(Image img, float left, float top, Paint paint)

  - ### isShapeClipSupported

    public boolean isShapeClipSupported()