skia-canvas 0.9.28 β 1.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 +84 -8
- package/README.md +465 -103
- package/lib/browser.js +4 -3
- package/lib/css.js +40 -0
- package/lib/index.d.ts +84 -3
- package/lib/index.js +360 -43
- package/package.json +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
<!-- ## π₯ β© [Unreleased]
|
|
3
|
+
<!-- ## π₯ β© [Unreleased] -->
|
|
4
|
+
|
|
5
|
+
## π¦ β© [v1.0.0] β© Aug 5, 2022
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
- The new [Window][window] class can display a **Canvas** on screen, respond to mouse and keyboard input, and fluidly [animate][window_anim] by calling user-defined [event handlers][window_events].
|
|
9
|
+
- Bitmap rendering now occurs on the GPU by default and can be configured using the **Canvas**'s [`.gpu`][canvas_gpu] property. If the platform supports hardware-accelerated rendering (using Metal on macOS and Vulkan on Linux & Windows), the property will be `true` by default and can be set to `false` to use the software renderer.
|
|
10
|
+
- Added support for recent Chrome features:
|
|
11
|
+
- the [`reset()`][chrome_reset] context method which erases the canvas, resets the transformation state, and clears the current path
|
|
12
|
+
- the [`roundRect()`][chrome_rrect] 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)
|
|
13
|
+
|
|
14
|
+
### Bugfixes
|
|
15
|
+
- 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.
|
|
16
|
+
- The [`.drawCanvas()`][drawCanvas] routine now applies filter effects and shadows consistent with the current resolution and transformation state.
|
|
17
|
+
|
|
18
|
+
### Misc. Improvements
|
|
19
|
+
- The [`.filter`][filter] property's `"blur(β¦)"` and `"drop-shadow(β¦)"` effects now match browser behavior much more closely and scale appropriately with the `density` export option.
|
|
20
|
+
- Antialiasing is smoother, particularly when down-scaling images, thanks to the use of mipmaps rather than Skia's (apparently buggy?) implementation of bucubic interpolation.
|
|
21
|
+
- 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).
|
|
22
|
+
- Upgraded Skia to milestone 103
|
|
23
|
+
|
|
24
|
+
[window]: https://github.com/samizdatco/skia-canvas#window
|
|
25
|
+
[window_anim]: https://github.com/samizdatco/skia-canvas#events--animation
|
|
26
|
+
[window_events]: https://github.com/samizdatco/skia-canvas#on--off--once
|
|
27
|
+
[canvas_gpu]: https://github.com/samizdatco/skia-canvas#gpu
|
|
28
|
+
[filter]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter
|
|
29
|
+
[chrome_reset]: https://developer.chrome.com/blog/canvas2d/#context-reset
|
|
30
|
+
[chrome_rrect]: https://developer.chrome.com/blog/canvas2d/#round-rect
|
|
31
|
+
|
|
32
|
+
## π¦ β© [v0.9.30] β© Jun 7, 2022
|
|
33
|
+
|
|
34
|
+
### New Features
|
|
35
|
+
- Enhacements to the shared **FontLibrary** object:
|
|
36
|
+
- Added a [`reset()`][FontLibrary.reset] method to FontLibrary which uninstalls any fonts that had been dynamically installed via `FontLibrary.use()`
|
|
37
|
+
- The [`use()`][FontLibrary.use] method now checks for previously installed fonts with the same family name (or alias) and will replace them with the newly added font
|
|
38
|
+
- Added pre-compiled binaries for Alpine Linux on arm64
|
|
39
|
+
|
|
40
|
+
### Bugfixes
|
|
41
|
+
- Calling `clip` with an empty path (or one that does not intersect the current clipping mask) will now prevent drawing altogether
|
|
42
|
+
- Transformation (`translate`, `rotate`, etc.) and line-drawing methods (`moveTo`, `lineTo`, `ellipse`, etc.) are now silently ignored if called with `NaN`, `Infinity`, or non-**Number** values in the arguments rather than throwing an error
|
|
43
|
+
- applies to both the Context and Path2D versions of the drawing methods
|
|
44
|
+
- a **TypeError** is thrown only if the number of arguments is too low (mirroring browser behavior)
|
|
45
|
+
- [`conicCurveTo()`][conicCurveTo] now correctly reflects the canvas's transform state
|
|
46
|
+
- The browser-based version of [`loadImage()`][loadImage] now returns a **Promise** that correctly resolves to an **Image** object
|
|
47
|
+
- SVG exports no longer have an invisible, canvas-sized `<rect/>` as their first element
|
|
48
|
+
- 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
|
|
49
|
+
|
|
50
|
+
### Misc. Improvements
|
|
51
|
+
- Upgraded Skia to milestone 101
|
|
52
|
+
|
|
53
|
+
[conicCurveTo]: https://github.com/samizdatco/skia-canvas#coniccurvetocpx-cpy-x-y-weight
|
|
54
|
+
[FontLibrary.reset]: https://github.com/samizdatco/skia-canvas#reset
|
|
55
|
+
[FontLibrary.use]: https://github.com/samizdatco/skia-canvas#usefamilyname-fontpaths
|
|
56
|
+
[loadImage]: https://github.com/samizdatco/skia-canvas/#loadimage
|
|
57
|
+
|
|
58
|
+
## π¦ β© [v0.9.29] β© Feb 7, 2022
|
|
59
|
+
|
|
60
|
+
### New Features
|
|
61
|
+
- PDF exports now support the optional [`matte`][matte] argument.
|
|
62
|
+
|
|
63
|
+
### Breaking Changes
|
|
64
|
+
- When the [`drawImage()`][mdn_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 new [`drawCanvas()`][drawCanvas] method which supports the same numerical arguments as `drawImage` but requires that its first argument be a **Canvas**.
|
|
65
|
+
|
|
66
|
+
### Bugfixes
|
|
67
|
+
- Regions erased using [`clearRect()`][mdn_clearRect] are now properly antialiased
|
|
68
|
+
- The [`clip()`][mdn_clip] method now interprets the current translate/scale/rotate state correctly when combining clipping masks
|
|
69
|
+
|
|
70
|
+
### Misc. Improvements
|
|
71
|
+
- Upgraded Skia to milestone 97
|
|
72
|
+
|
|
73
|
+
[drawCanvas]: https://github.com/samizdatco/skia-canvas#drawcanvascanvas-x-y-
|
|
74
|
+
[mdn_clip]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
|
|
75
|
+
[mdn_clearRect]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clearRect
|
|
4
76
|
|
|
5
77
|
## π¦ β© [v0.9.28] β© Jan 12, 2022
|
|
6
78
|
|
|
@@ -10,7 +82,7 @@
|
|
|
10
82
|
- Colors can now use the [hwb()](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb()) model
|
|
11
83
|
|
|
12
84
|
### Breaking Changes
|
|
13
|
-
- The **Canvas** [`.async`](https://github.com/samizdatco/skia-canvas#async) property has been **deprecated** and will be removed in a future release.
|
|
85
|
+
- The **Canvas** [`.async`](https://github.com/samizdatco/skia-canvas#async) property has been **deprecated** and will be removed in a future release.
|
|
14
86
|
- The `saveAs`, `toBuffer`, and `toDataURL` methods will now be async-only (likewise the [shorthand properties](https://github.com/samizdatco/skia-canvas#pdf-svg-jpg-and-png)).
|
|
15
87
|
- Use their synchronous counterparts (`saveAsSync`, `toBufferSync`, and `toDataURLSync`) if you want to block execution while exporting images.
|
|
16
88
|
- 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
|
|
@@ -29,7 +101,7 @@
|
|
|
29
101
|
|
|
30
102
|
|
|
31
103
|
## π¦ β© [v0.9.27] β© Oct 23, 2021
|
|
32
|
-
|
|
104
|
+
|
|
33
105
|
### New Features
|
|
34
106
|
- Added pre-compiled binaries for Alpine Linux using the [musl](https://musl.libc.org) C library
|
|
35
107
|
|
|
@@ -41,7 +113,7 @@
|
|
|
41
113
|
|
|
42
114
|
### Bugfixes
|
|
43
115
|
- Windows text rendering has been restored after failing due to changes involving the `icudtl.dat` file
|
|
44
|
-
- `FontLibrary.use` now reports an error if the specified font file doesn't exist
|
|
116
|
+
- `FontLibrary.use` now reports an error if the specified font file doesn't exist
|
|
45
117
|
- Fixed a crash that could result from calling `measureText` with various unicode escapes
|
|
46
118
|
|
|
47
119
|
### Misc. Improvements
|
|
@@ -52,7 +124,7 @@
|
|
|
52
124
|
## π¦ β© [v0.9.25] β© Aug 22, 2021
|
|
53
125
|
|
|
54
126
|
### Bugfixes
|
|
55
|
-
- Improved image scaling when a larger image is being shrunk down to a smaller size via [`drawImage()`]
|
|
127
|
+
- Improved image scaling when a larger image is being shrunk down to a smaller size via [`drawImage()`][mdn_drawImage]
|
|
56
128
|
- 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`
|
|
57
129
|
- [`measureText()`](https://github.com/samizdatco/skia-canvas#measuretextstr-width) now returns correct metrics regardless of current `textAlign` setting
|
|
58
130
|
- Rolled back `icudtl.dat` changes on Windows (which suppressed the misleading warning message but required running as Administrator)
|
|
@@ -60,6 +132,7 @@
|
|
|
60
132
|
### Misc. Improvements
|
|
61
133
|
- Now using [Neon](https://github.com/neon-bindings/neon) v0.9 (with enhanced async event scheduling)
|
|
62
134
|
|
|
135
|
+
[mdn_drawImage]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
|
|
63
136
|
|
|
64
137
|
## π¦ β© [v0.9.24] β© Aug 18, 2021
|
|
65
138
|
|
|
@@ -106,7 +179,7 @@
|
|
|
106
179
|
### Misc. Improvements
|
|
107
180
|
|
|
108
181
|
- The `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.
|
|
109
|
-
- The file-export methods now accept a [`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-transparent
|
|
182
|
+
- The file-export methods now accept a [`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-transparent
|
|
110
183
|
- Canvas dimensions are no longer rounded-off to integer values (at least until a bitmap needs to be generated for export)
|
|
111
184
|
- Linux builds will now run on some older systems going back to glibc 2.24
|
|
112
185
|
|
|
@@ -133,7 +206,7 @@
|
|
|
133
206
|
### New Features
|
|
134
207
|
|
|
135
208
|
- Rasterization and file i/o are now handled asynchronously in a background thread. See the discussion of Canvasβs new [`async`](https://github.com/samizdatco/skia-canvas#async) property for details.
|
|
136
|
-
- 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`](https://github.com/samizdatco/skia-canvas#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`.
|
|
209
|
+
- 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`](https://github.com/samizdatco/skia-canvas#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`.
|
|
137
210
|
- SVG exports can optionally convert text to paths by setting the [`outline`](https://github.com/samizdatco/skia-canvas#outline) argument to `true`.
|
|
138
211
|
|
|
139
212
|
### Breaking Changes
|
|
@@ -182,7 +255,10 @@
|
|
|
182
255
|
|
|
183
256
|
**Initial public release** π
|
|
184
257
|
|
|
185
|
-
[unreleased]: https://github.com/samizdatco/skia-canvas/compare/
|
|
258
|
+
[unreleased]: https://github.com/samizdatco/skia-canvas/compare/v1.0.0...HEAD
|
|
259
|
+
[v1.0.0]: https://github.com/samizdatco/skia-canvas/compare/v0.9.30...v1.0.0
|
|
260
|
+
[v0.9.30]: https://github.com/samizdatco/skia-canvas/compare/v0.9.29...v0.9.30
|
|
261
|
+
[v0.9.29]: https://github.com/samizdatco/skia-canvas/compare/v0.9.28...v0.9.29
|
|
186
262
|
[v0.9.28]: https://github.com/samizdatco/skia-canvas/compare/v0.9.27...v0.9.28
|
|
187
263
|
[v0.9.27]: https://github.com/samizdatco/skia-canvas/compare/v0.9.26...v0.9.27
|
|
188
264
|
[v0.9.26]: https://github.com/samizdatco/skia-canvas/compare/v0.9.25...v0.9.26
|