skia-canvas
Advanced tools
Changelog
📦 ⟩ [v0.9.23] ⟩ Jul 12, 2021
conicCurveTo()
][conic_curveto] methodoutlineText()
][outline_text] methodedges
][edges] property which contains an array of line-drawing commands describing the path’s individual contourscontains()
][contains] method which tests whether a given point is on/within the pathpoints()
][points] method which returns an array of [x, y]
pairs at the requested spacing along the curve’s peripheryoffset()
][offset] or [transform()
][transform] to shift position or apply a DOMMatrix respectivelyjitter()
][jitter] to break the path into smaller sections and apply random noise to the segments’ positionsround()
][round] to round off every sharp corner in a path to a particular radiustrim()
][trim] to select a percentage-based subsection of the pathinterpolate()
][interpolate] methodfill()
or stroke()
method no longer disturbs the context’s ‘current’ path (if one has been created using beginPath()
)filter
property will now accept percentage values greater than 999%newPage()
and saveAs()
methods now work in the browser, including the ability to save image sequences to a zip archive. The browser’s canvas is still doing all the drawing however, so file export formats will be limited to PNG and JPEG and none of the other Skia-specific extensions will be available.matte
][matte] value in their options object which can be used to set the background color for any portions of the canvas that were left semi-transparentChangelog
📦 ⟩ [v0.9.22] ⟩ Jun 09, 2021
async
property for details.SaveAs
and the other canvas output functions all accept an optional density
argument which is an integer ≥1 and will upscale the image accordingly. The density can also be passed using the filename
argument by ending the name with an ‘@’ suffix like some-image@2x.png
.outline
argument to true
.toBuffer
, toDataURL
, png
, jpg
, pdf
, and svg
) and file i/o (saveAs
) are now asynchronous and return Promise
objects. The old, synchronous behavior is still available on a canvas-by-canvas basis by setting its async
property to false
.quality
argument accepted by the output methods is now a float in the range 0–1 rather than an integer from 0–100. This is consistent with the encoderOptions arg in the spec. Quality now defaults to 0.92 (again, as per the spec) rather than lossless.measureText
was reporting zero when asked to measure a string that was entirely made of whitespace. This is still the case for ‘blank‘ lines when textWrap
is set to true
but in the default, single-line mode the metrics will now report the width of the whitespace.Context2D
s now use an external Typesetter
struct to manage layout and rendering.Changelog
📦 ⟩ [v0.9.21] ⟩ May 22, 2021
createConicGradient()
.decode()
method allowing for async loading without the loadImage
helper.drawImage
with a Canvas
object as the argument now uses a Skia Pict
rather than a Drawable
as the interchange format, meaning it can actually respect the canvas's current globalAlpha
and globalCompositeOperation
state (fixed #6).CanvasPattern
s now respect the imageSmoothingEnabled
settingcounterclockwise
arg to ellipse
and arc
is now correctly treated as optional.console.log
representations of the canvas-related objects friendlier.Path2D
, Image
, and Canvas
’s format support.Changelog
📦 ⟩ [v0.9.20] ⟩ Mar 27, 2021
loadImage
helper can now handle Buffer
argumentsctx.font