ReadonlyAffinityReadonlyAlphaReadonlyBLACKReadonlyBlenderReadonlyBlendReadonlyBLUEReadonlyBlurReadonlyClipReadonlyCLOSE_ReadonlyCodeReadonlyColorReadonlyColorReadonlyColorReadonlyColorReadonlyColorReadonlyCONIC_ReadonlyContourReadonlyCUBIC_ReadonlyCYANReadonlyDecorationReadonlyFillReadonlyFilterReadonlyFontReadonlyFontReadonlyFontReadonlyFontReadonlyFontReadonlyFontReadonlyFontReadonlyFontReadonlyGlyphOptional ReadonlygpuReadonlyGREENReadonlyImageReadonlyImageReadonlyImageReadonlyInputReadonlyLINE_ReadonlyLineReadonlyM44ReadonlyMAGENTAOptional Readonlymanaged_ReadonlyMaskReadonlyMatrixReadonlyMipmapReadonlyModifierReadonlyMOVE_ReadonlyNoReadonlyOverlineReadonlyPaintReadonlyPaintReadonlyParagraphReadonlyParagraphReadonlyPathReadonlyPath1ReadonlyPathReadonlyPathReadonlyPathReadonlyPDFReadonlyPDFConstructs a new PDFMetadata object with default values.
ReadonlyPictureReadonlyPlaceholderReadonlyPointReadonlyQUAD_ReadonlyRectReadonlyRectReadonlyREDReadonlyResizeOptional Readonlyrt_ReadonlyRuntimeReadonlySaveReadonlySaveReadonlyShaderReadonlyShadowUse this shadow flag to indicate the light position represents a direction and light radius is blur radius at elevation 1.
ReadonlyShadowUse this shadow flag to not use analytic shadows.
ReadonlyShadowUse this shadow flag to indicate the occluding object is not opaque. Knowing that the occluder is opaque allows us to cull shadow geometry behind it and improve performance.
ReadonlyShaperOptional ReadonlyskottieReadonlySlottableReadonlyStrokeReadonlyStrokeReadonlySVGReadonlyTextReadonlyTextReadonlyTextReadonlyTextReadonlyTextReadonlyTextReadonlyTileReadonlyTRANSPARENTReadonlyTypefaceReadonlyTypefaceReadonlyUnderlineReadonlyVectorReadonlyVertexReadonlyVerticalReadonlyWHITEReadonlyYELLOWConstructs a Color with the same API as CSS's rgba(), that is Internally, Colors are four unpremultiplied 32-bit floats: r, g, b, a. In order to construct one with more precision or in a wider gamut, use CanvasKit.Color4f().
red value, clamped to [0, 255].
green value, clamped to [0, 255].
blue value, clamped to [0, 255].
Optionala: numberalpha value, from 0 to 1.0. By default is 1.0 (opaque).
Construct a 4-float color. Float values are typically between 0.0 and 1.0.
red value.
green value.
blue value.
Optionala: numberalpha value. By default is 1.0 (opaque).
Constructs a Color as a 32 bit unsigned integer, with 8 bits assigned to each channel. Channels are expected to be between 0 and 255 and will be clamped as such. If a is omitted, it will be 255 (opaque).
This is not the preferred way to use colors in Skia APIs, use Color or Color4f.
red value, clamped to [0, 255].
green value, clamped to [0, 255].
blue value, clamped to [0, 255].
Optionala: numberalpha value, from 0 to 1.0. By default is 1.0 (opaque).
Computes color values for one-pass tonal alpha. Note, if malloced colors are passed in, the memory pointed at by the MallocObj will be overwritten with the computed tonal colors (and thus the return val can be ignored).
Free frees the memory returned by Malloc. Any memory allocated by CanvasKit.Malloc needs to be released with CanvasKit.Free.
Returns a css style [r, g, b, a] where r, g, b are returned as ints in the range [0, 255] and where a is scaled between 0 and 1.0. [Deprecated] - this is trivial now that Color is 4 floats.
Returns the max size of the global cache for bitmaps used by CanvasKit.
Returns the current size of the global cache for bitmaps used by CanvasKit.
Generate bounding box for shadows relative to path. Includes both the ambient and spot shadow bounds. This pairs with Canvas.drawShadow(). See SkShadowUtils.h for more details.
Current transformation matrix to device space.
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.
See SkShadowUtils.h; 0 means use default options.
OptionaldstRect: Rectif provided, the bounds will be copied into this rect instead of allocating a new one.
The bounding rectangle or null if it could not be computed.
Returns a rectangle with the given integer paramaters. See Rect.h for more.
The x coordinate of the upper-left corner.
The y coordinate of the upper-left corner.
The x coordinate of the lower-right corner.
The y coordinate of the lower-right corner.
Returns a rectangle with the given paramaters. See Rect.h for more.
The x coordinate of the upper-left corner.
The y coordinate of the upper-left corner.
The x coordinate of the lower-right corner.
The y coordinate of the lower-right corner.
Decodes the given bytes into an animated image. Returns null if the bytes were invalid. The passed in bytes will be copied into the WASM heap, so the caller can dispose of them.
The returned AnimatedImage will be "pointing to" the first frame, i.e. currentFrameDuration and makeImageAtCurrentFrame will be referring to the first frame.
Returns a Skottie animation built from the provided json string. Requires that Skottie be compiled into CanvasKit. Note: this animation will not be able to display text or images.
Returns an emulated Canvas2D of the given size.
Creates a Surface on a given canvas. If both GPU and CPU modes have been compiled in, this will first try to create a GPU surface and then fallback to a CPU one if that fails. If just the CPU mode has been compiled in, a CPU surface will be created.
either a canvas or a string with the DOM id of it.
Returns an image with the given pixel data and format. Note that we will always make a copy of the pixel data, because of inconsistencies in behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and not modifiable after creation).
bytes representing the pixel data.
Returns an Image with the data from the provided CanvasImageSource (e.g. ). This will
use the browser's built in codecs, in that src will be drawn to a canvas and then readback
and placed into an Image.
Return an Image backed by the encoded data, but attempt to defer decoding until the image is actually used/drawn. This deferral allows the system to cache the result, either on the CPU or on the GPU, depending on where the image is drawn. This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are invalid (or an unrecognized codec), null will be returned. See Image.h for more details.
Returns a managed Skottie animation built from the provided json string and assets. Requires that Skottie be compiled into CanvasKit.
Optionalassets: Record<string, ArrayBuffer>a dictionary of named blobs: { key: ArrayBuffer, ... }
OptionalfilterPrefix: stringan optional string acting as a name filter for selecting "interesting" Lottie properties (surfaced in the embedded player controls)
OptionalsoundMap: SoundMapan optional mapping of sound identifiers (strings) to AudioPlayers. Only needed if the animation supports sound.
Returns an SkPicture which has been serialized previously to the given bytes.
Creates a Raster (CPU) Surface that will draw into the provided Malloc'd buffer. This allows clients to efficiently be able to read the current pixels w/o having to copy. The length of pixels must be at least height * bytesPerRow bytes big.
How many bytes are per row. This is at least width * bytesPerColorType. For example, an 8888 ColorType has 4 bytes per pixel, so a 5 pixel wide 8888 surface needs at least 5 * 4 = 20 bytesPerRow. Some clients may have more than the usual to make the data line up with a particular multiple.
Creates a CPU backed (aka raster) surface.
either a canvas or a string with the DOM id of it.
Returns an Vertices based on the given positions and optional parameters. See SkVertices.h (especially the Builder) for more details.
OptionaltextureCoordinates: InputFlattenedPointArray | nullOptionalcolors: Float32Array<ArrayBufferLike> | ColorIntArray | nulleither a list of int colors or a flattened color array.
Optionalindices: number[] | nullOptionalisVolatile: booleanMalloc returns a TypedArray backed by the C++ memory of the given length. It should only be used by advanced users who can manage memory and initialize values properly. When used correctly, it can save copying of data between JS and C++. When used incorrectly, it can lead to memory leaks. Any memory allocated by CanvasKit.Malloc needs to be released with CanvasKit.Free.
const mObj = CanvasKit.Malloc(Float32Array, 20); Get a TypedArray view around the malloc'd memory (this does not copy anything). const ta = mObj.toTypedArray(); // store data into ta const cf = CanvasKit.ColorFilter.MakeMatrix(ta); // mObj could also be used.
// eventually... CanvasKit.Free(mObj);
constructor for the typedArray.
number of elements to store.
As Malloc but for GlyphIDs. This helper exists to make sure the JS side and the C++ side stay in agreement with how wide GlyphIDs are.
number of GlyphIDs to make space for.
Takes in a CSS color value and returns a CanvasKit.Color (which is an array of 4 floats in RGBA order). An optional colorMap may be provided which maps custom strings to values. In the CanvasKit canvas2d shim layer, we provide this map for processing canvas2d calls, but not here for code size reasons.
OptionalcolorMap: Record<string, Color>Returns a rectangle with rounded corners consisting of the given rectangle and the same radiusX and radiusY for all four corners.
The base rectangle.
The radius of the corners in the x direction.
The radius of the corners in the y direction.
Sets the max size of the global cache for bitmaps used by CanvasKit.
number of bytes that can be used to cache bitmaps.
Returns a rectangle with the given paramaters. See Rect.h for more.
The x coordinate of the upper-left corner.
The y coordinate of the upper-left corner.
The width of the rectangle.
The height of the rectangle.
Returns a rectangle with the given paramaters. See Rect.h for more.
The x coordinate of the upper-left corner.
The y coordinate of the upper-left corner.
The width of the rectangle.
The height of the rectangle.
Constructs a new PDFDocument.