Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@napi-rs/canvas

Brooooooklyn2.5mMIT0.1.69TypeScript support: included

Canvas for Node.js with skia backend

napi-rs, NAPI, N-API, Rust, node-addon, node-addon-api, canvas, image, pdf, svg, skia

readme

skr canvas

CI Skia Version install size Downloads

🚀 Help me to become a full-time open-source developer by sponsoring me on Github

Google Skia binding to Node.js via Node-API, 0 System dependencies!

⚠️ This project is in pre-release stage. And there may be some bugs.
For details on planned features and future direction please refer to the Roadmap.

中文文档

Install

yarn add @napi-rs/canvas
npm install @napi-rs/canvas

Support matrix

System requirement

arm64

cortex-a57 or newer CPU architecture on Linux.

All Apple M chips on macOS.

armv7

cortex-a7 or newer CPU architecture.

glibc

Since Skia relies on the glibc 2.18 API, you need to have at least glibc version >= 2.18 on your system.

AWS Lambda usage

To use this library on Lambda you will need to use a Lambda layer.

You can simply attach a lambda layer by getting an ARN from Canvas-Lambda-Layer

Make sure to exclude @napi-rs/canvas while bundling your Lambda.

Usage

const { promises } = require('node:fs')
const { join } = require('node:path')
const { createCanvas, loadImage } = require('@napi-rs/canvas')

const canvas = createCanvas(300, 320)
const ctx = canvas.getContext('2d')

ctx.lineWidth = 10
ctx.strokeStyle = '#03a9f4'
ctx.fillStyle = '#03a9f4'

// Wall
ctx.strokeRect(75, 140, 150, 110)

// Door
ctx.fillRect(130, 190, 40, 60)

// Roof
ctx.beginPath()
ctx.moveTo(50, 140)
ctx.lineTo(150, 60)
ctx.lineTo(250, 140)
ctx.closePath()
ctx.stroke()

async function main() {
  // load images from disk or from a URL
  const catImage = await loadImage('path/to/cat.png')
  const dogImage = await loadImage('https://example.com/path/to/dog.jpg')

  ctx.drawImage(catImage, 0, 0, catImage.width, catImage.height)

  ctx.drawImage(dogImage, canvas.width / 2, canvas.height / 2, dogImage.width, dogImage.height)

  // export canvas as image
  const pngData = await canvas.encode('png') // JPEG, AVIF and WebP are also supported
  // encoding in libuv thread pool, non-blocking
  await promises.writeFile(join(__dirname, 'simple.png'), pngData)
}

main()

Emoji text

const { writeFileSync } = require('fs')
const { join } = require('path')

const { createCanvas, GlobalFonts } = require('@napi-rs/canvas')

GlobalFonts.registerFromPath(join(__dirname, '..', 'fonts', 'AppleColorEmoji@2x.ttf'), 'Apple Emoji')
GlobalFonts.registerFromPath(join(__dirname, '..', '__test__', 'fonts', 'COLRv1.ttf'), 'COLRv1')

console.info(GlobalFonts.families)

const canvas = createCanvas(760, 360)
const ctx = canvas.getContext('2d')

ctx.font = '50px Apple Emoji'
ctx.strokeText('😀😃😄😁😆😅😂🤣☺️😊😊😇', 50, 150)

ctx.font = '100px COLRv1'
ctx.fillText('abc', 50, 300)

const b = canvas.toBuffer('image/png')

writeFileSync(join(__dirname, 'draw-emoji.png'), b)

Performance

See benchmark for benchmark code.

