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.
CanvasKit.MakeWebGLCanvasSurface
takes an option for WebGL version to make it easier to specify v1 or v2.no_alias_font
.MakeSkDashPathEffect
, MakeLinearGradientShader
, MakeRadialGradientShader
, MakeTwoPointConicalGradientShader
, MakeSkCornerPathEffect
, MakeSkDiscretePathEffect
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