Class Canvas
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawArc(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint) voiddrawArcWithGradient(Rectangle2D oval, float currentAngle, float sweepAngle, boolean useCenter, Paint paint, GradientDrawable gradient) voiddrawBitmap(Image img, float left, float top, Paint paint) voiddrawCircle(float cx, float cy, float r, Paint paint) voidvoidvoidvoidvoiddrawRoundRect(Rectangle2D rect, float rx, float ry, Paint mPaint) voidvoidgetClipBounds(Rectangle mRect) intvoidgetTransform(Transform out) Copies the transform in effect intoout, so that a temporary rotation, scale or translation can be undone by handing the same object to#setTransform(Transform).intgetWidth()booleanvoidrotate(float angle, float x, float y) voidscale(float x, float y) voidReplaces the transform in effect, typically with one captured by#getTransform(Transform).voidtranslate(float x, float y)
-
Field Details
-
g
-
bounds
-
absoluteX
public int absoluteX -
absoluteY
public int absoluteY
-
-
Constructor Details
-
Canvas
public Canvas()
-
-
Method Details
-
getClipBounds
-
drawRect
-
drawText
-
getHeight
public int getHeight() -
getWidth
public int getWidth() -
drawPath
-
drawLine
-
rotate
public void rotate(float angle, float x, float y) -
getTransform
Copies the transform in effect into
out, so that a temporary rotation, scale or translation can be undone by handing the same object to#setTransform(Transform).Undo a temporary transform this way and never by applying its inverse. The angle of a rotation is a
float, its sine and cosine are not exact, and rotating byaand then by-aleaves a matrix that is identity to fifteen digits and not to the sixteenth. Nothing shows on a platform that only multiplies by it, but the JavaScript port draws text as DOM nodes under an identity transform and on the canvas under any other, with different metrics: one rotated axis title moved every label painted after it, the form's own title included, by a few pixels.Parameters
out: receives the current transform
-
setTransform
Replaces the transform in effect, typically with one captured by
#getTransform(Transform).Parameters
t: the transform to install
-
scale
public void scale(float x, float y) -
translate
public void translate(float x, float y) -
drawCircle
-
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
-
drawRoundRect
-
drawBitmap
-
isShapeClipSupported
public boolean isShapeClipSupported()
-