Hardware info:

                  ,MMMM.           Host        -  xxxxxxxxxxxxxxxxxxxxxxx
                .MMMMMM            Machine     -  Mac15,9
                MMMMM,             Kernel      -  24.0.0
      .;MMMMM:' MMMMMMMMMM;.       OS          -  macOS 15.0.1 Sequoia
    MMMMMMMMMMMMNWMMMMMMMMMMM:     DE          -  Aqua
  .MMMMMMMMMMMMMMMMMMMMMMMMWM.     WM          -  Quartz Compositor
  MMMMMMMMMMMMMMMMMMMMMMMMM.       Packages    -  194 (Homebrew), 32 (cargo)
 ;MMMMMMMMMMMMMMMMMMMMMMMM:        Shell       -  zsh
 :MMMMMMMMMMMMMMMMMMMMMMMM:        Terminal    -  warpterminal (Version v0.2024.10.23.14.49.stable_00)
 .MMMMMMMMMMMMMMMMMMMMMMMMM.       Resolution  -  5120x2880@160fps (as 2560x1440)
  MMMMMMMMMMMMMMMMMMMMMMMMMMM.                    2992x1934@120fps (as 1496x967)
   .MMMMMMMMMMMMMMMMMMMMMMMMMM.                   2232x1512@60fps (as 1116x756)
     MMMMMMMMMMMMMMMMMMMMMMMM      Uptime      -  1d 2h 32m
      ;MMMMMMMMMMMMMMMMMMMM.       CPU         -  Apple M3 Max (16)
        .MMMM,.    .MMMM,.         CPU Load    -  16%
                                   Memory      -  50.1 GB / 134.2 GB
                                   Battery     -  78% & Discharging
                                   Disk Space  -  624.0 GB / 994.7 GB
❯ yarn bench
Draw a House and export to PNG
┌─────────┬─────────────────┬───────────────────────┬──────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐
│ (index) │ Task name       │ Latency average (ns)  │ Latency median (ns)      │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │
├─────────┼─────────────────┼───────────────────────┼──────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤
│ 0       │ '@napi-rs/skia''14676992.14 ± 0.68%''14602333.00''68 ± 0.59%''68'                      │ 69      │
│ 1       │ 'skia-canvas''21167809.17 ± 2.05%''20960021.00 ± 13646.00''47 ± 1.31%''48'                      │ 64      │
│ 2       │ 'node-canvas''16552027.42 ± 0.70%''16451291.50 ± 2208.50''60 ± 0.62%''61'                      │ 64      │
└─────────┴─────────────────┴───────────────────────┴──────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘
Draw Gradient and export to PNG
┌─────────┬─────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐
│ (index) │ Task name       │ Latency average (ns)  │ Latency median (ns)     │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │
├─────────┼─────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤
│ 0       │ '@napi-rs/skia''15228495.58 ± 0.53%''15146312.50 ± 1187.50''66 ± 0.48%''66'                      │ 66      │
│ 1       │ 'skia-canvas''21725564.41 ± 2.20%''21412520.50 ± 2104.50''46 ± 1.39%''47'                      │ 64      │
│ 2       │ 'node-canvas''17976022.14 ± 1.53%''17563479.50 ± 5104.50''56 ± 1.38%''57'                      │ 64      │
└─────────┴─────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘

Features

Path2D

new Path2D()
new Path2D(path: Path2D)
// new Path2D('M108.956,403.826c0,0,0.178,3.344-1.276,3.311  c-1.455-0.033-30.507-84.917-66.752-80.957C40.928,326.18,72.326,313.197,108.956,403.826z')
new Path2D(path: string)
export interface DOMMatrix2DInit {
  a: number
  b: number
  c: number
  d: number
  e: number
  f: number
}

export class Path2D {
  constructor(path?: Path2D | string)

  addPath(path: Path2D, transform?: DOMMatrix2DInit): void
  arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
  closePath(): void
  ellipse(
    x: number,
    y: number,
    radiusX: number,
    radiusY: number,
    rotation: number,
    startAngle: number,
    endAngle: number,
    anticlockwise?: boolean,
  ): void
  lineTo(x: number, y: number): void
  moveTo(x: number, y: number): void
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
  rect(x: number, y: number, w: number, h: number): void

  // PathKit methods
  op(path: Path2D, operation: PathOp): Path2D
  toSVGString(): string
  getFillType(): FillType
  getFillTypeString(): string
  setFillType(type: FillType): void
  simplify(): Path2D
  asWinding(): Path2D
  stroke(stroke?: StrokeOptions): Path2D
  transform(transform: DOMMatrix2DInit): Path2D
  getBounds(): [left: number, top: number, right: number, bottom: number]
  computeTightBounds(): [left: number, top: number, right: number, bottom: number]
  trim(start: number, end: number, isComplement?: boolean): Path2D
  equals(path: Path2D): boolean
}

