Fills the current clip with the given color using Src BlendMode. This has the effect of replacing all pixels contained by clip with color.
Replaces clip with the intersection or difference of the current clip and path, with an aliased or anti-aliased clip edge.
Replaces clip with the intersection or difference of the current clip and rect, with an aliased or anti-aliased clip edge.
Replaces clip with the intersection or difference of the current clip and rrect, with an aliased or anti-aliased clip edge.
Replaces current matrix with m premultiplied with the existing matrix.
Draws arc using clip, Matrix, and Paint paint.
Arc is part of oval bounded by oval, sweeping from startAngle to startAngle plus sweepAngle. startAngle and sweepAngle are in degrees.
Draws a set of sprites from atlas, using clip, Matrix, and optional Paint paint.
Image containing sprites
Rect locations of sprites in atlas
RSXform mappings for sprites in atlas
OptionalblendMode: EmbindEnumEntity | nullBlendMode combining colors and sprites
Optionalcolors: ColorIntArray | nullIf provided, will be blended with sprite using blendMode.
Optionalsampling: CubicResampler | FilterOptionsSpecifies sampling options. If null, bilinear is used.
Draws a circle at (cx, cy) with the given radius.
Fills clip with the given color.
OptionalblendMode: EmbindEnumEntitydefaults to SrcOver.
Fills clip with the given color.
red value (typically from 0 to 1.0).
green value (typically from 0 to 1.0).
blue value (typically from 0 to 1.0).
alpha value, range 0 to 1.0 (1.0 is opaque).
OptionalblendMode: EmbindEnumEntitydefaults to SrcOver.
Fills clip with the given color.
OptionalblendMode: EmbindEnumEntitydefaults to SrcOver.
Draws RRect outer and inner using clip, Matrix, and Paint paint. outer must contain inner or the drawing is undefined.
Draws a run of glyphs, at corresponding positions, in a given font.
the array of glyph IDs (Uint16TypedArray)
the array of x,y floats to position each glyph
x-coordinate of the origin of the entire run
y-coordinate of the origin of the entire run
the font that contains the glyphs
Draws glyphs at positions defined by RSXforms (rotation + scale + translate). Each glyph i is placed at xforms[i], which encodes [scos, ssin, tx, ty]. Use CanvasKit.RSXFormMake(scos, ssin, tx, ty) to build individual entries.
glyph IDs
flat array of RSXform values: [scos, ssin, tx, ty] per glyph
overall X origin added to all transforms
overall Y origin added to all transforms
Draws the provided image stretched proportionally to fit into dst rectangle. The center rectangle divides the image into nine sections: four sides, four corners, and the center.
what technique to use when sampling the image
Optionalpaint: Paint | nullDraws the given image with its top-left corner at (left, top) using the current clip, the current matrix. It will use the provided sampling options if necessary.
The filter mode.
The mipmap mode. Note: for settings other than None, the image must have mipmaps calculated with makeCopyWithDefaultMipmaps;
Optionalpaint: Paint | nullDraws sub-rectangle src from provided image, scaled and translated to fill dst rectangle. It will use the provided sampling options if necessary.
The filter mode.
The mipmap mode. Note: for settings other than None, the image must have mipmaps calculated with makeCopyWithDefaultMipmaps;
Optionalpaint: Paint | nullDraws line segment from (x0, y0) to (x1, y1) using the current clip, current matrix, and the provided paint.
Draws the given Paragraph at the provided coordinates. Requires the Paragraph code to be compiled in.
Draws a cubic patch defined by 12 control points [top, right, bottom, left] with optional colors and shader-coordinates [4] specifed for each corner [top-left, top-right, bottom-right, bottom-left]
12 points : 4 connected cubics specifying the boundary of the patch
Optionalcolors: ColorIntArray | Color[] | nulloptional colors interpolated across the patch
Optionaltexs: InputFlattenedPointArray | nulloptional shader coordinates interpolated across the patch
Optionalmode: EmbindEnumEntity | nullSpecifies how shader and colors blend (if both are specified)
Optionalpaint: PaintDraws the given picture using the current clip, current matrix, and the provided paint.
Draws the given points using the current clip, current matrix, and the provided paint.
See Canvas.h for more on the mode and its interaction with paint.
Draws the given rectangle using the current clip, current matrix, and the provided paint.
Draws the given rectangle with rounded corners using the current clip, current matrix, and the provided paint.
Draw an offset spot shadow and outlining ambient shadow for the given path using a disc light. See SkShadowUtils.h for more details
The occluder used to generate the shadows.
Values for the plane function which returns the Z offset of the occluder from the canvas based on local x and y values (the current matrix is not applied).
The 3D position of the light relative to the canvas plane. This is independent of the canvas's current matrix.
The radius of the disc light.
The color of the ambient shadow.
The color of the spot shadow.
See SkShadowUtils.h; 0 means use default options.
Draws the given vertices (a triangle mesh) using the current clip, current matrix, and the provided paint. If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions. If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
Returns the current transform from local coordinates to the 'device', which for most purposes means pixels.
Returns the number of saved states, each containing: Matrix and clip. Equals the number of save() calls less the number of restore() calls plus one. The save count of a new canvas is one.
Legacy version of getLocalToDevice(), which strips away any Z information, and just returns a 3x3 version.
Returns true if the given rect, transformed by the current canvas transform, can be quickly determined to fall entirely outside the clip.
Returns a TypedArray containing the pixels reading starting at (srcX, srcY) and does not exceed the size indicated by imageInfo. See SkCanvas.h for more on the caveats.
If dest is not provided, we allocate memory equal to the provided height * the provided bytesPerRow to fill the data with.
This is generally a very expensive call for the GPU backend.
describes the destination format of the pixels.
Optionaldest: MallocObjIf provided, the pixels will be copied into the allocated buffer allowing access to the pixels without allocating a new TypedArray.
OptionalbytesPerRow: numbernumber of bytes per row. Must be provided if dest is set. This depends on destination ColorType. For example, it must be at least 4 * width for the 8888 color type.
a TypedArray appropriate for the specified ColorType. Note that 16 bit floats are not supported in JS, so that colorType corresponds to raw bytes Uint8Array.
Removes changes to the current matrix and clip since Canvas state was last saved. The state is removed from the stack. Does nothing if the stack is empty.
Restores state to a previous stack value.
Rotates the current matrix by the number of degrees.
angle of rotation in degrees.
Saves the current matrix and clip and returns current height of the stack.
Saves Matrix and clip, and allocates a SkBitmap for subsequent drawing. Calling restore() discards changes to Matrix and clip, and draws the SkBitmap. It returns the height of the stack. See Canvas.h for more.
Optionalpaint: PaintOptionalbounds: InputRect | nullOptionalbackdrop: ImageFilter | nullOptionalflags: numberOptionalbackdropFilterTileMode: EmbindEnumEntityScales the current matrix by sx on the x-axis and sy on the y-axis.
Skews Matrix by sx on the x-axis and sy on the y-axis. A positive value of sx skews the drawing right as y-axis values increase; a positive value of sy skews the drawing down as x-axis values increase.
Translates Matrix by dx along the x-axis and dy along the y-axis.
Writes the given rectangle of pixels to the provided coordinates. The source pixels will be converted to the canvas's alphaType and colorType if they do not match.
OptionalalphaType: EmbindEnumEntitydefaults to Unpremul
OptionalcolorType: EmbindEnumEntitydefaults to RGBA_8888
OptionalcolorSpace: ColorSpacedefaults to SRGB
See SkCanvas.h for more information on this class.