All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
SkRuntimeEffect.makeShader
and SkRuntimeEffect.makeShaderWithChildren
no longer accept an isOpaque
parameter. These functions will now make a best effort to determine if your shader always produces opaque output, and optimize accordingly. If you definitely want your shader to produce opaque output, do so in the shader's SkSL code.SkPicture.makeShader
Surface.updateTextureFromSource
prevents flickering on some platforms by re-using the texture for a given Image
instead of needing to always create a new one via Surface.makeImageFromTextureSource
. (skbug.com/12723)ParagraphBuilder.reset
allows re-use of the underlying memory.PathEffect.MakePath2D
, PathEffect.MakePath1D
and PathEffect.MakeLine2D
.null
to CanvasKit.MakeWebGLCanvasSurface
or calling any factory that does not take a color space will now create a surface with a color space of CanvasKit.ColorSpace.SRGB
.Surface.makeImageFromTextureSource
should not cause issues with Mipmaps or other places where Skia needs to create textures (skbug.com/12797)CanvasKit.MakeRenderTarget
correctly takes 2 or 3 params, as per the documentation.CanvasKit.MakeOnScreenGLSurface
and other gpu surface constructors correctly adjust the underlying WebGL context, avoiding corruption and mismatched textures (https://github.com/flutter/flutter/issues/95259).Canvas.drawVertices
and Canvas.drawPatch
treat the default blend mode differently. See https://bugs.chromium.org/p/skia/issues/detail?id=12662.Canvas.markCTM
and Canvas.findMarkedCTM
have been removed. They were effectively no-ops.measureText
to Canvas2D emulation layer. For accurate numbers, clients should use a real shaping library, like SkParagraph.AnimatedImage.currentFrameDuration
has been added, as well as some clarifying documentation.CanvasKit.MakeLazyImageFromTextureSource
, which is similar to Surface.makeImageFromTextureSource
, but can be re-used across different WebGL contexts.Surface.makeImageFromTextureSource
now takes an optional ImageInfo or PartialImageInfo instead of optional width and height. Sensible defaults will be used if not supplied.Surface
methods would not properly switch to the right WebGL context.INVALID_ENUM: enable: invalid capability
should be reduced/eliminated.FontMgr.MakeTypefaceFromData
and FontMgr.RefDefault
have been removed in favor of Typeface.MakeFreeTypeFaceFromData
make release
, make debug
, and variants put the output in a different location (./build).Surface.requestAnimationFrame
and Surface.drawOnce
are properly documented.Surface.grContext
and Surface.openGLversion
- these had been undocumented and are no longer exposed.CanvasKit.setCurrentContext
and CanvasKit.currentContext
. Existing calls can be deleted.Canvas.drawImage*
calls are correctly documented as accepting an optional Paint
or null.Path.makeAsWinding
has been added to convert paths with an EvenOdd FillType to the equivalent area using the Winding FillType.Paint.getBlendMode()
has been removed.Canvas.drawImageAtCurrentFrame()
has been removed.FilterOptions
| CubicResampler
instead.object
with actual types, including AnimationMarker
.Typeface.MakeFreeTypeFaceFromData
as a more convenient way to create a Typeface from the bytes of a .ttf, .woff, or .woff2 file.Typeface.getGlyphIDs
- provides the same functionality as Font.getGlyphIDs
.Font.getGlyphIDs
had the wrong type for the third argument. It is now correctly a Uint16Array.FontMgr.MakeTypefaceFromData
will be removed in favor of Typeface.MakeFreeTypeFaceFromData
FontMgr.RefDefault
will be removed in an upcoming version. It's only real use was for FontMgr.MakeTypefaceFromData
.Surface.makeImageFromTexture
and Surface.makeImageFromTextureSource
as easy ways to provide CanvasKit with a WebGL texture and interact with WebGL texture sources (e.g. <video>)Path.toCmds()
returns a flattened Float32Array instead of a 2D Array.Canvaskit.Path.MakeFromCmds
no longer accepts a 2D Array. Inputs must be flattened, but can be an array, a TypedArray, or a MallocObj.CanvasKit.*Builder
have all been removed. Clients should use Malloc instead.CanvasKit.Shader.MakeLerp
, the same effect can be easily generated with RuntimeEffect
Font.getGlyphIntercepts()
Canvas.flush
, which had been previously deprecated. Surface.flush
is the preferred method.AnimatedImage.getCurrentFrame
, which had been previously deprecated. AnimatedImage.makeImageAtCurrentFrame
is the replacement, which behaves exactly the same.drawPatch
to Canvas
.Strut
as a RectHeightStyle
enum.CanvasKit.RuntimeEffect
now supports integer uniforms in the SkSL. These are still passed to RuntimeEffect.makeShader
as floats (like all other uniforms), and will be converted to integers internally, to match the expectations of the shader.TextStyle
and StrutStyle
.ParagraphStyle
now accepts textHeightBehavior.Picture.saveAsFile()
, in favor of Picture.serialize()
where clients can control how to store/encode the bytes.CanvasKit.rt_effect
to test if the RuntimeEffect code was compiled in.ShapedText
type has been removed. Clients who want ShapedText should use the Paragraph APIs.Font.measureText
, which had been previously deprecated. Clients should use either Paragraph APIs or Font.getGlyphWidths
instead (the latter does no shaping).Font.getWidths
, which had been previously deprecated. Clients should use Font.getGlyphWidths
.managed_skottie
, particles
, and skottie
feature constants.CanvasKit.getDataBytes
has been removed, as has the Data type. The 2 APIS that returned Data now return Uint8Array containing the bytes directly. These are Image.encodeToData
(now named Image.encodeToBytes
) and SkPicture.serialize
. These APIs return null if the encoding or serialization failed.Image.encodeToDataWithFormat
was incorrectly documented as its own thing.getShadowLocalBounds()
to estimate the bounds of the shadows drawn by Canvas.drawShadow
.CanvasKit.RuntimeEffect.Make
now takes an optional callback function that will be called with any compilation error.CanvasKit.RuntimeEffect
now exposes uniforms. The number, dimensions, and name of each uniform can be queried, using RuntimeEffect.getUniformCount
, RuntimeEffect.getUniform
, and RuntimeEffect.getUniformName
. The total number of floats across all uniforms (that must be passed to RuntimeEffect.makeShader
) can be queried with RuntimeEffect.getUniformFloatCount
.MakeImprovedNoise
is removed.Effect
or Particle
. For example, instead of ParticleEffect.getEffectUniform
and ParticleEffect.getParticleUniform
, there is now just: ParticleEffect.getUniform
.Path.getPoint()
and SkottieAnimation.size()
now return a TypedArray instead of a normal array. Additionally, they take an optional parameter to allow the result to be copied into that provided TypedArray instead of a new one being allocated.Canvas.drawShadow()
now accepts zPlaneParams and lightPos as Malloc'ed and regular Float32Arrays. getShadowLocalBounds()
does as well.ContourMeasure.getPosTan
returns a Float32Array instead of a normal array. Additionally, this method takes an optional parameter to allow the result to be copied into that provided Float32Array instead of a new one being allocated.SkottieAnimation.size()
was incorrectly returning an object. It now returns a TypedArray of length 2 (w, h).Canvas.drawImageRect
, Canvas.drawImage
, Canvas.drawAtlas
, These rely on the Paint's FilterQuality, which is going away. Pass sampling options explicitly.PathMeasure
, which was deprecated and replaced with ContourMeasure
.Canvas.drawImageCubic
, Canvas.drawImageOptions
, Canvas.drawImageRectCubic
, Canvas.drawImageRectOptions
to replace functionality that previously required FilterQuality.Canvas.drawImageNine
now takes a required FilterMode (the Paint still is optional).getImageInfo()
and getColorSpace()
to the Image
type.CanvasKit.deleteContext()
for deleting WebGL contexts when done with them, resizing, etc.Image.makeCopyWithDefaultMipmaps()
for use with Image.makeShaderOptions
; necessary if choosing a MipmapMode
that is not None
.Path.addPoly()
no longer accepts a 2d array of points, but a flattened 1d array.MakeVertices()
no longer accepts 2d arrays of points or texture coordinates, but flattened 1d arrays in both places.Paint.setFilterQuality
, Paint.getFilterQuality
, Image.makeShader
have been removed. The new way to specify interpolation settings is with the newly added Image.makeShader*
methods. Image.makeShaderCubic
is a replacement for high quality; Image.makeShaderOptions
is for medium/low.MakeImage
is now documented in the Typescript types (index.d.ts). The parameters have been streamlined to align with other, similar APIs.MakeAnimatedImageFromEncoded
respects Exif metadata. MakeImageFromEncoded
already did so (and continues to do so).Canvas.drawPoints
correctly takes a flattened Array or TypedArray of points (as the documentation says), not a 2D array.MakeFractalNoise
, MakeImprovedNoise
, and MakeTurbulence
have been added to CanvasKit.Shader
.MakeRasterDirectSurface
for giving the user direct access to drawn pixels.getLineMetrics
to Paragraph.Canvas.saveLayerPaint
as an experimental, undocumented “fast path” if one only needs to pass the paint.CanvasKit.MakePathFromSVGString
was renamed to CanvasKit.Path.MakeFromSVGString
CanvasKit.MakePathFromOp
was renamed to CanvasKit.Path.MakeFromOp
Canvas.readPixels
and Image.readPixels
has been reworked to more accurately reflect the C++ backend and each other. bytesPerRow is now a required parameter. They take an ImageInfo object to specify the output format. Additionally they take an optional malloc'd object as the last parameter. If provided, the data will be copied into there instead of allocating a new buffer.CanvasKit.Shader.Blend
, ...Color
, and ...Lerp
have been renamed to CanvasKit.Shader.MakeBlend
, ...MakeColor
and ...MakeLerp
to align with naming conventions. The old names will be removed in an upcoming release.CanvasKit.MakePathFromCmds
; Was deprecated in favor of CanvasKit.Path.MakeFromCmds
.new CanvasKit.Path(path)
in favor of existing path.copy()
.measureText
from the CanvasContext2D emulation layer due to deprecation of measureText.Font.getWidths
in favor of Font.getGlyphIDs
and Font.getGlyphWidths
.Font.measureText
in favor of the Paragraph APIs (which actually do shaping).CanvasKit.GrContext
was renamed to CanvasKit.GrDirectContext
.CanvasKit.Shader.MakeLinearGradient
).new CanvasKit.SkPaint()
becomes new CanvasKit.Paint()
. See ./types/index.d.ts
for all the new names.Surface.captureFrameAsSkPicture
; it was deprecated previously.CanvasKit.MakeSkCornerPathEffect
, CanvasKit.MakeSkDiscretePathEffect
, CanvasKit.MakeBlurMaskFilter
, CanvasKit.MakeSkDashPathEffect
, CanvasKit.MakeLinearGradientShader
, CanvasKit.MakeRadialGradientShader
, CanvasKit.MakeTwoPointConicalGradientShader
; these were deprecated previously and have replacements like CanvasKit.PathEffect.MakeDash
.Canvas.concat44
; it was deprecated previously, just use Canvas.concat
CanvasKit.LTRBRect
, CanvasKit.XYWHRect
nor are accepted as JS objects. Instead, the format is 4 floats in either an array, a Float32Array or a piece of memory returned by CanvasKit.Malloc. These floats are the left, top, right, bottom numbers of the rectangle.CanvasKit.RRectXY
nor are accepted as JS objects. Instead, the format is 12 floats in either an array, a Float32Array or a piece of memory returned by CanvasKit.Malloc. The first 4 floats are the left, top, right, bottom numbers of the rectangle and then 4 sets of points starting in the upper left corner and going clockwise. This change allows for faster transfer between JS and WASM code.SkPath.addRoundRect
has been replaced with SkPath.addRRect
. The same functionality can be had with the CanvasKit.RRectXY
helper.SkPath.addRect
no longer accepts 4 floats as separate arguments. It only accepts an SkRect (an array/Float32Array of 4 floats) and an optional boolean for determining clockwise or counter-clockwise directionality.SkCanvas.saveLayer
arguments is slightly different (more consistent). It is now paint, bounds, backdrop, flags
main
used with SkSL passed to CanvasKit.SkRuntimeEffect.Make
has changed. There is no longer an inout half4 color
parameter, effects must return their color instead. Valid signatures are now half4 main()
or half4 main(float2 coord)
.SkPath.getBounds
, SkShapedText.getBounds
, and SkVertices.bounds
now take an optional argument. If a Float32Array with length 4 or greater is provided, the bounds will be copied into this array instead of allocating a new one.SkCanvas.drawAnimatedImage
has been removed in favor of calling SkCanvas.drawImageAtCurrentFrame
or SkAnimatedImage.makeImageAtCurrentFrame
and then SkCanvas.drawImage
.SkTextBlob.MakeFromRSXform
also accepts a (possibly Malloc'd) Float32Array of RSXforms ( see SkRSXform for more.)SkCanvas.drawRoundRect
has been removed in favor of SkCanvas.drawRRect
The same functionality can be had with the CanvasKit.RRectXY
helper.SkPath.arcTo
which had been deprecated in favor of SkPath.arcToOval
, SkPath.arcToRotated
, SkPath.arcToTangent
.ColorType
enum.CanvasKit.LTRBiRect
and CanvasKit.XYWHiRect
as helpers to create SkIRects.SkCanvas.drawRect4f
as a somewhat experimental way to have array-free APIs for clients that already have their own representation of Rect. This is experimental because we don‘t know if it’s faster/better under real-world use and because we don't want to commit to having these for all Rect APIs (and for similar types) until it has baked in a bit.TextStyle
:decorationStyle
textBaseline
letterSpacing
wordSpacing
heightMultiplier
locale
shadows
fontFeatures
strutStyle
to ParagraphStyle
.addPlaceholder
to ParagraphBuilder
.getRectsForPlaceholders
to Paragraph
.SkFont.getGlyphIDs
, SkFont.getGlyphBounds
, SkFont.getGlyphWidths
for turning code points into GlyphIDs and getting the associated metrics with those glyphs. Note: glyph ids are only valid for the font of which they were requested.SkTextBlob.MakeFromRSXformGlyphs
and SkTextBlob.MakeFromGlyphs
as a way to build TextBlobs using GlyphIDs instead of code points.CanvasKit.MallocGlyphIDs
as a helper for pre-allocating space on the WASM heap for Glyph IDs.SkAnimatedImage.getCurrentFrame
; prefer SkAnimatedImage.makeImageAtCurrentFrame
(which follows the establishing naming convention).SkSurface.captureFrameAsSkPicture
will be removed in a future release. Callers can simply use SkPictureRecorder
directly.CanvasKit.FourFloatArrayHelper
and related helpers (mostly helping with drawAtlas). CanvasKit.Malloc
is the better tool and will replace these soon.SkPathMeasure
; SkContourMeasureIter has all the same functionality and a cleaner pattern.SkCanvas.drawText
.SkPath.computeTightBounds()
works again. Like getBounds() it takes an optional argument to put the bounds into.CanvasKit.TypefaceFontProvider
, which can be used to register fonts with a font family alias. For example, “Roboto Light” may be registered with the alias “Roboto”, and it will be used when “Roboto” is used with a light font weight.CanvasKit.ParagraphBuilder.MakeFromFontProvider
to make a ParagraphBuilder
from a TypefaceFontProvider
.CanvasKit.ParagraphBuilder.pushPaintStyle
which can be used to stroke or fill text with paints instead of simple colors.do-while
loops in WebGL 1.0.include_effects_deserialization
.CanvasKit.MakeImageFromCanvasImageSource
which takes either an HTMLImageElement, SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas and returns an SkImage. This function is an alternative to CanvasKit.MakeImageFromEncoded
for creating SkImages when loading and decoding images. In the future, codesize of CanvasKit may be able to be reduced by removing image codecs in wasm, if browser APIs for decoding images are used along with CanvasKit.MakeImageFromCanvasImageSource
instead of CanvasKit.MakeImageFromEncoded
.CanvasKit.MakeImageFromCanvasImageSource
in core.spec.ts.CanvasKit.SkPath.MakeFromVerbsPointsWeights
and CanvasKit.SkPath.addVerbsPointsWeights
for supplying many path operations (e.g. moveTo, cubicTo) at once.CanvasKit.malloc
now has a subarray
method which works exactly like the normal TypedArray version. The TypedArray which it returns is also backed by WASM memory and when passed into CanvasKit will be used w/o copying the data (just like Malloc.toTypedArray
).SkM44.setupCamera
to return a 4x4 matrix which sets up a perspective view from a camera.SkPath.arcToOval
, SkPath.arcToTangent
, and SkPath.arcToRotated
to replace the three overloads of SkPath.arcTo
. https://github.com/flutter/flutter/issues/61305reportBackendType
to reportBackendTypeIsGPU
and made it return a booleanMakeWebGLCanvasSurface
can now accept an optional dictionary of WebGL context attributes that can be used to override default attributes.TextStyle.color
can correctly be a Malloc'd Float32Array.CanvasKit.MakePathFromCmds
has been renamed to CanvasKit.SkPath.MakeFromCmds
. The alias will be removed in an upcoming release.SkPath.arcTo
Separated into three functions.TypeError: Cannot perform %TypedArray%.prototype.set on a neutered ArrayBuffer
.SkSurface.reportBackendType
which returns either ‘CPU’ or ‘GPU’.SkSurface.imageInfo
which returns an ImageInfo object describing the size and color properties of the surface. colorSpace is added to ImageInfo everywhere it is used.CanvasKit.Free
to explicitly clean up memory after CanvasKit.Malloc
. All memory allocated with CanvasKit.Malloc
must be released with CanvasKit.Free
or it will be leaked. This can improve performance by reducing the copying of data between the JS and WASM side.CanvasKit.ColorAsInt
, SkPaint.setColorComponents
, SkPaint.setColorInt
, SkCanvas.drawColorComponents
, SkCanvas.drawColorInt
for when clients want to avoid the overhead of allocating an array for color components and only need 8888 color.CanvasKit.MakeCanvasSurface
accepts a new enum specifying one of the three color space and pixel format combinations supported by CanvasKit._Make*Shader
functions now accept a color space argument at the end. leaving it off or passing null makes it behave as it did before, defaulting to sRGBSkPaint.setColor
accepts a new color space argument, defaulting to sRGB.CanvasKitInit(...)
now directly returns a Promise. As such, CanvasKitInit(...).ready()
has been removed.CanvasKit.MakeCanvasSurface
no longer accepts width/height arguments to override those on the canvas element. Use the canvas element's width/height attributes to dictate the size of the drawing area, and use CSS width/height to set the size it will appear on the page (it is rescaled after drawing when css sizing applies).CanvasKit.Malloc
will no longer be automatically cleaned up. Clients must use CanvasKit.Free
to release the memory.CanvasKit.Malloc
no longer directly returns a TypedArray, but an object that can produce them with toTypedArray(). This is to avoid “detached ArrayBuffer” errors: https://github.com/emscripten-core/emscripten/issues/6747no_alias_font
.MakeSkDashPathEffect
, MakeLinearGradientShader
, MakeRadialGradientShader
, MakeTwoPointConicalGradientShader
, MakeSkCornerPathEffect
, MakeSkDiscretePathEffect
getError
should be disabled. This may cause a performance improvement in some scenarios.SkShader.Lerp
and SkShader.Blend
.SkCanvas.concat44
has been folded into concat (which now takes 3x2, 3x3, or 4x4 matrices). It will be removed soon.SkShader.MakeSweepGradient
SkCanvas.saveLayer
can now be called with 1 argument (the paint). In this case the current effective clip will be used, as the current rect is assumed to be null.SkPaint.setAlphaf
no_codecs
to compile.sh to remove all codec encoding and decoded code. This can save over 100 kb compressed if codecs are not needed.MakeSkDashPathEffect
will be removed soon. Calls can be replaced with SkPathEffect.MakeDash
.MakeLinearGradientShader
will be removed soon. Calls can be replaced with SkShader.MakeLinearGradient
.MakeRadialGradientShader
will be removed soon. Calls can be replaced with SkShader.MakeRadialGradient
.MakeTwoPointConicalGradientShader
will be removed soon. Calls can be replaced with SkShader.MakeTwoPointConicalGradient
.force_encode_webp
or force_encode_jpeg
to compile.sh.MakeSkCornerPathEffect
will be removed soon. Calls can be replaced with SkPathEffect.MakeCorner
.MakeSkDiscretePathEffect
will be removed soon. Calls can be replaced with SkPathEffect.MakeDiscrete
.SkSurface.drawOnce
for drawing a single frame (in addition to already existing SkSurface.requestAnimationFrame
for animation logic).CanvasKit.parseColorString
which processes color strings like “#2288FF”SkM44
.SkVector
.SkRuntimeEffect.makeShaderWithChildren
, which can take in other shaders as fragmentProcessors.GrContext.releaseResourcesAndAbandonContext
to free up WebGL contexts.SkFont
: setHinting
, setLinearMetrics
, setSubpixel
.SkMatrix.multiply
can now accept any number of matrix arguments, multiplying them left-to-right.SkFontMgr.countFamilies
and SkFontMgr.getFamilyName
to expose the parsed font names.SkPicture.DEBUGONLY_saveAsFile
renamed to SkPicture.saveAsFile
and CanvasKit.MakeSkPicture
is now exposed. SKP support is not shipped to npm builds. force_serialize_skp
has been removed since it opt-out, not opt-in.bin/core/
. It is about half the size of the “CoreWithFonts” build.SkAnimatedImage.getCurrentFrame
which returns an SkImage.CanvasKit.SaveLayerInitWithPrevious
and CanvasKit.SaveLayerF16ColorType
constants.SkShader.Empty
bin/
there is the “CoreWithFonts” build that contains most functionality from 0.10.0. However, we no longer ship the Skottie animation player, nor the Particles demo. Further, PathOps are removed from this build MakePathFromOp
, SkPath.op
and SkPath.simplify
. Clients who need any of those features are encouraged to create a custom build using compile.sh
.SkPicture.DEBUGONLY_saveAsFile
was accidentally included in release builds. It has been removed. Clients who need this in a release build (e.g. to file a bug report that only reproduces in release) should do a custom build with the force_serialize_skp
flag given.SkCanvas.drawAnimatedImage
will be renamed soon. Calls can be replaced with SkCanvas.drawImage
and SkAnimatedImage.getCurrentFrame
.SkContourMeasureIter
and SkContourMeasure
as an alternative to SkPathMeasure
.SkShader.Blend
, SkShader.Color
, SkShader.Empty
, SkShader.Lerp
.SkParagraph.getRectsForRange
now have direction with value CanvasKit.TextDirection
.MakeImage
properly in the externs file and can work with CanvasKit.Malloc
.CanvasKit.Malloc
, which can be used to create a TypedArray backed by the C++ WASM memory. This can save a copy in some cases (e.g. SkColorFilter.MakeMatrix). This is an advanced feature, so use it with care.SkCanvas.clipRRect
, SkCanvas.drawColor
SkPaint.setImageFilter
.SkCanvas.saveLayer
now takes 3 or 4 params to include up to bounds, paint, SkImageFilter, flags.SkPath.rArcTo
, SkPath.rConicTo
, SkPath.rCubicTo
, SkPath.rLineTo
, SkPath.rMoveTo
, SkPath.rQuadTo
. Like their non-relative siblings, these are chainable.width()
, height()
, reset()
, getFrameCount()
to SkAnimatedImage.SkCanvas.drawImageNine
, SkCanvas.drawPoints
and related PointMode
enum.SkPath.addPoly
SkPathMeasure.getSegment
getLongestLine()
, getWordBoundary
, and others.CanvasKit.MakeBlurMaskFilter
will be renamed/moved soon to CanvasKit.SkMaskFilter.MakeBlur
.CanvasKit.MakeAnimatedImageFromEncoded
, SkCanvas.drawAnimatedImage
.CanvasKit.SkFontMgr.FromData
which takes several ArrayBuffers of font data, parses them, reading the metadata (e.g. family names) and stores them into a SkFontMgr.no_font
compile option should strip out more dead code related to fonts.no_embedded_font
option now allows creating a SkFontMgr.FromData
instead of always having an empty one.SkCanvas.drawCircle()
, SkCanvas.getSaveCount()
SkPath.offset()
, SkPath.drawOval
SkRRect
support (SkCanvas.drawRRect
, SkCanvas.drawDRRect
, CanvasKit.RRectXY
). Advanced users can specify the 8 individual radii, if needed.CanvasKit.computeTonalColors()
, which returns TonalColors, which has an ambient SkColor and a spot SkColor.CanvasKit.SkColorFilter
and a variety of factories. SkPaint.setColorFilter
is the only consumer of these at the moment.CanvasKit.SkColorMatrix
with functions .identity()
, .scaled()
, .concat()
and others. Primarily for use with CanvasKit.SkColorFilter.MakeMatrix
.MakeSkVertices
uses a builder to save a copy.SkPath.arcTo
is given seven arguments, it no longer turns the first four into a SkRect
automatically, and instead uses them as arcTo(rx, ry, xAxisRotate, useSmallArc, isCCW, x, y)
(see SkPath.h for more).SkSurface.grContext
now exposed. GrContext
has new methods for monitoring/setting the cache limits; tweaking these may lead to better performance in some cases. getResourceCacheLimitBytes
, setResourceCacheLimitBytes
, getResourceCacheUsageBytes
SkCanvas.drawAtlas
for efficiently drawing multiple sprites from a sprite sheet with a set of transforms, color blends, etc.SkColorBuilder
, RSXFormBuilder
, SkRectBuilder
which increase performance by reducing the amount of malloc/free calls per frame, given that the array size is fixed.SkPicture
support. SkSurface.captureFrameAsSkPicture
is a helper function to capture an SkPicture
, which can be dumped to disk (for debugging) with SkPicture.DEBUGONLY_saveAsFile
.SkImage.readPixels
, which returns a TypedArray of pixel values (safe to use anywhere, doesn't need a delete()).GrGLCaps
support for WebGL - this shouldn't have any impacts on APIs or correctness, except by perhaps fixing a few bugs in various surface types.CanvasKit.MakeImageShader
to SkImage.makeShader
- removed clampUnpremul as argument.SkPathMeasure
, RSXFormBuilder
, SkFont.getWidths
, SkTextBlob.MakeFromRSXform
which were needed to add the helper function SkTextBlob.MakeOnPath
.SkSurface.requestAnimationFrame
- wrapper around window.requestAnimationFrame that takes care of the setup/tear down required to use CanvasKit optimally. The callback has an SkCanvas
as the first parameter - callers should draw on that.modules/canvaskit
(was experimental/canvaskit
)CanvasKit.SkMatrix.invert
SkCanvas.flush
will be removed soon - client should only call SkSurface.flush
CanvasKit.MakeSkVertices
. The previous (and current default) behavior was for this to be true; some applications may go faster if set to false.SkCanvas.saveLayer(rect, paint)
SkCanvas.restoreToCount(int)
which can be used with the output of .save() and .saveLayer().See CanvasKit.MakeParticles(json)
;GetWebGLContext
, MakeGrContext
, MakeOnScreenGLSurface
, MakeRenderTarget
.SkSurface.getSurface()
and SkCanvas.getSurface()
for making compatible surfaces (typically used as a workspace and then “saved” with surface.makeImageSnapshot()
)CanvasKit.MakeWebGLCanvasSurface
no longer takes a webgl context as a first arg, only a canvas or an id of a canvas. If users want to manage their own GL contexts, they should build the SkSurface
themselves with GetWebGLContext
-> MakeGrContext
-> MakeOnScreenGLSurface
.MakeManagedAnimation
for supplying external assets (like images, fonts).SkPath.addRoundRect
, SkPath.reset
, SkPath.rewind
exposed.SkCanvas.drawArc
, SkCanvas.drawLine
, SkCanvas.drawOval
, SkCanvas.drawRoundRect
exposed.CanvasKit.MakePathFromCmds
and SkPath.toCmds
.SkCanvas.drawTextBlob()
and SkCanvas.SkTextBlob.MakeFromText()
to draw text to a canvas.CanvasKit.TextEncoding
enum. For use with SkTextBlob
.ShapedText
object and SkCanvas.drawText
. At compile time, one can choose between using Harfbuzz/ICU (default) or a primitive one (“primitive_shaper”) which just does line breaking. Using Harfbuzz/ICU substantially increases code size (4.3 MB to 6.4 MB).SkCanvas.drawText()
now requires an SkFont
object for raw strings.SkPaint.setTextSize()
, SkPaint.getTextSize()
, SkPaint.setTypeface()
which should be replaced by using SkFont
.CanvasKitInit().then()
interface (see 0.3.1 notes)ready()
if already loaded.SkFont
now exposed.MakeCanvasSurface
can now take a canvas element directly.MakeWebGLCanvasSurface
can now take a WebGL context as an integer and use it directly.CanvasKitInit(...).then()
is no longer the recommended way to initialize things. It will be removed in 0.4.0. Use CanvasKitInit(...).ready()
, which returns a real Promise.SkPaint.measureText
- use SkFont.measureText
instead.no_canvas
to the compile.sh
invocation.CanvasKit.FontMgr.DefaultRef()
and fontmgr.MakeTypefaceFromData
to load fonts.SkPath.setVolatile
. Some animations see performance improvements by setting their paths' volatility to true.SkPath.addRect
now correctly draws counter-clockwise vs clockwise.CanvasKit.MakeImageShader
no longer takes encoded bytes, but an SkImage
, created from CanvasKit.MakeImageFromEncoded
. Additionally, the optional parameters clampIfUnpremul
and localMatrix
have been exposed.SkPath.arcTo
now takes startAngle
, sweepAngle
, forceMoveTo
as additional parameters.SkPath.stroke
has a new option precision
It defaults to 1.0.fontmgr.MakeTypefaceFromData
for more font variety.CanvasKit.initFonts()
- no longer needed.Beginning of Changelog history