PathKit

PathKit is a toolset for manipulating Path in Skia, supporting quadratic beziers, cubic beziers and conics. The main features are.

Path Operation

.op(path, PathOp)

const pathOne = new Path2D(
  'M8 50H92C96.4183 50 100 53.5817 100 58V142C100 146.418 96.4183 150 92 150H8C3.58172 150 0 146.418 0 142V58C0 53.5817 3.58172 50 8 50Z',
)
const pathTwo = new Path2D(
  '"M58 0H142C146.418 0 150 3.58172 150 8V92C150 96.4183 146.418 100 142 100H58C53.5817 100 50 96.4183 50 92V8C50 3.58172 53.5817 0 58 0Z',
)

pathOne.op(pathTwo, PathOp.Intersect).toSVGString()
// => "M100 100L58 100C53.5817 100 50 96.4183 50 92L50 50L92 50C96.4183 50 100 53.5817 100 58L100 100Z"
  • Union, subtract the op path from the first path
  • Difference, intersect the two paths
  • ReverseDifference, union (inclusive-or) the two paths
  • Intersect, exclusive-or the two paths
  • XOR, subtract the first path from the op path

boolean-operations

Covert FillType in Path

.asWinding()

You can convert fill-rule="evenodd" to fill-rule="nonzero" in SVG. This is useful for OpenType font-related tools, as fill-rule="nonzero" is only supported in OpenType fonts.

SVG fill-rule

const pathCircle = new Path2D(
  'M24.2979 13.6364H129.394V40.9091H24.2979L14.6278 27.2727L24.2979 13.6364ZM21.9592 0C19.0246 0 16.2716 1.42436 14.571 3.82251L1.67756 22.0043C-0.559186 25.1585 -0.559186 29.387 1.67756 32.5411L14.571 50.7227C16.2716 53.1209 19.0246 54.5455 21.9592 54.5455H70.4673V68.1818H16.073C11.0661 68.1818 7.00728 72.2518 7.00728 77.2727V113.636C7.00728 118.657 11.0661 122.727 16.073 122.727H70.4673V150H84.0658V122.727H128.041C130.975 122.727 133.729 121.303 135.429 118.905L148.323 100.723C150.559 97.5686 150.559 93.3405 148.323 90.1864L135.429 72.0045C133.729 69.6064 130.975 68.1818 128.041 68.1818H84.0658V54.5455H133.927C138.934 54.5455 142.993 50.4755 142.993 45.4545V9.09091C142.993 4.07014 138.934 0 133.927 0H21.9592ZM125.702 109.091H20.6058V81.8182H125.702L135.372 95.4545L125.702 109.091Z',
)
pathCircle.setFillType(FillType.EvenOdd)
pathCircle.asWinding().toSVGString()
// => "M24.2979 13.6364L129.394 13.6364L129.394 40.9091L24.2979 40.9091L14.6278 27.2727L24.2979 13.6364ZM21.9592 0C19.0246 0 16.2716 1.42436 14.571 3.82251L1.67756 22.0043C-0.559186 25.1585 -0.559186 29.387 1.67756 32.5411L14.571 50.7227C16.2716 53.1209 19.0246 54.5455 21.9592 54.5455L70.4673 54.5455L70.4673 68.1818L16.073 68.1818C11.0661 68.1818 7.00728 72.2518 7.00728 77.2727L7.00728 113.636C7.00728 118.657 11.0661 122.727 16.073 122.727L70.4673 122.727L70.4673 150L84.0658 150L84.0658 122.727L128.041 122.727C130.975 122.727 133.729 121.303 135.429 118.905L148.323 100.723C150.559 97.5686 150.559 93.3405 148.323 90.1864L135.429 72.0045C133.729 69.6064 130.975 68.1818 128.041 68.1818L84.0658 68.1818L84.0658 54.5455L133.927 54.5455C138.934 54.5455 142.993 50.4755 142.993 45.4545L142.993 9.09091C142.993 4.07014 138.934 0 133.927 0L21.9592 0ZM125.702 109.091L20.6058 109.091L20.6058 81.8182L125.702 81.8182L135.372 95.4545L125.702 109.091Z"

