import { type SkCanvas } from "https://deno.land/x/canvas@v1.0.0/types.ts";
See SkCanvas.h for more information on this class.
Methods
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, SkMatrix, and SkPaint 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, SkMatrix, and optional SkPaint paint.
Fills clip with the given color.
Fills clip with the given color.
Draws SkRRect outer and inner using clip, SkMatrix, and SkPaint paint. outer must contain inner or the drawing is undefined.
Draws the given image with its top-left corner at (left, top) using the current clip, the current matrix, and optionally-provided paint.
Draws the current frame of the given animated image with its top-left corner at (left, top) using the current clip, the current matrix, and optionally-provided paint.
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.
Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.
Draws line segment from (x0, y0) to (x1, y1) using the current clip, current matrix, and the provided paint.
Draws an oval bounded by the given rectangle using the current clip, current matrix, and the provided paint.
Fills clip with the given paint.
Draws the given Paragraph at the provided coordinates. Requires the Paragraph code to be compiled in.
Draws the given path using the current clip, current matrix, and the provided paint.
Draws 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 SkCanvas.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 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
Draw the given text at the location (x, y) using the provided paint and font. If non-shaped text is provided, the text will be drawn as is; no line-breaking, no ligatures, etc.
Draws the given TextBlob at (x, y) using the current clip, current matrix, and the provided paint. Reminder that the fonts used to draw TextBlob are part of the blob.
Draws the given vertices (a triangle mesh) using the current clip, current matrix, and the provided paint. If paint contains an SkShader and vertices does not contain texCoords, the shader is mapped using the vertices' positions. If vertices colors are defined in vertices, and SkPaint paint contains SkShader, SkBlendMode mode combines vertices colors with SkShader.
Returns the 4x4 matrix matching the given marker or null if there was none. See also markCTM.
Returns the current transform from local coordinates to the 'device', which for most purposes means pixels.
Returns the number of saved states, each containing: SkMatrix 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.
Creates SkSurface matching info and props, and associates it with SkCanvas. Returns null if no match found.
Record a marker (provided by caller) for the current CTM. This does not change anything about the ctm or clip, but does "name" this matrix value, so it can be referenced by custom effects (who access it by specifying the same name). See also findMarkedCTM.
Copies the given rectangle of pixels into a new Uint8Array and returns it. If alphaType, colorType, and colorSpace are provided, those will describe the output format.
Removes changes to the current matrix and clip since SkCanvas state was last saved. The state is removed from the stack. Does nothing if the stack is empty.
Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing. Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap. It returns the height of the stack. See SkCanvas.h for more.
Scales the current matrix by sx on the x-axis and sy on the y-axis.
Skews SkMatrix 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 SkMatrix 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.