Class Canvas
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
NoDrawCanvas
A Canvas and a Paint together provide the state to draw into Surface or Device. Each Canvas draw call transforms the geometry of the object by the pre-multiplication of all transform matrices in the stack. The transformed geometry is clipped by the intersection of all clip values in the stack. The Canvas draw calls use Paint to supply drawing state such as color, text size, stroke width, filter and so on.
A surface canvas will quickly compute, optimize and generate the data required by the underlying 3D graphics API on the application side (client rendering pipeline). The render tasks will be transmitted to GPU on render thread (deferred rendering), determined by the drawing device.
A recording canvas records draw calls to a surface canvas. Although deferred rendering has been done in surface canvas, sometimes we don't need to update animations or transformations on the client side, so we can save draw calls, and don't need to update the buffer in GPU. This is not recommended for frequently updated scenes.
The Canvas supports multiple color buffers in one off-screen rendering target, which can be used for many complex color blending and temporary operations. Note that depth buffer and depth test is not enabled, Z ordering or transparency sorting is required on the client pipeline before drawing onto the Canvas. All layers are considered translucent and drawn from far to near.
You may never access the pixels of the canvas directly on the current thread, because canvas is backed by GPU and uses deferred rendering. You must wait for GPU to finish all rendering tasks and then use thread scheduling before you can download the surface data to CPU side memory.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
ThePointMode
selects if an array of points is drawn as discrete points, as lines, or as an open polygon.static @interface
SaveLayerFlags provides options that may be used in any combination in SaveLayerRec, defining how layer allocated by saveLayer() operates.static @interface
TheSrcRectConstraint
controls the behavior at the edge of source rect, provided to drawImageRect() when there is any filtering. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Instead of matching previous layer's color type, use F16.protected static final int
static final int
Initializes with previous contents.protected static final int
static final int
Draw each pair of points as a line segment.static final int
Draw each point separately.static final int
Draw the array of points as an open polygon.static final int
Sample outside bounds; fasterstatic final int
Sample only inside bounds; slower. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
clear
(float r, float g, float b, float a) Fills the current clip with the specified color, using SRC blend mode.final void
clear
(int color) Fills the current clip with the specified color, using SRC blend mode.final void
clipRect
(float left, float top, float right, float bottom) Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates.final void
clipRect
(float left, float top, float right, float bottom, boolean doAA) Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates, with an aliased or anti-aliased clip edge.final void
clipRect
(float left, float top, float right, float bottom, int clipOp) Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge.final void
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates.final void
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates, with an aliased or anti-aliased clip edge.final void
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge.final void
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge.final void
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates.final void
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge.void
close()
Draws saved layers, if any.final void
Pre-multiply the current matrix by the specified matrix.final void
Pre-multiply the current matrix by the specified matrix.protected void
protected void
protected void
didScale
(float sx, float sy, float sz) protected void
didSetMatrix
(Matrix4c matrix) protected void
didTranslate
(float dx, float dy, float dz) final void
discard()
Makes Canvas contents undefined.final void
drawArc
(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) Draw a circular arc at (cx, cy) with radius using the current matrix, clip and specified paint.final void
Draw a circular arc at (cx, cy) with radius using the current matrix, clip and specified paint.final void
Draw a circular segment (i.e., a cut disk) at (cx, cy) with radius using the current matrix, clip and specified paint.final void
drawCircle
(float cx, float cy, float radius, Paint paint) Draw the specified circle at (cx, cy) with radius using the specified paint.final void
drawColor
(float r, float g, float b, float a) Fill the current clip with the specified color, using SRC_OVER blend mode.final void
Fill the current clip with the specified color, the blend mode determines how color is combined with destination.final void
drawColor
(int color) Fill the current clip with the specified color, using SRC_OVER blend mode.final void
Fill the current clip with the specified color, the blend mode determines how color is combined with destination.final void
drawGlyphs
(int[] glyphs, int glyphOffset, float[] positions, int positionOffset, int glyphCount, float originX, float originY, Font font, Paint paint) Draws count glyphs, at positions relative to origin styled with font and paint.final void
drawImage
(@RawPtr Image image, float x, float y, SamplingOptions sampling, Paint paint) Draw the specified image with its top/left corner at (x,y), using the specified paint, transformed by the current matrix.final void
drawImageRect
(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) Draw the specified image, scaling/translating automatically to fill the destination rectangle.final void
drawImageRect
(@RawPtr Image image, Rect2fc dst, SamplingOptions sampling, Paint paint) Draw the specified image, scaling/translating automatically to fill the destination rectangle.final void
Draw a line segment from (x0, y0) to (x1, y1) using the current matrix, clip and specified paint.final void
Draws line segment from (x0, y0) to (x1, y1) using the current matrix, clip and specified paint.final void
Fills the current clip with the specified paint.final void
Draw a circular sector (i.e., a pie) at (cx, cy) with radius using the current matrix, clip and specified paint.final void
Draws point at (x, y) using the current matrix, clip and specified paint.final void
Draws point at (x, y) using the current matrix, clip and specified paint.final void
drawPoints
(int mode, float[] pts, int offset, int count, Paint paint) Draws pts using the current matrix, clip and specified paint.void
Draw the specified Rect using the specified paint.final void
Draw the specified Rect using the specified paint.final void
Draw the specified Rect using the specified paint.void
drawRoundRect
(float left, float top, float right, float bottom, float rUL, float rUR, float rLR, float rLL, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds.final void
drawRoundRect
(float left, float top, float right, float bottom, float radius, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds.final void
drawRoundRect
(Rect2fc rect, float radius, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds.final void
drawRoundRect
(Rect2f rect, float rUL, float rUR, float rLR, float rLL, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds.void
drawRoundRect
(RoundRect roundRect, Paint paint) final void
drawTextBlob
(TextBlob blob, float originX, float originY, Paint paint) Draws TextBlob blob at (x, y), using the current matrix, clip and specified paint.void
drawTriangle
(float x0, float y0, float x1, float y1, float x2, float y2, Paint paint) Draw a triangle using the specified paint.final void
drawVertices
(Vertices vertices, @SharedPtr Blender blender, Paint paint) Draws the vertices, a triangle mesh, using current clip and matrix.int
Gets the size of the base or root layer in global canvas coordinates.int
Gets the size of the base or root layer in global canvas coordinates.final boolean
getDeviceClipBounds
(Rect2i bounds) Returns the bounds of clip, unaffected by the transform matrix.final ImageInfo
Returns ImageInfo for Canvas.final boolean
getLocalClipBounds
(Rect2f bounds) Returns the bounds of clip, transformed by inverse of the transform matrix.final void
getLocalToDevice
(Matrix storage) Returns the current transform from local coordinates to the 'device', which for most purposes means pixels.final void
getLocalToDevice
(Matrix4 storage) Returns the current transform from local coordinates to the 'device', which for most purposes means pixels.Returns GPU context of the GPU surface associated with Canvas.final int
Returns the depth of saved matrix/clip states on the Canvas' private stack.protected int
getSaveLayerStrategy
(Rect2f bounds, Paint paint, ImageFilter backdrop, int saveLayerFlags) Sometimes a canvas is owned by a surface.boolean
Returns true if clip is empty; that is, nothing will draw.boolean
Returns true if clip is a Rect and not empty.final @SharedPtr Surface
makeSurface
(ImageInfo info) Creates Surface matching info, and associates it with Canvas.protected void
onClipRect
(Rect2fc rect, int clipOp, boolean doAA) protected void
protected void
onDrawArc
(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) protected void
onDrawChord
(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) protected void
onDrawCircle
(float cx, float cy, float radius, Paint paint) protected void
onDrawGlyphRunList
(GlyphRunList glyphRunList, Paint paint) protected void
onDrawImageRect
(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) protected void
onDrawLine
(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) protected void
onDrawPaint
(Paint paint) protected void
protected void
onDrawPoints
(int mode, float[] pts, int offset, int count, Paint paint) protected void
onDrawRect
(Rect2fc r, Paint paint) protected void
onDrawRoundRect
(RoundRect rr, Paint paint) protected void
onDrawTextBlob
(TextBlob blob, float originX, float originY, Paint paint) protected void
onDrawVertices
(Vertices vertices, @SharedPtr Blender blender, Paint paint) protected ImageInfo
protected @SharedPtr Surface
onNewSurface
(ImageInfo info) final boolean
quickReject
(float left, float top, float right, float bottom) Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside the current clip.final boolean
quickReject
(Rect2fc rect) Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside the current clip.final void
Sets the current matrix to the identity matrix.final void
restore()
This call balances a previous call to save(), and is used to remove all modifications to the matrix/clip state since the last save call.final void
restoreToCount
(int saveCount) Efficient way to pop any calls to save() that happened after the save count reached saveCount.final void
rotate
(float degrees) Rotates the current matrix by degrees clockwise about the Z axis.final void
rotate
(float degrees, float px, float py) Rotates the current matrix by degrees clockwise about the Z axis at (px, py).final int
save()
Saves the current matrix and clip onto a private stack.final int
Convenience forsaveLayer(Rect2f, Paint)
that takes the four float coordinates of the bounds' rectangle.final int
saveLayer
(float left, float top, float right, float bottom, Paint paint, ImageFilter backdrop, int saveLayerFlags) Convenience forsaveLayer(Rect2f, Paint, ImageFilter, int)
that takes the four float coordinates of the bounds' rectangle.final int
This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).final int
saveLayer
(Rect2f bounds, Paint paint, ImageFilter backdrop, int saveLayerFlags) This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).final int
saveLayerAlpha
(float left, float top, float right, float bottom, int alpha) Convenience forsaveLayerAlpha(Rect2f, int)
that takes the four float coordinates of the bounds' rectangle.final int
saveLayerAlpha
(Rect2f bounds, int alpha) This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).final void
scale
(float sx, float sy) Scales the current matrix by sx on the x-axis and sy on the y-axis.final void
scale
(float sx, float sy, float sz) Scales the current matrix by sx on the x-axis, sy on the y-axis, and sz on the z-axis.final void
scale
(float sx, float sy, float px, float py) Scales the current matrix by sx on the x-axis and sy on the y-axis at (px, py).final void
Replaces the current matrix with the specified matrix.final void
shear
(float sx, float sy) Shears the current matrix by sx on the x-axis and sy on the y-axis.final void
shear
(float sx, float sy, float px, float py) Pre-multiply the current matrix by the specified shearing.final void
translate
(float dx, float dy) Translates the current matrix by dx along the x-axis and dy along the y-axis.final void
translate
(float dx, float dy, float dz) Translates the current matrix by dx along the x-axis, dy along the y-axis, and dz along the z-axis.protected void
protected void
willSave()
-
Field Details
-
INIT_WITH_PREVIOUS_SAVE_LAYER_FLAG
public static final int INIT_WITH_PREVIOUS_SAVE_LAYER_FLAGInitializes with previous contents.- See Also:
-
F16_COLOR_TYPE_SAVE_LAYER_FLAG
public static final int F16_COLOR_TYPE_SAVE_LAYER_FLAGInstead of matching previous layer's color type, use F16.- See Also:
-
FULL_LAYER_SAVE_LAYER_STRATEGY
protected static final int FULL_LAYER_SAVE_LAYER_STRATEGY- See Also:
-
NO_LAYER_SAVE_LAYER_STRATEGY
protected static final int NO_LAYER_SAVE_LAYER_STRATEGY- See Also:
-
POINT_MODE_POINTS
public static final int POINT_MODE_POINTSDraw each point separately.- See Also:
-
POINT_MODE_LINES
public static final int POINT_MODE_LINESDraw each pair of points as a line segment.- See Also:
-
POINT_MODE_POLYGON
public static final int POINT_MODE_POLYGONDraw the array of points as an open polygon.- See Also:
-
SRC_RECT_CONSTRAINT_FAST
public static final int SRC_RECT_CONSTRAINT_FASTSample outside bounds; faster- See Also:
-
SRC_RECT_CONSTRAINT_STRICT
public static final int SRC_RECT_CONSTRAINT_STRICTSample only inside bounds; slower.- See Also:
-
-
Constructor Details
-
Canvas
public Canvas()Creates an empty Canvas with no backing device or pixels, with a width and height of zero. -
Canvas
public Canvas(int width, int height) Creates Canvas of the specified dimensions without a Surface. Used by subclasses with custom implementations for draw member functions.- Parameters:
width
- zero or greaterheight
- zero or greater
-
Canvas
-
Canvas
-
-
Method Details
-
getImageInfo
Returns ImageInfo for Canvas. If Canvas is not associated with raster surface or GPU surface, returned ColorType is set toColorInfo.CT_UNKNOWN
.- Returns:
- dimensions and ColorType of Canvas
-
getBaseLayerWidth
public int getBaseLayerWidth()Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).- Returns:
- integral width of base layer
-
getBaseLayerHeight
public int getBaseLayerHeight()Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).- Returns:
- integral height of base layer
-
makeSurface
Creates Surface matching info, and associates it with Canvas. Returns null if no match found.- Parameters:
info
- width, height, ColorType and AlphaType- Returns:
- Surface matching info, or null if no match is available
-
getRecordingContext
Returns GPU context of the GPU surface associated with Canvas.- Returns:
- GPU context, if available; null otherwise
-
getSurface
Sometimes a canvas is owned by a surface. If it is, getSurface() will return a bare pointer to that surface, else this will return null. -
save
public final int save()Saves the current matrix and clip onto a private stack.Subsequent calls to translate, scale, rotate, shear, concat or clipRect, clipPath will all operate as usual, but when the balancing call to restore() is made, those calls will be forgotten, and the settings that existed before the save() will be reinstated.
Saved Canvas state is put on a stack; multiple calls to save() should be balance by an equal number of calls to restore(). Call restoreToCount() with the return value of this method to restore this and subsequent saves.
- Returns:
- depth of saved stack to pass to restoreToCount() to balance this call
-
saveLayer
This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).Note: this method is very expensive, incurring more than double rendering cost for contained content. Avoid using this method when possible.
All drawing calls are directed to a newly allocated offscreen rendering target. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (which can potentially be a previous layer if these calls are nested).
Optional paint applies alpha, ColorFilter, ImageFilter, and BlendMode when restore() is called.
Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
bounds
- the maximum size the offscreen render target needs to be (in local coordinates), may be nullpaint
- the paint is applied to the offscreen when restore() is called, may be null- Returns:
- depth of saved stack to pass to restoreToCount() to balance this call
-
saveLayer
Convenience forsaveLayer(Rect2f, Paint)
that takes the four float coordinates of the bounds' rectangle.- See Also:
-
saveLayerAlpha
This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).Note: this method is very expensive, incurring more than double rendering cost for contained content. Avoid using this method when possible.
All drawing calls are directed to a newly allocated offscreen rendering target. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (which can potentially be a previous layer if these calls are nested).
Alpha of zero is fully transparent, 255 is fully opaque.
Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
bounds
- the maximum size the offscreen render target needs to be (in local coordinates), may be nullalpha
- the alpha to apply to the offscreen when restore() is called- Returns:
- depth of saved stack to pass to restoreToCount() to balance this call
-
saveLayerAlpha
public final int saveLayerAlpha(float left, float top, float right, float bottom, int alpha) Convenience forsaveLayerAlpha(Rect2f, int)
that takes the four float coordinates of the bounds' rectangle.- See Also:
-
saveLayer
public final int saveLayer(@Nullable Rect2f bounds, @Nullable Paint paint, @Nullable ImageFilter backdrop, int saveLayerFlags) This behaves the same assave()
, but in addition it allocates and redirects drawing to an offscreen rendering target (a drawing layer).Note: this method is very expensive, incurring more than double rendering cost for contained content. Avoid using this method when possible.
All drawing calls are directed to a newly allocated offscreen rendering target. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (which can potentially be a previous layer if these calls are nested).
Optional paint applies alpha, ColorFilter, ImageFilter, and BlendMode when restore() is called.
If backdrop is not null, it triggers the same initialization behavior as setting
INIT_WITH_PREVIOUS_SAVE_LAYER_FLAG
on saveLayerFlags: the current layer is copied into the new layer, rather than initializing the new layer with transparent-black. This is then filtered by backdrop (respecting the current clip).Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
bounds
- the maximum size the offscreen render target needs to be (in local coordinates), may be nullpaint
- the paint is applied to the offscreen when restore() is called, may be nullbackdrop
- if not null, this causes the current layer to be filtered by backdrop, and then drawn into the new layer (respecting the current clip)saveLayerFlags
- options to modify layer, may be zero- Returns:
- depth of saved stack to pass to restoreToCount() to balance this call
-
saveLayer
public final int saveLayer(float left, float top, float right, float bottom, @Nullable Paint paint, @Nullable ImageFilter backdrop, int saveLayerFlags) Convenience forsaveLayer(Rect2f, Paint, ImageFilter, int)
that takes the four float coordinates of the bounds' rectangle.- See Also:
-
restore
public final void restore()This call balances a previous call to save(), and is used to remove all modifications to the matrix/clip state since the last save call. The state is removed from the stack. It is an error to call restore() more or less times than save() was called in the final state.- Throws:
IllegalStateException
- stack underflow
-
getSaveCount
public final int getSaveCount()Returns the depth of saved matrix/clip states on the Canvas' private stack. This will equal save() calls minus restore() calls, and the number of save() calls less the number of restore() calls plus one. The save count of a new canvas is one.- Returns:
- depth of save state stack
-
restoreToCount
public final void restoreToCount(int saveCount) Efficient way to pop any calls to save() that happened after the save count reached saveCount. It is an error for saveCount to be less than 1.Example:
int count = canvas.save(); ... // more calls potentially to save() canvas.restoreToCount(count); // now the canvas is back in the same state it // was before the initial call to save().
- Parameters:
saveCount
- the depth of state stack to restore- Throws:
IllegalStateException
- stack underflow (i.e. saveCount is less than 1)
-
translate
public final void translate(float dx, float dy) Translates the current matrix by dx along the x-axis and dy along the y-axis. Mathematically, pre-multiply the current matrix with a translation matrix.This has the effect of moving the drawing by (dx, dy) before transforming the result with the current matrix.
- Parameters:
dx
- the distance to translate on x-axisdy
- the distance to translate on y-axis
-
translate
public final void translate(float dx, float dy, float dz) Translates the current matrix by dx along the x-axis, dy along the y-axis, and dz along the z-axis. Mathematically, pre-multiply the current matrix with a translation matrix.This has the effect of moving the drawing by (dx, dy, dz) before transforming the result with the current matrix.
- Parameters:
dx
- the distance to translate on x-axisdy
- the distance to translate on y-axisdz
- the distance to translate on z-axis
-
scale
public final void scale(float sx, float sy) Scales the current matrix by sx on the x-axis and sy on the y-axis. Mathematically, pre-multiply the current matrix with a scaling matrix.This has the effect of scaling the drawing by (sx, sy) before transforming the result with the current matrix.
- Parameters:
sx
- the amount to scale on x-axissy
- the amount to scale on y-axis
-
scale
public final void scale(float sx, float sy, float sz) Scales the current matrix by sx on the x-axis, sy on the y-axis, and sz on the z-axis. Mathematically, pre-multiply the current matrix with a scaling matrix.This has the effect of scaling the drawing by (sx, sy, sz) before transforming the result with the current matrix.
- Parameters:
sx
- the amount to scale on x-axissy
- the amount to scale on y-axissz
- the amount to scale on z-axis
-
scale
public final void scale(float sx, float sy, float px, float py) Scales the current matrix by sx on the x-axis and sy on the y-axis at (px, py). Mathematically, pre-multiply the current matrix with a translation matrix; pre-multiply the current matrix with a scaling matrix; then pre-multiply the current matrix with a negative translation matrix;This has the effect of scaling the drawing by (sx, sy) before transforming the result with the current matrix.
- Parameters:
sx
- the amount to scale on x-axissy
- the amount to scale on y-axispx
- the x-coord for the pivot point (unchanged by the scale)py
- the y-coord for the pivot point (unchanged by the scale)
-
rotate
public final void rotate(float degrees) Rotates the current matrix by degrees clockwise about the Z axis. Mathematically, pre-multiply the current matrix with a rotation matrix;This has the effect of rotating the drawing by degrees before transforming the result with the current matrix.
- Parameters:
degrees
- the amount to rotate, in degrees
-
rotate
public final void rotate(float degrees, float px, float py) Rotates the current matrix by degrees clockwise about the Z axis at (px, py). Mathematically, pre-multiply the current matrix with a translation matrix; pre-multiply the current matrix with a rotation matrix; then pre-multiply the current matrix with a negative translation matrix;This has the effect of rotating the drawing by degrees before transforming the result with the current matrix.
- Parameters:
degrees
- the amount to rotate, in degreespx
- the x-coord for the pivot point (unchanged by the rotation)py
- the y-coord for the pivot point (unchanged by the rotation)
-
shear
public final void shear(float sx, float sy) Shears the current matrix by sx on the x-axis and sy on the y-axis. A positive value of sx shears the drawing right as y-axis values increase; a positive value of sy shears the drawing down as x-axis values increase.Mathematically, pre-multiply the current matrix with a shearing matrix.
This has the effect of shearing the drawing by (sx, sy) before transforming the result with the current matrix.
- Parameters:
sx
- the amount to shear on x-axissy
- the amount to shear on y-axis
-
shear
public final void shear(float sx, float sy, float px, float py) Pre-multiply the current matrix by the specified shearing.- Parameters:
sx
- the x-component of the shearing, y is unchangedsy
- the y-component of the shearing, x is unchangedpx
- the x-component of the pivot (unchanged by the shear)py
- the y-component of the pivot (unchanged by the shear)
-
concat
Pre-multiply the current matrix by the specified matrix.This has the effect of transforming the drawn geometry by matrix, before transforming the result with the current matrix.
- Parameters:
matrix
- the matrix to premultiply with the current matrix
-
concat
Pre-multiply the current matrix by the specified matrix.This has the effect of transforming the drawn geometry by matrix, before transforming the result with the current matrix.
- Parameters:
matrix
- the matrix to premultiply with the current matrix
-
setMatrix
Replaces the current matrix with the specified matrix. Unlike concat(), any prior matrix state is overwritten.- Parameters:
matrix
- matrix to copy, replacing the current matrix
-
resetMatrix
public final void resetMatrix()Sets the current matrix to the identity matrix. Any prior matrix state is overwritten. -
clipRect
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates. Resulting clip is aliased. The clip bounds cannot be expanded unless restore() is called.- Parameters:
rect
- the rectangle to intersect with the current clip
-
clipRect
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates. Resulting clip is aliased. The clip bounds cannot be expanded unless restore() is called.- Parameters:
rect
- the rectangle to intersect with the current clip
-
clipRect
public final void clipRect(float left, float top, float right, float bottom) Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates. Resulting clip is aliased. The clip bounds cannot be expanded unless restore() is called.- Parameters:
left
- the left side of the rectangle to intersect with the current cliptop
- the top of the rectangle to intersect with the current clipright
- the right side of the rectangle to intersect with the current clipbottom
- the bottom of the rectangle to intersect with the current clip
-
clipRect
Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates, with an aliased or anti-aliased clip edge. The clip bounds cannot be expanded unless restore() is called.- Parameters:
rect
- the rectangle to intersect with the current clipdoAA
- true if clip is to be anti-aliased
-
clipRect
public final void clipRect(float left, float top, float right, float bottom, boolean doAA) Intersect the current clip with the specified rectangle and updates the stencil buffer if changed, which is expressed in local coordinates, with an aliased or anti-aliased clip edge. The clip bounds cannot be expanded unless restore() is called.- Parameters:
left
- the left side of the rectangle to intersect with the current cliptop
- the top of the rectangle to intersect with the current clipright
- the right side of the rectangle to intersect with the current clipbottom
- the bottom of the rectangle to intersect with the current clipdoAA
- true if clip is to be anti-aliased
-
clipRect
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge. The rectangle is transformed by the current matrix before it is combined with clip.- Parameters:
rect
- rectangle to combine with clipclipOp
- ClipOp to apply to clip
-
clipRect
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge. The rectangle is transformed by the current matrix before it is combined with clip.- Parameters:
rect
- rectangle to combine with clipclipOp
- ClipOp to apply to clip
-
clipRect
public final void clipRect(float left, float top, float right, float bottom, int clipOp) Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge. The rectangle is transformed by the current matrix before it is combined with clip.- Parameters:
clipOp
- ClipOp to apply to clip
-
clipRect
Replaces the current clip with the intersection or difference of the current clip and the given rect, with an aliased or anti-aliased clip edge. The rectangle is transformed by the current matrix before it is combined with clip.- Parameters:
rect
- rectangle to combine with clipclipOp
- ClipOp to apply to clipdoAA
- true if clip mask is requested to be anti-aliased
-
quickReject
Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside the current clip. Call this to check if an area you intend to draw into is clipped out (and therefore you can skip making the draw calls). May return false even though rect is outside of clip (conservative).Note that each draw all will check this internally. This is used to skip subsequent draw calls.
- Parameters:
rect
- the rect to compare with the current clip- Returns:
- true if the given rect (transformed by the canvas' matrix) intersecting with the maximum rect representing the canvas' clip is empty
-
quickReject
public final boolean quickReject(float left, float top, float right, float bottom) Return true if the specified rectangle, after being transformed by the current matrix, would lie completely outside the current clip. Call this to check if an area you intend to draw into is clipped out (and therefore you can skip making the draw calls). May return false even though rect is outside of clip (conservative).Note that each draw all will check this internally. This is used to skip subsequent draw calls.
- Parameters:
left
- the left side of the rectangle to compare with the current cliptop
- the top of the rectangle to compare with the current clipright
- the right side of the rectangle to compare with the current clipbottom
- the bottom of the rectangle to compare with the current clip- Returns:
- true if the given rect (transformed by the canvas' matrix) intersecting with the maximum rect representing the canvas' clip is empty
-
getLocalClipBounds
Returns the bounds of clip, transformed by inverse of the transform matrix. If clip is empty, return false, and set bounds to empty, where all rect sides equal zero.The
bounds
is outset by one to account for partial pixel coverage if clip is anti-aliased.- Parameters:
bounds
- the bounds of clip in local coordinates- Returns:
- true if clip bounds is not empty
-
getDeviceClipBounds
Returns the bounds of clip, unaffected by the transform matrix. If clip is empty, return false, and set bounds to empty, where all rect sides equal zero.Unlike getLocalClipBounds(), bounds is not outset.
- Parameters:
bounds
- the bounds of clip in device coordinates- Returns:
- true if clip bounds is not empty
-
clear
Fills the current clip with the specified color, using SRC blend mode. This has the effect of replacing all pixels contained by clip with color.- Parameters:
color
- the un-premultiplied (straight) color to draw onto the canvas
-
clear
public final void clear(float r, float g, float b, float a) Fills the current clip with the specified color, using SRC blend mode. This has the effect of replacing all pixels contained by clip with color.- Parameters:
r
- the red component of the straight color to draw onto the canvasg
- the red component of the straight color to draw onto the canvasb
- the red component of the straight color to draw onto the canvasa
- the red component of the straight color to draw onto the canvas
-
discard
public final void discard()Makes Canvas contents undefined. Subsequent calls that read Canvas pixels, such as drawing with BlendMode, return undefined results. discard() does not change clip or Matrix.discard() may do nothing, depending on the implementation of Surface or Device that created Canvas.
discard() allows optimized performance on subsequent draws by removing cached data associated with Surface or Device. It is not necessary to call discard() once done with Canvas; any cached data is deleted when owning Surface or Device is deleted.
-
drawColor
Fill the current clip with the specified color, using SRC_OVER blend mode.- Parameters:
color
- the straight color to draw onto the canvas
-
drawColor
public final void drawColor(float r, float g, float b, float a) Fill the current clip with the specified color, using SRC_OVER blend mode.- Parameters:
r
- the red component of the straight color to draw onto the canvasg
- the red component of the straight color to draw onto the canvasb
- the red component of the straight color to draw onto the canvasa
- the red component of the straight color to draw onto the canvas
-
drawColor
Fill the current clip with the specified color, the blend mode determines how color is combined with destination.- Parameters:
color
- the straight color to draw onto the canvasmode
- the blend mode used to combine source color and destination
-
drawColor
Fill the current clip with the specified color, the blend mode determines how color is combined with destination.- Parameters:
r
- the red component of the straight color to draw onto the canvasg
- the red component of the straight color to draw onto the canvasb
- the red component of the straight color to draw onto the canvasa
- the red component of the straight color to draw onto the canvasmode
- the blend mode used to combine source color and destination
-
drawPaint
Fills the current clip with the specified paint. Paint components, Shader, ColorFilter, ImageFilter, and BlendMode affect drawing.This is equivalent (but faster) to drawing an infinitely large rectangle with the specified paint.
- Parameters:
paint
- the paint used to draw onto the canvas
-
drawPoints
Draws pts using the current matrix, clip and specified paint. count is the number of points; if count is less than one, has no effect. mode may be one of:POINT_MODE_POINTS
,POINT_MODE_LINES
, orPOINT_MODE_POLYGON
.If mode is
POINT_MODE_POINTS
, the shape of point drawn depends on paint Cap. If paint is set toPaint.CAP_ROUND
, each point draws a circle of diameter paint stroke width. If paint is set toPaint.CAP_SQUARE
orPaint.CAP_BUTT
, each point draws a square of width and height paint stroke width.If mode is
POINT_MODE_LINES
, each pair of points draws a line segment. One line is drawn for every two points; each point is used once. If count is odd, the last point is ignored.If mode is
POINT_MODE_POLYGON
, each adjacent pair of points draws a line segment. count minus one lines are drawn; the first and last point are used once.Each line segment respects paint Cap and paint stroke width. Paint style is ignored, as if were set to
Paint.STROKE
.Always draws each element one at a time; is not affected by paint join, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
mode
- whether pts draws points or linespts
- array of points to drawoffset
- offset in pts array, i.e., number of floats to skipcount
- number of points in pts arraypaint
- stroke, blend, color, and so on, used to draw
-
drawPoint
Draws point at (x, y) using the current matrix, clip and specified paint.The shape of point drawn depends on paint cap. If paint is set to
Paint.CAP_ROUND
, draw a circle of diameter paint stroke width. If paint is set toPaint.CAP_SQUARE
orPaint.CAP_BUTT
, draw a square of width and height paint stroke width. Paint style is ignored, as if were set toPaint.STROKE
.- Parameters:
x
- center X of circle or squarey
- center Y of circle or squarepaint
- stroke, blend, color, and so on, used to draw
-
drawPoint
Draws point at (x, y) using the current matrix, clip and specified paint.The shape of point drawn depends on cap. If cap is
Paint.CAP_ROUND
, draw a circle of diameter size. If cap isPaint.CAP_SQUARE
orPaint.CAP_BUTT
, draw a square of width and height size. In paint: Style determines if point is stroked or filled; If stroked (i.e. double stroke), stroke width describes the shape outline thickness, Cap describes line ends, Join draws the corners rounded or square, and Align determines the position or direction to stroke.- Parameters:
x
- center X of circle or squarey
- center Y of circle or squarecap
- the line end used to determine the shape of pointsize
- the diameter of circle or width and height of squarepaint
- stroke, blend, color, and so on, used to draw
-
drawLine
Draws line segment from (x0, y0) to (x1, y1) using the current matrix, clip and specified paint. In paint: stroke width describes the line thickness; Cap draws the end rounded or square; Style is ignored, as if were set toPaint.STROKE
.- Parameters:
x0
- start of line segment on x-axisy0
- start of line segment on y-axisx1
- end of line segment on x-axisy1
- end of line segment on y-axispaint
- the paint used to draw the line
-
drawLine
public final void drawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) Draw a line segment from (x0, y0) to (x1, y1) using the current matrix, clip and specified paint. Note that line shape is a stroked line rather than a line path, you can fill or stroke the stroked line.The cap describes the end of the line shape, the width describes the line shape thickness. In paint: Style determines if line shape is stroked or filled; If stroked (i.e. double stroke), stroke width describes the shape outline thickness, Cap describes line ends, Join draws the corners rounded or square, and Align determines the position or direction to stroke.
- Parameters:
x0
- the start of line segment on x-axisy0
- the start of line segment on y-axisx1
- the end of line segment on x-axisy1
- the end of line segment on y-axiscap
- the line end used to determine the shape of the linewidth
- the thickness of line segmentpaint
- the paint used to draw the line
-
drawRect
Draw the specified Rect using the specified paint. In paint: Paint's style determines if rectangle is stroked or filled; if stroked, Paint's stroke width describes the line thickness, and Paint's join draws the corners rounded or square.- Parameters:
r
- the rectangle to be drawn.paint
- the paint used to draw the rectangle
-
drawRect
Draw the specified Rect using the specified paint. In paint: Paint's style determines if rectangle is stroked or filled; if stroked, Paint's stroke width describes the line thickness, and Paint's join draws the corners rounded or square.- Parameters:
r
- the rectangle to be drawn.paint
- the paint used to draw the rectangle
-
drawRect
Draw the specified Rect using the specified paint. In paint: Paint's style determines if rectangle is stroked or filled; if stroked, Paint's stroke width describes the line thickness, and Paint's join draws the corners rounded or square.- Parameters:
left
- the left side of the rectangle to be drawntop
- the top side of the rectangle to be drawnright
- the right side of the rectangle to be drawnbottom
- the bottom side of the rectangle to be drawnpaint
- the paint used to draw the rect
-
drawRoundRect
Draw a rectangle with rounded corners within a rectangular bounds. The round rectangle will be filled or framed based on the Style in the paint.- Parameters:
rect
- The rectangular bounds of the round rect to be drawnradius
- the radius used to round the cornerspaint
- the paint used to draw the round rectangle
-
drawRoundRect
public final void drawRoundRect(float left, float top, float right, float bottom, float radius, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds. The round rectangle will be filled or framed based on the Style in the paint.- Parameters:
left
- the left of the rectangular boundstop
- the top of the rectangular boundsright
- the right of the rectangular boundsbottom
- the bottom of the rectangular boundsradius
- the radius used to round the cornerspaint
- the paint used to draw the round rectangle
-
drawRoundRect
public final void drawRoundRect(Rect2f rect, float rUL, float rUR, float rLR, float rLL, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds. The round rectangle will be filled or framed based on the Style in the paint.- Parameters:
rect
- The rectangular bounds of the round rect to be drawnrUL
- the radius used to round the upper left cornerrUR
- the radius used to round the upper right cornerrLR
- the radius used to round the lower right cornerrLL
- the radius used to round the lower left cornerpaint
- the paint used to draw the round rectangle
-
drawRoundRect
public void drawRoundRect(float left, float top, float right, float bottom, float rUL, float rUR, float rLR, float rLL, Paint paint) Draw a rectangle with rounded corners within a rectangular bounds. The round rectangle will be filled or framed based on the Style in the paint.- Parameters:
left
- the left of the rectangular boundstop
- the top of the rectangular boundsright
- the right of the rectangular boundsbottom
- the bottom of the rectangular boundsrUL
- the radius used to round the upper left cornerrUR
- the radius used to round the upper right cornerrLR
- the radius used to round the lower right cornerrLL
- the radius used to round the lower left cornerpaint
- the paint used to draw the round rectangle
-
drawRoundRect
-
drawCircle
Draw the specified circle at (cx, cy) with radius using the specified paint. If radius is zero or less, nothing is drawn. In paint: Paint's style determines if circle is stroked or filled; if stroked, paint's stroke width describes the line thickness.- Parameters:
cx
- the x-coordinate of the center of the circle to be drawncy
- the y-coordinate of the center of the circle to be drawnradius
- the radius of the circle to be drawnpaint
- the paint used to draw the circle
-
drawArc
public final void drawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) Draw a circular arc at (cx, cy) with radius using the current matrix, clip and specified paint.If the start angle is negative or >= 360, the start angle is treated as start angle modulo 360. If the sweep angle is >= 360, then the circle is drawn completely. If the sweep angle is negative, the sweep angle is treated as sweep angle modulo 360.
The arc is drawn clockwise. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch). If radius is non-positive or sweep angle is zero, nothing is drawn.
- Parameters:
cx
- the x-coordinate of the center of the arc to be drawncy
- the y-coordinate of the center of the arc to be drawnradius
- the radius of the circular arc to be drawnstartAngle
- starting angle (in degrees) where the arc beginssweepAngle
- sweep angle or angular extent (in degrees); positive is clockwisepaint
- the paint used to draw the arc
-
drawArc
public final void drawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) Draw a circular arc at (cx, cy) with radius using the current matrix, clip and specified paint. Note that arc shape is a stroked arc rather than an arc path, you can fill or stroke the stroked arc.If the start angle is negative or >= 360, the start angle is treated as start angle modulo 360. If the sweep angle is >= 360, then the circle is drawn completely. If the sweep angle is negative, the sweep angle is treated as sweep angle modulo 360.
The arc is drawn clockwise. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch). If radius is non-positive or sweep angle is zero, nothing is drawn.
The cap describes the end of the arc shape, the width describes the arc shape thickness. In paint: Style determines if arc shape is stroked or filled; If stroked (i.e. double stroke), stroke width describes the shape outline thickness, Cap describes line ends, Join draws the corners rounded or square, and Align determines the position or direction to stroke.
- Parameters:
cx
- the x-coordinate of the center of the arc to be drawncy
- the y-coordinate of the center of the arc to be drawnradius
- the radius of the circular arc to be drawnstartAngle
- starting angle (in degrees) where the arc beginssweepAngle
- sweep angle or angular extent (in degrees); positive is clockwisecap
- the line end used to determine the shape of the arcwidth
- the thickness of arc segmentpaint
- the paint used to draw the arc
-
drawPie
public final void drawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) Draw a circular sector (i.e., a pie) at (cx, cy) with radius using the current matrix, clip and specified paint.Similar to
drawArc(float, float, float, float, float, Paint)
, but when the shape is not a full circle, the geometry is closed by the arc and two line segments from the end of the arc to the center of the circle.- Parameters:
cx
- the x-coordinate of the center of the arc to be drawncy
- the y-coordinate of the center of the arc to be drawnradius
- the radius of the circular arc to be drawnstartAngle
- starting angle (in degrees) where the arc beginssweepAngle
- sweep angle or angular extent (in degrees); positive is clockwisepaint
- the paint used to draw the arc
-
drawChord
public final void drawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) Draw a circular segment (i.e., a cut disk) at (cx, cy) with radius using the current matrix, clip and specified paint.Similar to
drawArc(float, float, float, float, float, Paint)
, but when the shape is not a full circle, the geometry is closed by the arc and a line segment from the start of the arc segment to the end of the arc segment.- Parameters:
cx
- the x-coordinate of the center of the arc to be drawncy
- the y-coordinate of the center of the arc to be drawnradius
- the radius of the circular arc to be drawnstartAngle
- starting angle (in degrees) where the arc beginssweepAngle
- sweep angle or angular extent (in degrees); positive is clockwisepaint
- the paint used to draw the arc
-
drawTriangle
Draw a triangle using the specified paint. The three vertices are in counter-clockwise order.The Style is ignored in the paint, triangles are always "filled". The smooth radius and gradient color are ignored as well.
- Parameters:
x0
- the x-coordinate of the first vertexy0
- the y-coordinate of the first vertexx1
- the x-coordinate of the second vertexy1
- the y-coordinate of the second vertexx2
- the x-coordinate of the last vertexy2
- the y-coordinate of the last vertexpaint
- the paint used to draw the triangle
-
drawImage
public final void drawImage(@RawPtr @RawPtr Image image, float x, float y, SamplingOptions sampling, @Nullable Paint paint) Draw the specified image with its top/left corner at (x,y), using the specified paint, transformed by the current matrix. The Style and smooth radius is ignored in the paint, images are always filled.- Parameters:
image
- the image to be drawnx
- the position of the left side of the image being drawny
- the position of the top side of the image being drawnpaint
- the paint used to draw the image, null meaning a default paint
-
drawImageRect
public final void drawImageRect(@RawPtr @RawPtr Image image, Rect2fc dst, SamplingOptions sampling, @Nullable Paint paint) Draw the specified image, scaling/translating automatically to fill the destination rectangle. If the source rectangle is not null, it specifies the subset of the image to draw. The Style and smooth radius is ignored in the paint, images are always filled.- Parameters:
image
- the image to be drawndst
- the rectangle that the image will be scaled/translated to fit intopaint
- the paint used to draw the image, null meaning a default paint
-
drawImageRect
public final void drawImageRect(@RawPtr @RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, @Nullable Paint paint, int constraint) Draw the specified image, scaling/translating automatically to fill the destination rectangle. If the source rectangle is not null, it specifies the subset of the image to draw. The Style and smooth radius is ignored in the paint, images are always filled.- Parameters:
image
- the image to be drawnsrc
- the subset of the image to be drawn, null meaning full imagedst
- the rectangle that the image will be scaled/translated to fit intopaint
- the paint used to draw the image, null meaning a default paint
-
drawGlyphs
public final void drawGlyphs(@Nonnull int[] glyphs, int glyphOffset, @Nonnull float[] positions, int positionOffset, int glyphCount, float originX, float originY, @Nonnull Font font, @Nonnull Paint paint) Draws count glyphs, at positions relative to origin styled with font and paint.This function draw glyphs at the given positions relative to the given origin. It does not perform typeface fallback for glyphs not found in the Typeface in font.
The drawing obeys the current transform matrix and clipping.
All elements of paint: PathEffect, Shader, and ColorFilter; apply to text. By default, draws filled white glyphs.
- Parameters:
glyphs
- the array of glyphIDs to drawpositions
- where to draw each glyph relative to originglyphCount
- number of glyphs to draworiginX
- the origin X of all the positionsoriginY
- the origin Y of all the positionsfont
- typeface, text size and so, used to describe the textpaint
- blend, color, and so on, used to draw
-
drawTextBlob
Draws TextBlob blob at (x, y), using the current matrix, clip and specified paint.blob contains glyphs, their positions, and Font.
Elements of paint: anti-alias, Blender, color including alpha, ColorFilter, Paint dither, PathEffect, Shader, and Paint style; apply to blob. If Paint contains stroke: Paint miter limit, Cap, Join, and Paint stroke width; apply to Path created from blob.
- Parameters:
blob
- glyphs, positions, and their paints' text size, typeface, and so onoriginX
- horizontal offset applied to bloboriginY
- vertical offset applied to blobpaint
- blend, color, stroking, and so on, used to draw
-
drawVertices
public final void drawVertices(Vertices vertices, @SharedPtr @SharedPtr Blender blender, Paint paint) Draws the vertices, a triangle mesh, using current clip and matrix. If paint contains a Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.Blender is ignored if vertices does not have colors. Otherwise, it combines - the Shader if Paint contains Shader - or the solid Paint color if Paint does not contain Shader as the src of the blend and the interpolated vertex colors as the dst.
PathEffect, and antialiasing on Paint are ignored.
- Parameters:
vertices
- triangle mesh to drawblender
- combines vertices' colors with Shader if present or Paint opaque color if not. Ignored if the vertices do not contain color.paint
- specifies the Shader, used as Vertices texture, and ColorFilter.
-
isClipEmpty
public boolean isClipEmpty()Returns true if clip is empty; that is, nothing will draw.May do work when called; it should not be called more often than needed. However, once called, subsequent calls perform no work until clip changes.
- Returns:
- true if clip is empty
-
isClipRect
public boolean isClipRect()Returns true if clip is a Rect and not empty. Returns false if the clip is empty, or if it is complex.- Returns:
- true if clip is a Rect and not empty
-
getLocalToDevice
Returns the current transform from local coordinates to the 'device', which for most purposes means pixels.- Parameters:
storage
- transformation from local coordinates to device / pixels.
-
getLocalToDevice
Returns the current transform from local coordinates to the 'device', which for most purposes means pixels. Discards the 3rd row and column in the matrix, so be warned.- Parameters:
storage
- transformation from local coordinates to device / pixels.
-
close
public void close()Draws saved layers, if any. Frees up resources used by Canvas.- Specified by:
close
in interfaceAutoCloseable
-
onGetImageInfo
-
onNewSurface
-
getRootDevice
-
willSave
protected void willSave() -
getSaveLayerStrategy
protected int getSaveLayerStrategy(@Nullable Rect2f bounds, @Nullable Paint paint, @Nullable ImageFilter backdrop, int saveLayerFlags) -
willRestore
protected void willRestore() -
didRestore
protected void didRestore() -
didTranslate
protected void didTranslate(float dx, float dy, float dz) -
didScale
protected void didScale(float sx, float sy, float sz) -
didConcat
-
didSetMatrix
-
onDiscard
protected void onDiscard() -
onDrawPaint
-
onDrawPoints
-
onDrawLine
protected void onDrawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) -
onDrawRect
-
onDrawRoundRect
-
onDrawCircle
-
onDrawArc
protected void onDrawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) -
onDrawPie
protected void onDrawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) -
onDrawChord
protected void onDrawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) -
onDrawImageRect
-
onDrawTextBlob
-
onDrawGlyphRunList
-
onDrawVertices
protected void onDrawVertices(Vertices vertices, @SharedPtr @SharedPtr Blender blender, Paint paint) -
onClipRect
-