Simplify Path

.simplify()

Set the path to the same non-overlapping contour as the original path area, which means that it can also remove overlapping paths.

SVG with overlapping paths (Left)

const path =
  'M2.933,89.89 L89.005,3.818 Q90.412,2.411 92.249,1.65 Q94.087,0.889 96.076,0.889 Q98.065,0.889 99.903,1.65 Q101.741,2.411 103.147,3.818 L189.22,89.89 Q190.626,91.296 191.387,93.134 Q192.148,94.972 192.148,96.961 Q192.148,98.95 191.387,100.788 Q190.626,102.625 189.219,104.032 Q187.813,105.439 185.975,106.2 Q184.138,106.961 182.148,106.961 Q180.159,106.961 178.322,106.2 Q176.484,105.439 175.077,104.032 L89.005,17.96 L96.076,10.889 L103.147,17.96 L17.075,104.032 Q15.668,105.439 13.831,106.2 Q11.993,106.961 10.004,106.961 Q8.015,106.961 6.177,106.2 Q4.339,105.439 2.933,104.032 Q1.526,102.625 0.765,100.788 Q0.004,98.95 0.004,96.961 Q0.004,94.972 0.765,93.134 Q1.526,91.296 2.933,89.89 Z'

path.simplify().toSVGString()
// => "M89.005 3.818L2.933 89.89Q1.526 91.296 0.765 93.134Q0.004 94.972 0.004 96.961Q0.004 98.95 0.765 100.788Q1.526 102.625 2.933 104.032Q4.339 105.439 6.177 106.2Q8.015 106.961 10.004 106.961Q11.993 106.961 13.831 106.2Q15.668 105.439 17.075 104.032L96.076 25.031L175.077 104.032Q176.484 105.439 178.322 106.2Q180.159 106.961 182.148 106.961Q184.138 106.961 185.975 106.2Q187.813 105.439 189.219 104.032Q190.626 102.625 191.387 100.788Q192.148 98.95 192.148 96.961Q192.148 94.972 191.387 93.134Q190.626 91.296 189.22 89.89L103.147 3.818Q101.741 2.411 99.903 1.65Q98.065 0.889 96.076 0.889Q94.087 0.889 92.249 1.65Q90.412 2.411 89.005 3.818Z"

Example

The tiger.json was serialized from gojs/samples/tiger

node example/anime-girl.js
SVG PNG

CC-BY-SA 3.0 by Niabot

CC-BY-SA 3.0 by Niabot

Building

Build skia from source

You can build this project from source, the system requirements are here: https://skia.org/docs/user/build

# Clone the code:
$ git clone --recurse-submodules https://github.com/Brooooooklyn/canvas.git
$ cd canvas

# Build Skia:
$ node scripts/build-skia.js

# Install NPM packages, build the Node.js addon:
$ npm install -g yarn
$ yarn install --mode=skip-build # Here are modules that are used for benchmarking and are hard to install, you can skip it by specifying `--mode=skip-build`
$ sudo dnf install clang # https://fedora.pkgs.org/34/fedora-x86_64/clang-12.0.0-0.3.rc1.fc34.x86_64.rpm.html
$ yarn build

# All done! Run test cases or examples now:
$ yarn test
$ node example/tiger.js

Pull pre-build skia binary from GitHub

You can pull skia pre-build binaries if you just care the Rust part:

# Clone the code:
$ git clone --recurse-submodules https://github.com/Brooooooklyn/canvas.git
$ cd canvas

# Download Skia binaries:
# It will pull the binaries match the git hash in `./skia` submodule
$ node scripts/release-skia-binary.mjs --download

# Install NPM packages, build the Node.js addon:
$ npm install -g yarn
$ yarn install --mode=skip-build
$ sudo dnf install clang # https://fedora.pkgs.org/34/fedora-x86_64/clang-12.0.0-0.3.rc1.fc34.x86_64.rpm.html
$ yarn build

# All done! Run test cases or examples now:
$ yarn test
$ node example/tiger.js

changelog

0.1.69 (2025-04-04)

