skia-canvas 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +163 -40
- package/README.md +100 -1225
- package/lib/browser.js +311 -9
- package/lib/classes/canvas.js +272 -0
- package/lib/classes/context.js +282 -0
- package/lib/{css.js → classes/css.js} +65 -10
- package/lib/{geometry.js → classes/geometry.js} +195 -65
- package/lib/classes/gui.js +315 -0
- package/lib/classes/imagery.js +180 -0
- package/lib/classes/neon.js +69 -0
- package/lib/classes/path.js +110 -0
- package/lib/classes/typography.js +67 -0
- package/lib/index.d.ts +214 -33
- package/lib/index.js +15 -1062
- package/lib/index.mjs +24 -0
- package/package.json +22 -14
- package/lib/io.js +0 -312
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,111 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- ## 🥚 ⟩ [Unreleased] -->
|
|
4
4
|
|
|
5
|
+
## 📦 ⟩ [v2.0.0] ⟩ Dec 2, 2024
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
|
|
9
|
+
#### Website
|
|
10
|
+
- Documentation is now hosted at [skia-canvas.org](https://skia-canvas.org). Go there for a more readable version of all the details that used to be wedged into the README file.
|
|
11
|
+
|
|
12
|
+
#### Imagery
|
|
13
|
+
- Added initial SVG rendering support. **Image**s can now load SVG files and can be drawn in a resolution-independent manner via [`drawImage()`][mdn_drawImage] (thanks to @mpaperno #180). Note that **Image**s loaded from SVG files that don't have a `width` and `height` set on their root `<svg>` element have some quirks as of this release:
|
|
14
|
+
- The **Image** object's `height` will report being `150` and the `width` will be set to accurately capture the image's aspect ratio
|
|
15
|
+
- When passed to `drawImage()` without size arguments, the SVG will be scaled to a size that fits within the **Canvas**'s current bounds (using an approach akin to CSS's `object-fit: contain`).
|
|
16
|
+
- When using the 9-argument version of `drawImage()`, the ‘crop’ arguments (`sx`, `sy`, `sWidth`, & `sHeight`) will correspond to this scaled-to-fit size, *not* the **Image**'s reported `width` & `height`.
|
|
17
|
+
- WEBP support
|
|
18
|
+
- **Canvas**.[saveAs()][Canvas.saveAs] & [toBuffer()][Canvas.toBuffer] can now generate WEBP images and **Image**s can load WEBP files as well (contributed by @mpaperno #177, h/t @revam for the initial work on this)
|
|
19
|
+
- Raw pixel data support
|
|
20
|
+
- The `toBuffer()` and `saveAs()` methods now support `"raw"` as a format name and/or file extension, causing them to return non-encoded pixel data (by default in an `"rgba"` layout like a standard [ImageData][ImageData] buffer)
|
|
21
|
+
- Both functions now take an optional [`colorType`][colorType] argument to specify alternative pixel data layouts (e.g., `"rgb"` or `"bgra"`)
|
|
22
|
+
- [**ImageData**][ImageData] enhancements
|
|
23
|
+
- The [drawImage()][mdn_drawImage] and [createPattern()][mdn_createPattern] methods have been extended to accept **ImageData** objects as arguments. Previously only [putImageData()][mdn_putImageData] could be used for rendering, but this method ignores the context's current transform, filters, opacity, etc.
|
|
24
|
+
- When creating an **ImageData** via the [getImageData()][mdn_getImageData] & [createImageData()][mdn_createImageData] methods or `new ImageData()` constructor, the optional settings arg now allows you to select the `colorType` for the buffer's pixels.
|
|
25
|
+
|
|
26
|
+
#### Typography
|
|
27
|
+
- **FontLibrary.**[use()][FontLibrary.use] now supports dynamically loaded [WOFF & WOFF2][woff_wiki] fonts
|
|
28
|
+
- The [`outlineText()`][outline_text] method now takes an optional `width` argument and supports all the context's typographic settings (e.g., `.font`, `.fontVariant`, `.textWrap`, `.textTracking`, etc.)
|
|
29
|
+
- Fonts with condensed/expanded widths can now be selected with the [`.fontStretch`][fontStretch] property. Note that stretch values included in the `.font` string will overwrite the current `.fontStretch` setting (or will reset it to `normal` if omitted).
|
|
30
|
+
- Generic font family names are now mapped to fonts installed on the system. The `serif`, `sans-serif`, `monospace`, and `system-ui` families are currently supported.
|
|
31
|
+
- Underlines, overlines, and strike-throughs can now be set via the **Context**'s `.textDecoration` property.
|
|
32
|
+
- Text spacing can now be fine-tuned using the [`.letterSpacing`][letterSpacing] and [`.wordSpacing`][wordSpacing] properties.
|
|
33
|
+
|
|
34
|
+
#### GUI
|
|
35
|
+
- The [**Window**][window] class now has a [`resizable`][resizable] property which can be set to `false` to prevent the window from being manually resized or maximized (contributed by @nornagon #124).
|
|
36
|
+
- **Window** [event handlers][win_bind] now support Input Method Editor events for entering composed characters via the [compositionstart][compositionstart], [compositionupdate][compositionupdate], & [compositionend][compositionend] events. The [`input`][input] event now reports the composed character, not the individual keystrokes.
|
|
37
|
+
|
|
38
|
+
#### Rendering
|
|
39
|
+
- The **Canvas** object has a new `engine` property which describes whether the CPU or GPU is being used, which graphics device was selected, and what (if any) error prevented it from being initialized.
|
|
40
|
+
- The `.transform` and `.setTransform` methods on **Context**, **Path2D**, and **CanvasPattern** objects can now take their arguments in additional formats. They can now be passed a [**DOMMatrix**][DOMMatrix] object or a string with a list of transformation operations compatible with the [CSS `transform`][css_transform] property. The **DOMMatrix** constructor also supports these strings as well as plain, matrix-like objects with numeric attributes named `a`, `b`, `c`, `d`, `e`, & `f` (contributed by @mpaperno #178).
|
|
41
|
+
- The number of background threads used for asynchronous exports can now be controlled with the [`SKIA_CANVAS_THREADS`][multithreading] environment variable
|
|
42
|
+
|
|
43
|
+
### Breaking Changes
|
|
44
|
+
- An upgrade to [Neon][neon_rs] with [N-API v8][node_napi] raised the minimum required Node version to 12.22+, 14.17+, or 16+.
|
|
45
|
+
- Images now load asynchronously in cases where the `src` property has been set to a local path. As a result, it's now necessary to `await img.decode()` or set up an `.on("load", …)` handler before drawing it—even when the `src` is non-remote.
|
|
46
|
+
- The **KeyboardEvent** object returned by the `keyup`/`keydown` and `input` event listeners now has fields and values consistent with browser behavior. In particular, `code` is now a name (e.g., `ShiftLeft` or `KeyS`) rather than a numeric scancode, `key` is a straightforward label for the key (e.g., `Shift` or `s`) and the new [`location`][key_location] field provides a numeric description of which variant of a key was pressed.
|
|
47
|
+
- The deprecated `.async` property has been removed. See the [v0.9.28](#--v0928--jan-12-2022) release notes for details.
|
|
48
|
+
- The non-standard `.textTracking` property has been removed in favor of the new [`.letterSpacing`][letterSpacing] property
|
|
49
|
+
|
|
50
|
+
### Bugfixes
|
|
51
|
+
- Initializing a GPU-renderer using Vulkan now uses the [`vulkano`](https://crates.io/crates/vulkano) crate and makes better selections among devices present (previously it was just using the first result, which is not always optimal).
|
|
52
|
+
- The **Image**.onload callback now properly sets `this` to point to the new image (contributed by @mpaperno & @ForkKILLET).
|
|
53
|
+
- Creating a **Window** with `fullscreen` set to `true` now takes effect immediately (previously it was failing silently)
|
|
54
|
+
- Drawing paths after setting an invalid transform no longer crashes (contributed by @mpaperno #175)
|
|
55
|
+
- Windows with `.on("draw")` handlers no longer [become unresponsive](https://github.com/gfx-rs/gfx/issues/2460) on macOS 14+ after being fully occluded by other windows
|
|
56
|
+
- 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 #176)
|
|
57
|
+
- The `drawCanvas()` method now clips to the specified crop size (contributed by @mpaperno #179)
|
|
58
|
+
- Hit-testing with [`isPointInPath`][isPointInPath()] and [`isPointInStroke`][isPointInStroke()] now works correctly when called with a **Path2D** object as the first argument
|
|
59
|
+
|
|
60
|
+
### Misc. Improvements
|
|
61
|
+
- Upgraded Skia to [milestone 131](https://github.com/rust-skia/rust-skia/releases/tag/0.80.0)
|
|
62
|
+
- Added TypeScript definitions for the **Window** object’s event types (contributed by @saantonandre #163) and the `roundRect` method (contributed by @sandy85625 & @santilema)
|
|
63
|
+
- Performance improvements to **FontLibrary**, speeding up operations like listing families and adding new typefaces.
|
|
64
|
+
- Updated `winit` and replaced the end-of-life’d [skulpin](https://github.com/aclysma/skulpin)-based Vulkan renderer with a new implementation using Vulkano for window-drawing on Windows and Linux.
|
|
65
|
+
> It’s a fairly direct adaptation of Vulkano [sample code][vulkano_demo] for device setup with skia-specific rendering routines inspired by [@pragmatrix](https://github.com/pragmatrix)’s renderer for [emergent][pragmatrix_emergent]. All of which is to say, if you understand this better than I do I'd love some suggestions for improving the rendering setup.
|
|
66
|
+
- The GPU is now initialized only when it is needed, not at startup. As a result, setting that **Canvas**'s [`.gpu`][canvas_gpu] property to `false` immediately after creation will prevent any GPU-related resource acquisition from occurring (though rendering speed will be predictably slower).
|
|
67
|
+
- The sample-count used by the GPU for multiscale antialiasing can now be configured through the optional [`msaa`][msaa] export argument. If omitted, defaults to 4x MSAA.
|
|
68
|
+
- Added support for non-default imports (e.g., `import {Image} from "skia-canvas"`) when used as an ES Module.
|
|
69
|
+
- The [getImageData()][mdn_getImageData] method now makes use of the GPU (if enabled) and caches data between calls, greatly improving performance for sequential queries
|
|
70
|
+
|
|
71
|
+
[resizable]: /docs/api/window.md#resizable
|
|
72
|
+
[key_location]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location
|
|
73
|
+
[vulkano_demo]: https://github.com/vulkano-rs/vulkano/blob/master/examples/triangle/main.rs
|
|
74
|
+
[pragmatrix_emergent]: https://github.com/pragmatrix/emergent/blob/master/src/skia_renderer.rs
|
|
75
|
+
[woff_wiki]: https://en.wikipedia.org/wiki/Web_Open_Font_Format
|
|
76
|
+
[css_transform]: https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
77
|
+
[DOMMatrix]: https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix
|
|
78
|
+
[FontLibrary.use]: /docs/api/font-library.md#use
|
|
79
|
+
[Canvas.saveAs]: /docs/api/canvas.md#saveas
|
|
80
|
+
[Canvas.toBuffer]: /docs/api/canvas.md#tobuffer
|
|
81
|
+
[letterSpacing]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/letterSpacing
|
|
82
|
+
[wordSpacing]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/wordSpacing
|
|
83
|
+
[fontStretch]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fontStretch
|
|
84
|
+
[isPointInPath()]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath
|
|
85
|
+
[isPointInStroke()]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke
|
|
86
|
+
[node_napi]: https://nodejs.org/api/n-api.html#node-api-version-matrix
|
|
87
|
+
[neon_rs]: https://neon-rs.dev
|
|
88
|
+
[msaa]: /docs/api/canvas.md#msaa
|
|
89
|
+
[multithreading]: /docs/getting-started.md#multithreading
|
|
90
|
+
[compositionstart]: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event
|
|
91
|
+
[compositionupdate]: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionupdate_event
|
|
92
|
+
[compositionend]: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionend_event
|
|
93
|
+
[input]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event
|
|
94
|
+
[win_bind]: /docs/api/window.md#on--off--once
|
|
95
|
+
[ImageData]: /docs/api/imagedata.md
|
|
96
|
+
[colorType]: /docs/api/imagedata.md#colortype
|
|
97
|
+
[mdn_createPattern]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern
|
|
98
|
+
[mdn_getImageData]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData
|
|
99
|
+
[mdn_createImageData]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData
|
|
100
|
+
[mdn_putImageData]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData
|
|
101
|
+
|
|
102
|
+
## 📦 ⟩ [v1.0.2] ⟩ Aug 21, 2024
|
|
103
|
+
|
|
104
|
+
### Maintenance
|
|
105
|
+
- 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…
|
|
106
|
+
|
|
107
|
+
### Breaking Changes
|
|
108
|
+
- The 32-bit ARM-based linux builds are no longer provided pre-compiled; you'll now need to build from source.
|
|
109
|
+
|
|
5
110
|
## 📦 ⟩ [v1.0.1] ⟩ Oct 15, 2022
|
|
6
111
|
|
|
7
112
|
### Bugfixes
|
|
@@ -30,10 +135,10 @@
|
|
|
30
135
|
- 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).
|
|
31
136
|
- Upgraded Skia to milestone 103
|
|
32
137
|
|
|
33
|
-
[window]:
|
|
34
|
-
[window_anim]:
|
|
35
|
-
[window_events]:
|
|
36
|
-
[canvas_gpu]:
|
|
138
|
+
[window]: /docs/api/window.md
|
|
139
|
+
[window_anim]: /docs/api/window.md#events-for-animation
|
|
140
|
+
[window_events]: /docs/api/window.md#on--off--once
|
|
141
|
+
[canvas_gpu]: /docs/api/canvas.md#gpu
|
|
37
142
|
[filter]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter
|
|
38
143
|
[chrome_reset]: https://developer.chrome.com/blog/canvas2d/#context-reset
|
|
39
144
|
[chrome_rrect]: https://developer.chrome.com/blog/canvas2d/#round-rect
|
|
@@ -52,17 +157,15 @@
|
|
|
52
157
|
- applies to both the Context and Path2D versions of the drawing methods
|
|
53
158
|
- a **TypeError** is thrown only if the number of arguments is too low (mirroring browser behavior)
|
|
54
159
|
- [`conicCurveTo()`][conicCurveTo] now correctly reflects the canvas's transform state
|
|
55
|
-
- The browser-based version of [`loadImage()`][loadImage] now returns a **Promise** that correctly resolves to an **Image** object
|
|
160
|
+
- The browser-based version of [`loadImage()`][loadImage()] now returns a **Promise** that correctly resolves to an **Image** object
|
|
56
161
|
- SVG exports no longer have an invisible, canvas-sized `<rect/>` as their first element
|
|
57
162
|
- 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
|
|
58
163
|
|
|
59
164
|
### Misc. Improvements
|
|
60
165
|
- Upgraded Skia to milestone 101
|
|
61
166
|
|
|
62
|
-
[conicCurveTo]:
|
|
63
|
-
[FontLibrary.reset]:
|
|
64
|
-
[FontLibrary.use]: https://github.com/samizdatco/skia-canvas#usefamilyname-fontpaths
|
|
65
|
-
[loadImage]: https://github.com/samizdatco/skia-canvas/#loadimage
|
|
167
|
+
[conicCurveTo]: /docs/api/context.md#coniccurveto
|
|
168
|
+
[FontLibrary.reset]: /docs/api/font-library.md#reset
|
|
66
169
|
|
|
67
170
|
## 📦 ⟩ [v0.9.29] ⟩ Feb 7, 2022
|
|
68
171
|
|
|
@@ -79,7 +182,7 @@
|
|
|
79
182
|
### Misc. Improvements
|
|
80
183
|
- Upgraded Skia to milestone 97
|
|
81
184
|
|
|
82
|
-
[drawCanvas]:
|
|
185
|
+
[drawCanvas]: /docs/api/context.md#drawcanvas
|
|
83
186
|
[mdn_clip]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
|
|
84
187
|
[mdn_clearRect]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clearRect
|
|
85
188
|
|
|
@@ -87,12 +190,12 @@
|
|
|
87
190
|
|
|
88
191
|
### New Features
|
|
89
192
|
- Added TypeScript definitions for extensions to the DOM spec (contributed by [@cprecioso](https://github.com/cprecioso))
|
|
90
|
-
- Added 3D-perspective transformations via the new [createProjection()](
|
|
193
|
+
- Added 3D-perspective transformations via the new [createProjection()][createProjection()] context method
|
|
91
194
|
- Colors can now use the [hwb()](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb()) model
|
|
92
195
|
|
|
93
196
|
### Breaking Changes
|
|
94
|
-
- The **Canvas** [`.async`]
|
|
95
|
-
- The `saveAs`, `toBuffer`, and `toDataURL` methods will now be async-only (likewise the [shorthand properties]
|
|
197
|
+
- The **Canvas** [`.async`][async_depr] property has been **deprecated** and will be removed in a future release.
|
|
198
|
+
- The `saveAs`, `toBuffer`, and `toDataURL` methods will now be async-only (likewise the [shorthand properties][shorthands]).
|
|
96
199
|
- Use their synchronous counterparts (`saveAsSync`, `toBufferSync`, and `toDataURLSync`) if you want to block execution while exporting images.
|
|
97
200
|
- The [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData) constructor now orders its arguments properly: the optional buffer/array argument now comes first
|
|
98
201
|
|
|
@@ -109,6 +212,10 @@
|
|
|
109
212
|
- Added workflow for creating docker build environments
|
|
110
213
|
|
|
111
214
|
|
|
215
|
+
[createProjection()]: /docs/api/context.md#createprojection
|
|
216
|
+
[shorthands]: /docs/api/canvas.md#pdf-png-svg-jpg--webp
|
|
217
|
+
[async_depr]: https://github.com/samizdatco/skia-canvas/tree/v0.9.28#async
|
|
218
|
+
|
|
112
219
|
## 📦 ⟩ [v0.9.27] ⟩ Oct 23, 2021
|
|
113
220
|
|
|
114
221
|
### New Features
|
|
@@ -135,22 +242,29 @@
|
|
|
135
242
|
### Bugfixes
|
|
136
243
|
- Improved image scaling when a larger image is being shrunk down to a smaller size via [`drawImage()`][mdn_drawImage]
|
|
137
244
|
- modified [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality) settings to provide a more meaningful range across `low`, `medium`, and `high`
|
|
138
|
-
- [`measureText()`](
|
|
245
|
+
- [`measureText()`][measureText()] now returns correct metrics regardless of current `textAlign` setting
|
|
139
246
|
- Rolled back `icudtl.dat` changes on Windows (which suppressed the misleading warning message but required running as Administrator)
|
|
140
247
|
|
|
141
248
|
### Misc. Improvements
|
|
142
249
|
- Now using [Neon](https://github.com/neon-bindings/neon) v0.9 (with enhanced async event scheduling)
|
|
143
250
|
|
|
144
251
|
[mdn_drawImage]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
|
|
252
|
+
[measureText()]: /docs/api/context.md#measuretext
|
|
145
253
|
|
|
146
254
|
## 📦 ⟩ [v0.9.24] ⟩ Aug 18, 2021
|
|
147
255
|
|
|
148
256
|
### New Features
|
|
149
|
-
- **Path2D** objects now have a read/write [`d`]
|
|
150
|
-
- The [`createTexture()`](
|
|
257
|
+
- **Path2D** objects now have a read/write [`d`][p2d_d] property with an [SVG representation](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#path_commands) of the path’s contours and an [`unwind()`][p2d_undwind] method for converting from even-odd to non-zero winding rules
|
|
258
|
+
- The [`createTexture()`][createTexture()] context method returns **CanvasTexture** objects which can be assigned to `fillStyle` or `strokeStyle`
|
|
151
259
|
- Textures draw either a parallel-lines pattern or one derived from the provided **Path2D** object and positioning parameters
|
|
152
|
-
- The marker used when `setLineDash` is active can now be customized by assigning a **Path2D** to the context’s [`lineDashMarker`]
|
|
153
|
-
- The marker’s orientation & shape relative to the path being stroked can be controlled by the [`lineDashFit`]
|
|
260
|
+
- The marker used when `setLineDash` is active can now be customized by assigning a **Path2D** to the context’s [`lineDashMarker`][lineDashMarker] property (default dashing can be restored by assigning `null`)
|
|
261
|
+
- The marker’s orientation & shape relative to the path being stroked can be controlled by the [`lineDashFit`][lineDashFit] property which defaults to `"turn"` but can be set to `"move"` (which preserves orientation) or `"follow"` (which distorts the marker’s shape to match the contour)
|
|
262
|
+
|
|
263
|
+
[p2d_d]: /docs/api/path2d.md#d
|
|
264
|
+
[p2d_unwind]: /docs/api/path2d.md#unwind
|
|
265
|
+
[createTexture()]: /docs/api/context.md#createtexture
|
|
266
|
+
[lineDashMarker]: /docs/api/context.md#linedashmarker
|
|
267
|
+
[lineDashFit]: /docs/api/context.md#linedashfit
|
|
154
268
|
|
|
155
269
|
### Bugfixes
|
|
156
270
|
|
|
@@ -159,15 +273,14 @@
|
|
|
159
273
|
|
|
160
274
|
### Misc. Improvements
|
|
161
275
|
|
|
162
|
-
- The **Path2D** [`simplify()`]
|
|
276
|
+
- The **Path2D** [`simplify()`][simplify] method now takes an optional fill-rule argument
|
|
163
277
|
- Added support for versions of macOS starting with 10.13 (High Sierra)
|
|
164
278
|
|
|
165
|
-
|
|
166
279
|
## 📦 ⟩ [v0.9.23] ⟩ Jul 12, 2021
|
|
167
280
|
|
|
168
281
|
### New Features
|
|
169
282
|
|
|
170
|
-
- [Conic béziers][conic_bezier] can now be drawn to the context or a Path2D with the [`conicCurveTo()`][
|
|
283
|
+
- [Conic béziers][conic_bezier] can now be drawn to the context or a Path2D with the [`conicCurveTo()`][conicCurveTo] method
|
|
171
284
|
- Text can be converted to a Path2D using the context’s new [`outlineText()`][outline_text] method
|
|
172
285
|
- Path2D objects can now report back on their internal geometry with:
|
|
173
286
|
- the [`edges`][edges] property which contains an array of line-drawing commands describing the path’s individual contours
|
|
@@ -194,29 +307,29 @@
|
|
|
194
307
|
|
|
195
308
|
[conic_bezier]: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/curves/beziers#the-conic-bézier-curve
|
|
196
309
|
[conic_curveto]: https://github.com/samizdatco/skia-canvas#coniccurvetocpx-cpy-x-y-weight
|
|
197
|
-
[outline_text]:
|
|
198
|
-
[matte]:
|
|
310
|
+
[outline_text]: /docs/api/context.md#outlinetext
|
|
311
|
+
[matte]: /docs/api/canvas.md#matte
|
|
199
312
|
|
|
200
|
-
[edges]:
|
|
201
|
-
[contains]:
|
|
202
|
-
[points]:
|
|
203
|
-
[offset]:
|
|
204
|
-
[transform]:
|
|
313
|
+
[edges]: /docs/api/path2d.md#edges
|
|
314
|
+
[contains]: /docs/api/path2d.md#contains
|
|
315
|
+
[points]: /docs/api/path2d.md#points
|
|
316
|
+
[offset]: /docs/api/path2d.md#offset
|
|
317
|
+
[transform]: /docs/api/context.md#transform--settransform
|
|
205
318
|
|
|
206
|
-
[interpolate]:
|
|
207
|
-
[jitter]:
|
|
208
|
-
[round]:
|
|
209
|
-
[simplify]:
|
|
210
|
-
[trim]:
|
|
319
|
+
[interpolate]: /docs/api/path2d.md#interpolate
|
|
320
|
+
[jitter]: /docs/api/path2d.md#jitter
|
|
321
|
+
[round]: /docs/api/path2d.md#round
|
|
322
|
+
[simplify]: /docs/api/path2d.md#simplify
|
|
323
|
+
[trim]: /docs/api/path2d.md#trim
|
|
211
324
|
|
|
212
325
|
|
|
213
326
|
## 📦 ⟩ [v0.9.22] ⟩ Jun 09, 2021
|
|
214
327
|
|
|
215
328
|
### New Features
|
|
216
329
|
|
|
217
|
-
- Rasterization and file i/o are now handled asynchronously in a background thread. See the discussion of Canvas’s new [`async`]
|
|
218
|
-
- Output files can now be generated at pixel-ratios > 1 for High-DPI screens. `SaveAs` and the other canvas output functions all accept an optional [`density`]
|
|
219
|
-
- SVG exports can optionally convert text to paths by setting the [`outline`]
|
|
330
|
+
- Rasterization and file i/o are now handled asynchronously in a background thread. See the discussion of Canvas’s new [`async`][async_orig] property for details.
|
|
331
|
+
- Output files can now be generated at pixel-ratios > 1 for High-DPI screens. `SaveAs` and the other canvas output functions all accept an optional [`density`][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`.
|
|
332
|
+
- SVG exports can optionally convert text to paths by setting the [`outline`][outline] argument to `true`.
|
|
220
333
|
|
|
221
334
|
### Breaking Changes
|
|
222
335
|
|
|
@@ -228,6 +341,9 @@
|
|
|
228
341
|
- `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.
|
|
229
342
|
- Changed the way text rendering was staged so that SVG exports didn’t *entirely omit(!)* text from their output. As a result, `Context2D`s now use an external `Typesetter` struct to manage layout and rendering.
|
|
230
343
|
|
|
344
|
+
[density]: /docs/api/canvas.md#density
|
|
345
|
+
[outline]: /docs/api/canvas.md#outline
|
|
346
|
+
[async_orig]: https://github.com/samizdatco/skia-canvas/tree/v0.9.22#async
|
|
231
347
|
|
|
232
348
|
## 📦 ⟩ [v0.9.21] ⟩ May 22, 2021
|
|
233
349
|
|
|
@@ -235,9 +351,9 @@
|
|
|
235
351
|
- Now runs on Windows and Apple Silicon Macs.
|
|
236
352
|
- Precompiled binaries support Node 10, 12, 14+.
|
|
237
353
|
- Image objects can be initialized from PNG, JPEG, GIF, BMP, or ICO data.
|
|
238
|
-
- Path2D objects can now be combined using [boolean operators]
|
|
239
|
-
- Context objects now support [`createConicGradient()`](
|
|
240
|
-
- Image objects now return a promise from their [`decode()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode) method allowing for async loading without the [`loadImage`](
|
|
354
|
+
- Path2D objects can now be combined using [boolean operators][boolean-ops] and can measure their own [bounding boxes][p2d_bounds].
|
|
355
|
+
- Context objects now support [`createConicGradient()`][createConicGradient()].
|
|
356
|
+
- Image objects now return a promise from their [`decode()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode) method allowing for async loading without the [`loadImage`][loadImage()] helper.
|
|
241
357
|
|
|
242
358
|
### Bugfixes
|
|
243
359
|
- Calling `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).
|
|
@@ -250,6 +366,10 @@
|
|
|
250
366
|
- Added new test suites for `Path2D`, `Image`, and `Canvas`’s format support.
|
|
251
367
|
- Created [workflows](https://github.com/samizdatco/skia-canvas/tree/master/.github/workflows) to automate precompiled binary builds, testing, and npm package updating.
|
|
252
368
|
|
|
369
|
+
[boolean-ops]: /docs/api/path2d.md#complement-difference-intersect-union-and-xor
|
|
370
|
+
[p2d_bounds]: /docs/api/path2d.md#bounds
|
|
371
|
+
[createConicGradient()]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createConicGradient
|
|
372
|
+
[loadImage()]: /docs/api/image.md#loadimage
|
|
253
373
|
|
|
254
374
|
## 📦 ⟩ [v0.9.20] ⟩ Mar 27, 2021
|
|
255
375
|
|
|
@@ -264,7 +384,10 @@
|
|
|
264
384
|
|
|
265
385
|
**Initial public release** 🎉
|
|
266
386
|
|
|
267
|
-
[unreleased]: https://github.com/samizdatco/skia-canvas/compare/
|
|
387
|
+
[unreleased]: https://github.com/samizdatco/skia-canvas/compare/v2.0.0...HEAD
|
|
388
|
+
[v2.0.0]: https://github.com/samizdatco/skia-canvas/compare/v1.0.2...v2.0.0
|
|
389
|
+
[v1.0.2]: https://github.com/samizdatco/skia-canvas/compare/v1.0.1...v1.0.2
|
|
390
|
+
[v1.0.1]: https://github.com/samizdatco/skia-canvas/compare/v1.0.0...v1.0.1
|
|
268
391
|
[v1.0.0]: https://github.com/samizdatco/skia-canvas/compare/v0.9.30...v1.0.0
|
|
269
392
|
[v0.9.30]: https://github.com/samizdatco/skia-canvas/compare/v0.9.29...v0.9.30
|
|
270
393
|
[v0.9.29]: https://github.com/samizdatco/skia-canvas/compare/v0.9.28...v0.9.29
|