Releases: samizdatco/skia-canvas
v2.0.0-rc2
Beta test
This is a pre-release version of the next Skia Canvas revision. Please give it a try and leave a reaction below (or open an issue) to report whether it worked for you or needs some more attention before relase.
To install, type:
npm install https://github.com/samizdatco/skia-canvasSee the full release notes
New Features
- Docs Website
- Documentation is now hosted at skia-canvas.org.
- Imagery
- SVGs & WEBP bitmaps can now be loaded as Images and drawn to the canvas
- Canvas saveAs and toBuffer added support for WEBPs and ‘raw’ bitmaps of different types
- drawImage and createPattern now work with ImageData objects as well as Images and Canvases
- New loadImageData helper function to asynchronously load files & urls for direct pixel access
- Image objects now support standard on/off/once EventEmitter methods
- Typography
- Added support for WOFF & WOFF2 font formats
- Added generic font mappings for
sans-serif
,serif
,monospace
, andsystem-ui
- New Context type properties: textDecoration, fontStretch, letterSpacing, & wordSpacing
- GUI
- Rendering
- New Canvas
engine
property gives status of GPU or CPU renderer - The number of background threads used for asynchronous exports can now be set with the
SKIA_CANVAS_THREADS
environment variable - The sample-count used by the GPU for multiscale antialiasing can now be configured through the optional
msaa
export argument. If omitted, defaults to 4x MSAA.
- New Canvas
Breaking Changes
- The minimum required Node version is now 12.22+, 14.17+, or 16+.
- Images now load asynchronously in cases where the
src
property has been set to a local path. As a result, it's now necessary toawait img.decode()
or set up an.on("load", …)
handler before drawing it—even when thesrc
is non-remote. - The KeyboardEvent object returned by the
keyup
/keydown
andinput
event listeners now has fields and values consistent with browser behavior. In particular,code
is now a name (e.g.,ShiftLeft
orKeyS
) rather than a numeric scancode,key
is a straightforward label for the key (e.g.,Shift
ors
) and the newlocation
field provides a numeric description of which variant of a key was pressed. - The deprecated
.async
property has been removed. See the v0.9.28 release notes for details. - The non-standard
.textTracking
property has been removed in favor of the new.letterSpacing
property
Bugfixes
- Made Vulkan device selection & initialization more reliable
- The Image.onload callback now properly sets
this
to point to the new image (contributed by @mpaperno & @ForkKILLET). - Creating a Window with
fullscreen
set totrue
now takes effect immediately - Drawing paths after setting an invalid transform no longer crashes (contributed by @mpaperno)
- Windows with
.on("draw")
handlers no longer become unresponsive on macOS 14+ after being fully occluded by other windows - Ellipses with certain combinations of positive and negative start- and stop-angles now render correctly—previously they would not appear at all if the total sweep exceeded 360° (contributed by @mpaperno)
- The
drawCanvas()
method now clips to the specified crop size (contributed by @mpaperno) isPointInPath
andisPointInStroke
now work with Path2D objects
Misc. Improvements
- Upgraded Skia to milestone 131
- Added more thorough TypeScript definitions
- Significant performance improvements to FontLibrary and getImageData(), which now makes use of the GPU (if enabled) and caches data between calls
- New Vulkan renderer using Vulkano for window-drawing on Windows and Linux.
- Wait to initialize GPU until it is used, not at startup. Set Canvas
.gpu
tofalse
to prevent any GPU-related resource acquisition from occurring - Now supports ES Modules and the
import
statement - The getImageData() method now makes use of the GPU (if enabled) and caches data between calls, greatly improving performance for sequential queries
v1.0.2
Maintenance
- After getting a surprise bill from Amazon for the S3 bucket hosting the pre-compiled binaries, I've moved them to GitHub Releases instead. Aside from resolving some security warnings by upgrading dependencies, this version should be functionally identical to 1.0.1…
Breaking Changes
- The 32-bit ARM-based linux builds are no longer provided pre-compiled; you'll now need to build from source.
v1.0.1
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-linux-arm64-glibc.tar.gz
Linux (ARM-64; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-linux-arm64-musl.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.1/skia-canvas-v1.0.1-linux-arm-glibc.tar.gz
Bugfixes
- If an offscreen buffer can't be allocated using the Vulkan renderer, CPU rendering is used as a fallback
- The
drawCanvas()
routine now works even when the destination canvas is later saved as an SVG (previously, the source canvas would be missing from the output). Caveat: this only works if the destination canvas is using the defaultsource-over
blend mode, has itsglobalAlpha
set to 1, and is not using shadows or theeffect
property. If any of those defaults have been changed, the drawn canvas will not appear in the saved SVG. Bitmap and PDF exports do not have this restriction.
Misc. Improvements
- Added a
fullscreen
event to theWindow
class to flag changes into and out of full-screen mode.
v1.0.0
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-linux-arm64-glibc.tar.gz
Linux (ARM-64; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-linux-arm64-musl.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v1.0.0/skia-canvas-v1.0.0-linux-arm-glibc.tar.gz
New Features
- The new Window class can display a Canvas on screen, respond to mouse and keyboard input, and fluidly animate by calling user-defined event handlers.
- Bitmap rendering now occurs on the GPU by default and can be configured using the Canvas's
.gpu
property. If the platform supports hardware-accelerated rendering (using Metal on macOS and Vulkan on Linux & Windows), the property will betrue
by default and can be set tofalse
to use the software renderer. - Added support for recent Chrome features:
- the
reset()
context method which erases the canvas, resets the transformation state, and clears the current path - the
roundRect()
method on contexts and Path2D objects which adds a rounded rectangle using 1–4 corner radii (provided as a single value or an array of numbers and/or DOMPoint objects)
- the
Bugfixes
- The
FontLibrary.reset()
method didn't actually remove previously installed fonts that had already been drawn with (and thus cached). It now clears those caches, which also means previously used fonts can now be replaced by calling.use()
again with the same family name. - The
.drawCanvas()
routine now applies filter effects and shadows consistent with the current resolution and transformation state.
Misc. Improvements
- The
.filter
property's"blur(…)"
and"drop-shadow(…)"
effects now match browser behavior much more closely and scale appropriately with thedensity
export option. - Antialiasing is smoother, particularly when down-scaling images, thanks to the use of mipmaps rather than Skia's (apparently buggy?) implementation of bicubic interpolation.
- Calling
clearRect()
with dimensions that fully enclose the canvas will now discard all the vector objects that have been drawn so far (rather than simply covering them up). - Upgraded Skia to milestone 103
v0.9.30
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-linux-arm64-glibc.tar.gz
Linux (ARM-64; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-linux-arm64-musl.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.30/skia-canvas-v0.9.30-linux-arm-glibc.tar.gz
New Features
- Enhacements to the shared FontLibrary object:
- Added pre-compiled binaries for Alpine Linux on arm64
Bugfixes
- Calling
clip
with an empty path (or one that does not intersect the current clipping mask) will now prevent drawing altogether - Transformation (
translate
,rotate
, etc.) and line-drawing methods (moveTo
,lineTo
,ellipse
, etc.) are now silently ignored if called withNaN
,Infinity
, or non-Number values in the arguments rather than throwing an error- applies to both the Context and Path2D versions of the drawing methods
- a TypeError is thrown only if the number of arguments is too low (mirroring browser behavior)
conicCurveTo()
now correctly reflects the canvas's transform state- The browser-based version of
loadImage()
now returns a Promise that correctly resolves to an Image object - SVG exports no longer have an invisible, canvas-sized
<rect/>
as their first element - Fixed an incompatibility on Alpine between the version of libstdc++ present on the
node:alpine
docker images and the version used when building the precompiled binaries
Misc. Improvements
- Upgraded Skia to milestone 101
v0.9.29
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-linux-arm64-glibc.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.29/skia-canvas-v0.9.29-linux-arm-glibc.tar.gz
New Features
- PDF exports now support the optional
matte
argument.
Breaking Changes
- When the
drawImage()
function is passed a Canvas object as its image source it will now rasterize the canvas before drawing. The prior behavior (in which it is drawn as a vector graphic) can now be accessed through the newdrawCanvas()
method which supports the same numerical arguments asdrawImage
but requires that its first argument be a Canvas.
Bugfixes
- Regions erased using
clearRect()
are now properly antialiased - The
clip()
method now interprets the current translate/scale/rotate state correctly when combining clipping masks
Misc. Improvements
- Upgraded Skia to milestone 97
v0.9.28
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-linux-arm64-glibc.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.28/skia-canvas-v0.9.28-linux-arm-glibc.tar.gz
New Features
- Added TypeScript definitions for extensions to the DOM spec (contributed by @cprecioso)
- Added 3D-perspective transformations via the new createProjection() context method
- Colors can now use the hwb() model
Breaking Changes
- The Canvas
.async
property has been deprecated and will be removed in a future release.- The
saveAs
,toBuffer
, andtoDataURL
methods will now be async-only (likewise the shorthand properties). - Use their synchronous counterparts (
saveAsSync
,toBufferSync
, andtoDataURLSync
) if you want to block execution while exporting images.
- The
- The ImageData constructor now orders its arguments properly: the optional buffer/array argument now comes first
Bugfixes
- Fixed a stack overflow that was occurring when images became too deeply nested for the default deallocator to handle (primarily due to many thousands of image exports from the same canvas)
- The
source-in
,source-out
,destination-atop
, andcopy
composite operations now work correctly for paths rather than rendering shapes without color (contributed by @meihuanyu) - Shape primitives now behave consistently with browsers when being added to a non-empty path:
rect()
now issues an initialmoveTo
rather than extending the path, then leaves the ‘current’ point in its upper left cornerellipse()
extends the current path rather than implicitly closing it (contributed by @meihuanyu)arc()
also extends the current path rather than closing it
Misc. Improvements
- Upgraded Skia to milestone 96
- Added workflow for creating docker build environments
v0.9.27
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-linux-x64-glibc.tar.gz
Linux (Intel/AMD; musl C library)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-linux-x64-musl.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-linux-arm64-glibc.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.27/skia-canvas-v0.9.27-linux-arm-glibc.tar.gz
New Features
- Added pre-compiled binaries for Alpine Linux using the musl C library
v0.9.26
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-linux-x64.tar.gz
Linux (ARM-64; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-linux-arm64.tar.gz
Linux (ARM-32; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.26/skia-canvas-v0.9.26-linux-arm.tar.gz
New Features
- Added pre-compiled binaries for 32-bit and 64-bit ARM on Linux (a.k.a. Raspberry Pi)
Bugfixes
- Windows text rendering has been restored after failing due to changes involving the
icudtl.dat
file FontLibrary.use
now reports an error if the specified font file doesn't exist- Fixed a crash that could result from calling
measureText
with various unicode escapes
Misc. Improvements
- Upgraded Skia to milestone 94
- Now embedding a more recent version of the FreeType library on Linux with support for more font formats
v0.9.25
Deprecation Warning
This version can no longer be installed via
npm
due to the unsustainable expense of hosting the library on S3. You can still install it directly from this GitHub release via the commands below. Find the section for your OS and machine type and copy/paste the correspondingnpm install …
command into your terminal.Installation commands
Mac (Apple Silicon)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.25/skia-canvas-v0.9.25-darwin-arm64.tar.gz
Mac (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.25/skia-canvas-v0.9.25-darwin-x64.tar.gz
Windows (Intel)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.25/skia-canvas-v0.9.25-win32-x64.tar.gz
Linux (Intel/AMD; glibc)
npm install https://github.com/samizdatco/skia-canvas/releases/download/v0.9.25/skia-canvas-v0.9.25-linux-x64.tar.gz
Bugfixes
- Improved image scaling when a larger image is being shrunk down to a smaller size via
drawImage()
- modified
imageSmoothingQuality
settings to provide a more meaningful range acrosslow
,medium
, andhigh
measureText()
now returns correct metrics regardless of currenttextAlign
setting- Rolled back
icudtl.dat
changes on Windows (which suppressed the misleading warning message but required running as Administrator)
Misc. Improvements
- Now using Neon v0.9 (with enhanced async event scheduling)