Bug Fixes

Features

0.1.68 (2025-03-04)

Bug Fixes

0.1.67 (2025-02-08)

Bug Fixes

  • drawImage canvas implementation (#989) (1420291)
  • make sure SVGCanvas get content is complete (#990) (09120d1)

0.1.66 (2025-02-02)

Bug Fixes

Features

Performance Improvements

  • avoid memcpy while drawing canvas on canvas (#984) (8f00680)

0.1.65 (2024-12-02)

Bug Fixes

0.1.64 (2024-11-25)

Bug Fixes

0.1.63 (2024-11-23)

Bug Fixes

Features

0.1.62 (2024-11-15)

Bug Fixes

  • align the imageSmoothingQuality behavior with chrome (#942) (991edbb)

Features

0.1.61 (2024-11-13)

Features

  • after clearing, the bitmap should be cleared, and the width and height should be reset to the initial values. (#937) (e2a86fe)

0.1.60 (2024-11-07)

Bug Fixes

0.1.59 (2024-10-27)

Bug Fixes

Features

0.1.58 (2024-10-14)

Bug Fixes

  • loadImage memleak and performance issue (#914) (d4fd676)

0.1.57 (2024-10-14)

Bug Fixes

  • Creating canvas with width or height of zero or less (#739) (3a26c7d)
  • memory leak in Image/loadImage (#913) (527c0da)

Features

0.1.56 (2024-09-19)

Bug Fixes

  • ?? is error on node@10 (#889) (366d738)
  • adjust the order of onload calls (#898) (df6df8d)
  • deps: update rust crate napi to 3.0.0-alpha (d692f59)

0.1.55 (2024-09-04)

Bug Fixes

Features

0.1.54 (2024-08-17)

Bug Fixes

  • deps: update rust crate libavif to 0.14 (d5db090)
  • handle relative and invalid URLs in redirects when passing URL to loadImage() (#866) (1666a33), closes #865 #865
  • image decode should be async (#872) (713ca40)

Features

0.1.53 (2024-06-09)

Bug Fixes

Features

0.1.52 (2024-04-17)

Bug Fixes

Features

0.1.51 (2024-03-04)

Bug Fixes

  • deps: update rust crate base64 to 0.22 (84fd52f)
  • remove postinstall script for gnu/musl platform (#797) (d37da08)

0.1.50 (2024-02-26)

Features

  • support ctx.letterSpacing and ctx.wordSpacing (#794) (793d2a0)

0.1.49 (2024-02-22)

Bug Fixes

  • memory leak while encoding png from Canvas (#791) (3f17b38)

Features

0.1.48 (2024-02-21)

Bug Fixes

0.1.47 (2024-02-19)

Bug Fixes

0.1.46 (2024-02-19)

Bug Fixes

0.1.45 (2024-02-05)

Bug Fixes

  • use drawPicture in some blending modes such as destination-in (#755) (35f7f72), closes #695

Features

0.1.44 (2023-08-22)

Bug Fixes

  • file extensions in loadFontsFromDir() are no longer case-sensitive (9342e33)

0.1.43 (2023-08-11)

0.1.42 (2023-08-08)

Bug Fixes

Features

0.1.41 (2023-05-22)

Bug Fixes

0.1.40 (2023-04-09)

Features

0.1.39 (2023-03-14)

Bug Fixes

0.1.38 (2023-03-11)

Bug Fixes

  • deps: update rust crate infer to 0.13 (bad913c)

Features

0.1.37 (2023-02-27)

Bug Fixes

0.1.36 (2023-02-21)

Bug Fixes

  • recalc paint_x according to align if maxWidth is set (#639) (7f74567)

0.1.35 (2023-02-16)

Bug Fixes

0.1.34 (2023-01-12)

Bug Fixes

  • wrong text baseline calculation in drawText and measureText (#606) (bba0296)

0.1.33 (2023-01-08)

Bug Fixes

  • maxWidth overflow paint_x position should power the scale ratio (#603) (17c7902)

0.1.32 (2023-01-07)

Bug Fixes

  • getTransform should return DOMMatrix (#602) (fc576e9)

Features

0.1.31 (2023-01-02)

Bug Fixes

  • missing canvas property on Context2D (#597) (b0a351a)
  • multiple define on cached native object in jest (88f5ee9)

Features

0.1.30 (2022-09-22)

Bug Fixes

  • add Mutex guard to GlobalFont (7e0a51a)
  • ctx.globalAlpha should effect drawImage (#561) (9c505e2)
  • error listening to req (#555) (8491685)
  • resize canvas should clear the context (8ece352)
  • TypeScript types for avif config (29b17f8)
  • types: do not use reference tags (#563) (9e5cc29)

0.1.29 (2022-08-26)

Bug Fixes

  • data url should be standard base64 (a59cb40)
  • drawImage alpha should not effect by fillStyle (41a6f29)
  • isBufferLike in load-image.js (#536) (c6ad306)

Features

0.1.28 (2022-08-16)

Bug Fixes

  • adjust Node.js external memory while creating Canvas (77ecc52)

0.1.27 (2022-08-14)

Bug Fixes

0.1.26 (2022-08-07)

Bug Fixes

  • loadImage: redirect handler (dbbf826)
  • miss applying image_smoothing_enabled and image_smoothing_quality (815bc91)
  • shadow color was not applied correctly (4054e44)
  • test snapshots diff on arm64 (21983c2)
  • the quality of toDataURL should between 0 and 1 (27e87df)

Features

0.1.25 (2022-06-30)

Bug Fixes

  • missing load-image.js in package.json (ddb2419)

0.1.24 (2022-06-30)

Bug Fixes

  • ctx.filter should store in state and be able to save/restore (b85ee7b)
  • parameters for drawImage(canvas) (2392263)
  • skia async prop deprecated in future release (088e628)
  • use premultiplied surface as default (f13c1a3)
  • wrong text metrics if text contains chars not including in current font-family (cfcca26)

Features

0.1.23 (2022-06-23)

0.1.22 (2022-06-02)

Bug Fixes

  • do nothing if lineTo parameters invalid (0ddeb7c)
  • svg image transparent background should be preserved (531bde8)
  • width in TextMetrics when text is ending with spaces (5961fd2)
  • y offset when textBaseline is bottom (26fdc3c)

Features

0.1.21 (2022-03-10)

Bug Fixes

  • BlendMode::Source should be copy instead of source (a010fba)
  • prevent segmentation fault if mesuring empty text (2117ddb)
  • should not throw if fill/stroke style is invalid (0d12337)
  • stroke/fill text should treat \n as space (4c9ac1e)

0.1.20 (2022-02-15)

Bug Fixes

  • Fix the issue of arc to + bezier to + quad to at empty path case (33f8558)
  • scoot method for path empty case (a1eb529)
  • the quality default value case of encode(type, quality) method (#418) (c4950ea)

Features

0.1.19 (2021-12-31)

Bug Fixes

  • text align and font fallback (d80ac6b)

0.1.18 (2021-12-30)

Bug Fixes

  • reduce install size for linux glibc/musl (8e6c7e8)

Features

  • upgrade skia to chrome/m98 (99e3635)

0.1.17 (2021-12-12)

0.1.16 (2021-12-12)

Bug Fixes

  • make methods on ctx configurable & writable (affe82d)

Features

0.1.15 (2021-11-11)

Bug Fixes

  • vercel/nft and webpack compatible issue (f2e23f5)

0.1.14 (2021-10-26)

Bug Fixes

  • Now generating avif images is 10x+ faster. (407d1d1)
  • Use different quality for WebP and JPEG formats, which is more in line with the browser's default values. (fdefa5d)

Features

  • The option to generate avif removes alphaQuality and calculates it internally. (8de6e95)
  • Add a new SVG generation avif example. (04d401a)

0.1.13 (2021-10-20)

Bug Fixes

Features

0.1.12 (2021-10-15)

Features

  • support avif format output (f35b6ff)

0.1.11 (2021-09-30)

Features

  • support colorSpace: 'display-p3' (4b64310)

0.1.10 (2021-09-27)

Bug Fixes

  • image_filter to Image SamplingOptions conversion (0719022)

Features

  • implement filter for Context (6079927)

0.1.9 (2021-09-24)

Bug Fixes

  • aarch64-apple-darwin (macOS m1 chips) build [skip skia] (4deee73)

0.1.8 (2021-09-19)

0.1.7 (2021-09-14)

Bug Fixes

  • deps: update rust crate cssparser to 0.29 (36ff54f)
  • transform state between save/restore (d313b80)

0.1.6 (2021-08-25)

Bug Fixes

  • example to png (90edf49)
  • pass the fabric.js visual tests (ec55b3a)
  • strip start and end ' from font family (177e4f6)

Features

0.1.5 (2021-08-13)

Bug Fixes

  • default value of FilterQuality in SamplingOptions should be high (389aa26)

Features

0.1.4 (2021-08-11)

Features

  • scale svg image if need (72c404c)

0.1.3 (2021-08-06)

Bug Fixes

  • icudtl.dat download logic in publish job (f2bb048)

0.1.2 (2021-08-05)

Bug Fixes

  • Windows icudtl.data version and path (5c81eb7)

Features

  • implement convertSVGTextToPath function (9c7ca98)

0.1.1 (2021-08-02)

Bug Fixes

  • use viewbox as svg_container_size if width & height is empty (406a298)

Features

  • upgrade to skia/chrome/m93 latest (6ca9526)

0.1.0 (2021-07-30)

Bug Fixes

  • canvas.png() to canvas.encode('png') (b2d5afe)
  • multi font families (2e934a5)
  • sample image size update (8b0b147)

Features

  • add .asWinding() to convert the sample image of SVG filltype (f9f0d2b)
  • add basic measureText setup (e1fc0bf)
  • measureText with all textAlign and textBaseline (1891d76)
  • support register font with family name alias (4860c80)
  • support woff/woff2 fonts (70b7aa2)
  • svg canvas backend (f95f67a)

0.0.12 (2021-07-14)

Features

  • support raw pixels output (f502548)
  • support toDataURL and toDataURLAsync on canvas element (1d8c790)

0.0.11 (2021-07-13)

Features

  • support maxWidth in fillText and strokeText (ccf33f3)

0.0.10 (2021-07-12)

Bug Fixes

  • missing registerFromPath implementation (8bac515)

0.0.9 (2021-07-11)

Features

  • upgrade skia to chrome/m92 latest (584a02a)

0.0.8 (2021-06-23)

Features

0.0.7 (2021-06-21)

Bug Fixes

  • deps: update rust crate once_cell to 1.8 (c859162)
  • deps: update rust crate regex to 1.5 (1915c60)
  • JsArrayBuffer usage (b58e987)

Features

0.0.6 (2021-05-06)

Bug Fixes

  • windows setAssetFontManager crash (54861e9)

Features

  • add .editorconfig file (62dcf35)
  • add font collection singleton scaffold (9b7a00a)
  • support GlobalFonts.families (00be237)
  • support GlobalFonts.has (0461afc)
  • support GlobalFonts.register (295d507)

0.0.5 (2021-05-04)

Bug Fixes

  • path: wrong Stroke type cast and miterLimit default value (5f1761b)
  • add stroke to trim test to make it more visually recognizable (bddb3c6)

Features

0.0.4 (2021-04-19)

Bug Fixes

  • parse error for single font size rules (aa80fb7)

Features

  • path2d: implement pathkit functions (eea95bf)
  • skia chrome/m91, add back mimalloc (0420c14)

0.0.3 (2021-03-27)

Bug Fixes

  • wrong package name in index.js (e3c35bb)

0.0.2 (2021-03-27)

Bug Fixes

Features

Performance Improvements

  • disable image data copy (ccc8630)

0.0.1-alpha.3 (2021-01-06)

Features

  • properties in CanvasRenderContext2D (12727a7)
  • testing for context2d functions (107a650)

0.0.1-alpha.2 (2020-12-26)

Features

  • implement Path2D (91124d6)
  • support gradient in fill/stroke style (12e061c)

0.0.1-alpha.1 (2020-12-24)

Features

  • async/sync get png data from Canvas (f6d8cd6)

0.0.1-alpha.0 (2020-12-17)

Features