2018-12-07 13:29:52 +00:00
|
|
|
# CanvasKit Changelog
|
|
|
|
All notable changes to this project will be documented in this file.
|
|
|
|
|
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
|
|
|
|
|
## [Unreleased]
|
2020-02-04 19:18:38 +00:00
|
|
|
|
2021-01-07 16:14:13 +00:00
|
|
|
### Added
|
|
|
|
- Constants for the shadow flags. Of note, some of these values can be used on previous releases.
|
2021-01-13 19:16:58 +00:00
|
|
|
- `getShadowLocalBounds()` to estimate the bounds of the shadows drawn by `Canvas.drawShadow`.
|
2021-01-07 16:14:13 +00:00
|
|
|
|
2021-01-08 23:11:33 +00:00
|
|
|
### Breaking
|
|
|
|
- `MakeImprovedNoise` is removed.
|
|
|
|
|
2020-12-28 14:20:53 +00:00
|
|
|
### Fixed
|
|
|
|
- Improper error returned when a WebGL context could not be used.
|
2021-01-21 16:11:59 +00:00
|
|
|
- 4x4 matrices are "downsampled" properly if necessary to 3x3 matrices by removing the third
|
|
|
|
column and the third row.
|
2020-12-28 14:20:53 +00:00
|
|
|
|
2020-12-17 15:08:17 +00:00
|
|
|
## [0.22.0] - 2020-12-17
|
|
|
|
|
2020-12-16 21:00:55 +00:00
|
|
|
### Added
|
|
|
|
- `Canvas.drawImageCubic`, `Canvas.drawImageOptions`, `Canvas.drawImageRectCubic`,
|
|
|
|
`Canvas.drawImageRectOptions` to replace functionality that previously required FilterQuality.
|
2020-12-17 15:08:17 +00:00
|
|
|
- A copy of this changelog is published in NPM releases for easier discovery.
|
2020-12-16 21:00:55 +00:00
|
|
|
|
2020-12-17 14:58:32 +00:00
|
|
|
### Breaking
|
|
|
|
- `Canvas.drawImageNine` now takes a required FilterMode (the Paint still is optional).
|
|
|
|
|
2020-12-16 17:43:42 +00:00
|
|
|
## [0.21.0] - 2020-12-16
|
|
|
|
|
2020-11-18 16:23:15 +00:00
|
|
|
### Added
|
|
|
|
- `getImageInfo()` and `getColorSpace()` to the `Image` type.
|
2020-12-11 19:51:36 +00:00
|
|
|
- `CanvasKit.deleteContext()` for deleting WebGL contexts when done with them, resizing, etc.
|
|
|
|
- `Image.makeCopyWithDefaultMipmaps()` for use with `Image.makeShaderOptions`; necessary if
|
|
|
|
choosing a `MipmapMode` that is not `None`.
|
2020-11-18 16:23:15 +00:00
|
|
|
|
2020-12-04 14:10:39 +00:00
|
|
|
### Breaking
|
|
|
|
- `Path.addPoly()` no longer accepts a 2d array of points, but a flattened 1d array.
|
|
|
|
- `MakeVertices()` no longer accepts 2d arrays of points or texture coordinates, but
|
|
|
|
flattened 1d arrays in both places.
|
2020-12-11 19:51:36 +00:00
|
|
|
- `Paint.setFilterQuality`, `Paint.getFilterQuality`, `Image.makeShader` have been removed.
|
|
|
|
The new way to specify interpolation settings is with the newly added `Image.makeShader*`
|
|
|
|
methods. `Image.makeShaderCubic` is a replacement for high quality; `Image.makeShaderOptions`
|
|
|
|
is for medium/low.
|
2020-12-04 14:10:39 +00:00
|
|
|
|
2020-11-18 16:23:15 +00:00
|
|
|
### Changed
|
|
|
|
- `MakeImage` is now documented in the Typescript types (index.d.ts). The parameters have been
|
|
|
|
streamlined to align with other, similar APIs.
|
2020-12-03 19:17:31 +00:00
|
|
|
- `MakeAnimatedImageFromEncoded` respects Exif metadata. `MakeImageFromEncoded` already did so
|
|
|
|
(and continues to do so).
|
2020-12-11 19:51:36 +00:00
|
|
|
- The Canvas2D emulation layer always uses high quality image smoothing (this drastically
|
|
|
|
simplifies the underlying code).
|
2020-12-14 15:07:08 +00:00
|
|
|
- We now compile CanvasKit with emsdk 2.0.10 when testing and deploying to npm.
|
2020-12-14 15:41:59 +00:00
|
|
|
- Instead of shipping a "core" build to npm, we ship a "profiling" build, which is the same as
|
|
|
|
the main build, just with unmangled function calls and other debugging info useful for
|
|
|
|
determining where runtime is spent.
|
2020-11-18 16:23:15 +00:00
|
|
|
|
2020-12-01 19:55:02 +00:00
|
|
|
### Fixed
|
|
|
|
- `Canvas.drawPoints` correctly takes a flattened Array or TypedArray of points (as the
|
|
|
|
documentation says), not a 2D array.
|
|
|
|
|
2020-12-04 14:10:39 +00:00
|
|
|
### Type Changes (index.d.ts)
|
|
|
|
- Documented additional type for InputFlexibleColorArray.
|
|
|
|
|
2020-11-12 15:47:47 +00:00
|
|
|
## [0.20.0] - 2020-11-12
|
|
|
|
|
2020-11-18 16:23:15 +00:00
|
|
|
### Added
|
2020-10-15 17:09:02 +00:00
|
|
|
- `MakeFractalNoise`, `MakeImprovedNoise`, and `MakeTurbulence` have been added to
|
|
|
|
`CanvasKit.Shader`.
|
2020-11-04 12:23:37 +00:00
|
|
|
- `MakeRasterDirectSurface` for giving the user direct access to drawn pixels.
|
2020-11-04 14:46:22 +00:00
|
|
|
- `getLineMetrics` to Paragraph.
|
2020-11-03 22:13:09 +00:00
|
|
|
- `Canvas.saveLayerPaint` as an experimental, undocumented "fast path" if one only needs to pass
|
|
|
|
the paint.
|
2020-11-10 14:13:22 +00:00
|
|
|
- Support for .woff and .woff2 fonts. Disable .woff2 for reduced code size by supplying
|
|
|
|
no_woff2 to compile.sh. (This removes the code to do brotli decompression).
|
2020-10-15 17:09:02 +00:00
|
|
|
|
2020-10-09 14:55:06 +00:00
|
|
|
### Breaking
|
|
|
|
- `CanvasKit.MakePathFromSVGString` was renamed to `CanvasKit.Path.MakeFromSVGString`
|
|
|
|
- `CanvasKit.MakePathFromOp` was renamed to `CanvasKit.Path.MakeFromOp`
|
2020-11-06 18:05:37 +00:00
|
|
|
- The API for `Canvas.readPixels` and `Image.readPixels` has been reworked to more accurately
|
|
|
|
reflect the C++ backend and each other. bytesPerRow is now a required parameter. They take an
|
|
|
|
ImageInfo object to specify the output format. Additionally they take an optional malloc'd
|
|
|
|
object as the last parameter. If provided, the data will be copied into there instead of
|
|
|
|
allocating a new buffer.
|
2020-10-09 14:55:06 +00:00
|
|
|
|
2020-10-08 15:39:56 +00:00
|
|
|
### Changed
|
|
|
|
- We now compile CanvasKit with emsdk 2.0.6 when testing and deploying to npm.
|
2020-10-08 19:58:12 +00:00
|
|
|
- We no longer compile with rtti on, saving about 1% in code size.
|
2020-10-15 17:07:33 +00:00
|
|
|
- `CanvasKit.Shader.Blend`, `...Color`, and `...Lerp` have been renamed to
|
2020-10-15 17:09:02 +00:00
|
|
|
`CanvasKit.Shader.MakeBlend`, `...MakeColor` and `...MakeLerp` to align with naming conventions.
|
2020-10-15 17:07:33 +00:00
|
|
|
The old names will be removed in an upcoming release.
|
2020-10-08 15:39:56 +00:00
|
|
|
|
2020-10-09 14:55:06 +00:00
|
|
|
### Removed
|
|
|
|
- `CanvasKit.MakePathFromCmds`; Was deprecated in favor of `CanvasKit.Path.MakeFromCmds`.
|
|
|
|
- `new CanvasKit.Path(path)` in favor of existing `path.copy()`.
|
|
|
|
- Unused internal APIs (_getRasterN32PremulSurface, Drawable)
|
2020-11-11 18:03:06 +00:00
|
|
|
- `measureText` from the CanvasContext2D emulation layer du to deprecation of measureText.
|
|
|
|
|
|
|
|
### Deprecated
|
|
|
|
- `Font.getWidths` in favor of `Font.getGlyphIDs` and `Font.getGlyphWidths`.
|
|
|
|
- `Font.measureText` in favor of the Paragraph APIs (which actually do shaping).
|
2020-10-09 14:55:06 +00:00
|
|
|
|
|
|
|
### Type Changes (index.d.ts)
|
|
|
|
- Return value for MakeFromCmds correctly reflects the possibility of null.
|
2020-10-15 17:07:33 +00:00
|
|
|
- `CanvasKit.GrContext` was renamed to `CanvasKit.GrDirectContext`.
|
|
|
|
- Add docs/types for Shader Gradients (e.g. `CanvasKit.Shader.MakeLinearGradient`).
|
2020-10-09 14:55:06 +00:00
|
|
|
|
2020-10-08 12:35:05 +00:00
|
|
|
## [0.19.0] - 2020-10-08
|
|
|
|
|
2020-10-07 20:09:22 +00:00
|
|
|
### Breaking
|
|
|
|
- "Sk" has been removed from all names. e.g. `new CanvasKit.SkPaint()` becomes
|
2020-10-08 12:35:05 +00:00
|
|
|
`new CanvasKit.Paint()`. See `./types/index.d.ts` for all the new names.
|
2020-10-07 20:09:22 +00:00
|
|
|
|
|
|
|
### Removed
|
|
|
|
- `Surface.captureFrameAsSkPicture`; it was deprecated previously.
|
|
|
|
- `CanvasKit.MakeSkCornerPathEffect`, `CanvasKit.MakeSkDiscretePathEffect`,
|
|
|
|
`CanvasKit.MakeBlurMaskFilter`, `CanvasKit.MakeSkDashPathEffect`,
|
|
|
|
`CanvasKit.MakeLinearGradientShader`, `CanvasKit.MakeRadialGradientShader`,
|
|
|
|
`CanvasKit.MakeTwoPointConicalGradientShader`; these were deprecated previously and have
|
|
|
|
replacements like `CanvasKit.PathEffect.MakeDash`.
|
|
|
|
- `Canvas.concat44`; it was deprecated previously, just use `Canvas.concat`
|
|
|
|
|
2020-10-06 12:48:58 +00:00
|
|
|
## [0.18.1] - 2020-10-06
|
|
|
|
|
|
|
|
### Added
|
|
|
|
- Typescript types (and documentation) are now in the types subfolder. We will keep these updated
|
|
|
|
as we make changes to the CanvasKit library.
|
|
|
|
|
2020-10-05 11:56:19 +00:00
|
|
|
## [0.18.0] - 2020-10-05
|
|
|
|
|
2020-09-03 11:57:12 +00:00
|
|
|
### Breaking
|
2020-09-03 14:02:10 +00:00
|
|
|
- SkRect are no longer returned from `CanvasKit.LTRBRect`, `CanvasKit.XYWHRect` nor
|
|
|
|
are accepted as JS objects. Instead, the format is 4 floats in either an array, a
|
|
|
|
Float32Array or a piece of memory returned by CanvasKit.Malloc. These floats are the
|
|
|
|
left, top, right, bottom numbers of the rectangle.
|
|
|
|
- SkIRect (Rectangles with Integer values) are no longer accepted as JS objects.
|
|
|
|
Instead, the format is 4 ints in either an array, an Int32Array or a piece of memory
|
|
|
|
returned by CanvasKit.Malloc. These ints are the left, top, right, bottom numbers of
|
|
|
|
the rectangle.
|
2020-09-03 11:57:12 +00:00
|
|
|
- SkRRect (Rectangles with rounded corners) are no longer returned from `CanvasKit.RRectXY`
|
2020-09-03 14:02:10 +00:00
|
|
|
nor are accepted as JS objects. Instead, the format is 12 floats in either an array, a
|
2020-09-03 11:57:12 +00:00
|
|
|
Float32Array or a piece of memory returned by CanvasKit.Malloc. The first 4 floats
|
|
|
|
are the left, top, right, bottom numbers of the rectangle and then 4 sets of points
|
|
|
|
starting in the upper left corner and going clockwise. This change allows for faster
|
|
|
|
transfer between JS and WASM code.
|
2020-09-03 14:02:10 +00:00
|
|
|
- `SkPath.addRoundRect` has been replaced with `SkPath.addRRect`. The same functionality
|
|
|
|
can be had with the `CanvasKit.RRectXY` helper.
|
|
|
|
- `SkPath.addRect` no longer accepts 4 floats as separate arguments. It only accepts
|
|
|
|
an SkRect (an array/Float32Array of 4 floats) and an optional boolean for
|
|
|
|
determining clockwise or counter-clockwise directionality.
|
|
|
|
- The order of `SkCanvas.saveLayer` arguments is slightly different (more consistent).
|
|
|
|
It is now `paint, bounds, backdrop, flags`
|
2020-09-03 11:57:12 +00:00
|
|
|
|
2020-08-20 14:47:34 +00:00
|
|
|
### Changed
|
|
|
|
- We now compile CanvasKit with emsdk 2.0.0 when testing and deploying to npm.
|
2020-08-20 14:33:39 +00:00
|
|
|
- WebGL interface creation is a little leaner in terms of code size and speed.
|
2020-08-13 20:59:48 +00:00
|
|
|
- The signature of `main` used with SkSL passed to `CanvasKit.SkRuntimeEffect.Make` has changed.
|
|
|
|
There is no longer an `inout half4 color` parameter, effects must return their color instead.
|
|
|
|
Valid signatures are now `half4 main()` or `half4 main(float2 coord)`.
|
2020-09-03 14:02:10 +00:00
|
|
|
- `SkPath.getBounds`, `SkShapedText.getBounds`, and `SkVertices.bounds` now
|
|
|
|
take an optional argument. If a Float32Array with length 4 or greater is
|
|
|
|
provided, the bounds will be copied into this array instead of allocating
|
|
|
|
a new one.
|
2020-09-15 13:22:36 +00:00
|
|
|
- `SkCanvas.drawAnimatedImage` has been removed in favor of calling
|
|
|
|
`SkCanvas.drawImageAtCurrentFrame` or `SkAnimatedImage.makeImageAtCurrentFrame` and then
|
|
|
|
`SkCanvas.drawImage`.
|
2020-09-25 14:52:16 +00:00
|
|
|
- `SkTextBlob.MakeFromRSXform` also accepts a (possibly Malloc'd) Float32Array of RSXforms (
|
|
|
|
see SkRSXform for more.)
|
2020-09-03 14:02:10 +00:00
|
|
|
|
|
|
|
### Removed
|
|
|
|
- `SkCanvas.drawRoundRect` has been removed in favor of `SkCanvas.drawRRect`
|
|
|
|
The same functionality can be had with the `CanvasKit.RRectXY` helper.
|
|
|
|
- `SkPath.arcTo` which had been deprecated in favor of `SkPath.arcToOval`,
|
|
|
|
`SkPath.arcToRotated`, `SkPath.arcToTangent`.
|
2020-09-15 13:23:29 +00:00
|
|
|
- Extraneous ColorTypes from `ColorType` enum.
|
2020-09-03 14:02:10 +00:00
|
|
|
|
|
|
|
### Added
|
|
|
|
- `CanvasKit.LTRBiRect` and `CanvasKit.XYWHiRect` as helpers to create SkIRects.
|
2020-09-03 12:31:52 +00:00
|
|
|
- `SkCanvas.drawRect4f` as a somewhat experimental way to have array-free APIs for clients that
|
|
|
|
already have their own representation of Rect. This is experimental because we don't know
|
|
|
|
if it's faster/better under real-world use and because we don't want to commit to having these
|
|
|
|
for all Rect APIs (and for similar types) until it has baked in a bit.
|
2020-10-02 22:24:13 +00:00
|
|
|
- Added the following to `TextStyle`:
|
|
|
|
- `decorationStyle`
|
|
|
|
- `textBaseline`
|
|
|
|
- `letterSpacing`
|
|
|
|
- `wordSpacing`
|
|
|
|
- `heightMultiplier`
|
|
|
|
- `locale`
|
|
|
|
- `shadows`
|
|
|
|
- `fontFeatures`
|
|
|
|
- Added `strutStyle` to `ParagraphStyle`.
|
|
|
|
- Added `addPlaceholder` to `ParagraphBuilder`.
|
|
|
|
- Added `getRectsForPlaceholders` to `Paragraph`.
|
2020-09-25 14:52:16 +00:00
|
|
|
- `SkFont.getGlyphIDs`, `SkFont.getGlyphBounds`, `SkFont.getGlyphWidths` for turning code points
|
|
|
|
into GlyphIDs and getting the associated metrics with those glyphs. Note: glyph ids are only
|
|
|
|
valid for the font of which they were requested.
|
|
|
|
- `SkTextBlob.MakeFromRSXformGlyphs` and `SkTextBlob.MakeFromGlyphs` as a way to build TextBlobs
|
|
|
|
using GlyphIDs instead of code points.
|
|
|
|
- `CanvasKit.MallocGlyphIDs` as a helper for pre-allocating space on the WASM heap for Glyph IDs.
|
2020-08-20 14:47:34 +00:00
|
|
|
|
2020-09-15 13:22:36 +00:00
|
|
|
### Deprecated
|
|
|
|
- `SkAnimatedImage.getCurrentFrame`; prefer `SkAnimatedImage.makeImageAtCurrentFrame` (which
|
|
|
|
follows the establishing naming convention).
|
2020-09-29 21:51:57 +00:00
|
|
|
- `SkSurface.captureFrameAsSkPicture` will be removed in a future release. Callers can simply
|
|
|
|
use `SkPictureRecorder` directly.
|
2020-09-29 21:58:21 +00:00
|
|
|
- `CanvasKit.FourFloatArrayHelper` and related helpers (mostly helping with drawAtlas).
|
|
|
|
`CanvasKit.Malloc` is the better tool and will replace these soon.
|
2020-10-02 18:59:28 +00:00
|
|
|
- `SkPathMeasure`; SkContourMeasureIter has all the same functionality and a cleaner pattern.
|
2020-09-15 13:22:36 +00:00
|
|
|
|
2020-09-25 14:52:16 +00:00
|
|
|
### Fixed
|
|
|
|
- Addressed Memory leak in `SkCanvas.drawText`.
|
|
|
|
- Made SkTextBlob hang on to less memory during its lifetime.
|
2020-10-01 14:55:16 +00:00
|
|
|
- `SkPath.computeTightBounds()` works again. Like getBounds() it takes an optional argument
|
|
|
|
to put the bounds into.
|
2020-09-25 14:52:16 +00:00
|
|
|
|
2020-08-05 14:46:45 +00:00
|
|
|
## [0.17.3] - 2020-08-05
|
|
|
|
|
2020-08-04 20:21:09 +00:00
|
|
|
### Added
|
|
|
|
- Added `CanvasKit.TypefaceFontProvider`, which can be used to register fonts
|
|
|
|
with a font family alias. For example, "Roboto Light" may be registered with
|
|
|
|
the alias "Roboto", and it will be used when "Roboto" is used with a light
|
|
|
|
font weight.
|
|
|
|
- Added `CanvasKit.ParagraphBuilder.MakeFromFontProvider` to make a
|
|
|
|
`ParagraphBuilder` from a `TypefaceFontProvider`.
|
2020-08-05 14:46:45 +00:00
|
|
|
- Added `CanvasKit.ParagraphBuilder.pushPaintStyle` which can be used to stroke or fill
|
|
|
|
text with paints instead of simple colors.
|
2020-08-04 20:21:09 +00:00
|
|
|
|
2020-07-22 17:14:26 +00:00
|
|
|
## [0.17.2] - 2020-07-22
|
|
|
|
|
|
|
|
### Fixed
|
2020-07-21 21:55:20 +00:00
|
|
|
- Shader programs are no longer generated with `do-while` loops in WebGL 1.0.
|
|
|
|
|
2020-07-21 14:31:50 +00:00
|
|
|
## [0.17.1] - 2020-07-21
|
|
|
|
|
2020-07-20 14:32:40 +00:00
|
|
|
### Added
|
|
|
|
- Compile option to deserialize effects in skps `include_effects_deserialization`.
|
2020-07-21 14:31:50 +00:00
|
|
|
|
2020-07-20 14:32:40 +00:00
|
|
|
### Changed
|
2020-08-20 14:47:34 +00:00
|
|
|
- Pathops and SKP deserialization/serialization enabled on the npm build.
|
2020-07-20 14:32:40 +00:00
|
|
|
|
2020-07-20 14:10:14 +00:00
|
|
|
## [0.17.0] - 2020-07-20
|
|
|
|
|
Added CanvasKit.MakeImageFromCanvasImageSource which is useful as an alternative to
CanvasKit.MakeImageFromEncoded, when used with Browser APIs for loading/decoding images.
- `CanvasKit.MakeImageFromCanvasImageSource` takes either an HTMLImageElement,
SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas and returns
an SkImage. This function is an alternative to `CanvasKit.MakeImageFromEncoded` for creating
SkImages when loading and decoding images. In the future, codesize of CanvasKit may be able to be
reduced by removing image codecs in wasm, if browser APIs for decoding images are used along with
`CanvasKit.MakeImageFromCanvasImageSource` instead of `CanvasKit.MakeImageFromEncoded`.
- Three usage examples of `CanvasKit.MakeImageFromCanvasImageSource` in core.spec.ts. These
examples use browser APIs to decode images including 2d canvas, bitmaprenderer canvas,
HTMLImageElement and Blob.
- Added support for asynchronous callbacks in perfs and tests.
Here are notes on the image decoding approaches we tested and perfed in the process of finding ways
to use Browser APIs to decode images:
1. pipeline:
ArrayBuffer → ImageData → ctx.putImageData →
context.getImageData → Uint8Array → CanvasKit.MakeImage
❌ Problem: ImageData constructor expects decoded bytes already.
2. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded (async function)
pipeline:
ArrayBuffer → Blob -> HTMLImageElement ->
draw on Canvas2d -> context.getImageData → Uint8Array →
CanvasKit.MakeImage
✅ Works
⏱ Performance: 3rd place (in my testing locally)
3. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2 (async function)
ArrayBuffer → Blob → ImageBitmap → draw on Canvas2d →
context.getImageData → Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 2nd place (in my testing locally)
4. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded3 (async function)
ArrayBuffer → Blob → ImageBitmap →
draw on canvas 1 using bitmaprenderer context →
draw canvas 1 on canvas 2 using drawImage → context2d.getImageData →
Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 1st place (in my testing locally) - quite surprising, this in some ways seems to be a more roundabout way of CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2, but it seems bitmaprenderer context is fairly fast.
Bug: skia:10360
Change-Id: I6fe94b8196dfd1ad0d8929f04bb1697da537ca18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295390
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-15 18:53:27 +00:00
|
|
|
### Added
|
|
|
|
- Added `CanvasKit.MakeImageFromCanvasImageSource` which takes either an HTMLImageElement,
|
|
|
|
SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas and returns
|
|
|
|
an SkImage. This function is an alternative to `CanvasKit.MakeImageFromEncoded` for creating
|
|
|
|
SkImages when loading and decoding images. In the future, codesize of CanvasKit may be able to be
|
|
|
|
reduced by removing image codecs in wasm, if browser APIs for decoding images are used along with
|
|
|
|
`CanvasKit.MakeImageFromCanvasImageSource` instead of `CanvasKit.MakeImageFromEncoded`.
|
2020-06-23 20:58:10 +00:00
|
|
|
- Three usage examples of `CanvasKit.MakeImageFromCanvasImageSource` in core.spec.ts.
|
|
|
|
- Added support for asynchronous callbacks in perfs and tests.
|
|
|
|
- `CanvasKit.SkPath.MakeFromVerbsPointsWeights` and `CanvasKit.SkPath.addVerbsPointsWeights` for
|
|
|
|
supplying many path operations (e.g. moveTo, cubicTo) at once.
|
|
|
|
- The object returned by `CanvasKit.malloc` now has a `subarray` method which works exactly like
|
|
|
|
the normal TypedArray version. The TypedArray which it returns is also backed by WASM memory
|
|
|
|
and when passed into CanvasKit will be used w/o copying the data (just like
|
|
|
|
`Malloc.toTypedArray`).
|
2020-07-06 23:50:13 +00:00
|
|
|
- `SkM44.setupCamera` to return a 4x4 matrix which sets up a perspective view from a camera.
|
2020-07-15 20:46:17 +00:00
|
|
|
- `SkPath.arcToOval`, `SkPath.arcToTangent`, and `SkPath.arcToRotated` to replace the three
|
|
|
|
overloads of `SkPath.arcTo`. https://github.com/flutter/flutter/issues/61305
|
Added CanvasKit.MakeImageFromCanvasImageSource which is useful as an alternative to
CanvasKit.MakeImageFromEncoded, when used with Browser APIs for loading/decoding images.
- `CanvasKit.MakeImageFromCanvasImageSource` takes either an HTMLImageElement,
SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas and returns
an SkImage. This function is an alternative to `CanvasKit.MakeImageFromEncoded` for creating
SkImages when loading and decoding images. In the future, codesize of CanvasKit may be able to be
reduced by removing image codecs in wasm, if browser APIs for decoding images are used along with
`CanvasKit.MakeImageFromCanvasImageSource` instead of `CanvasKit.MakeImageFromEncoded`.
- Three usage examples of `CanvasKit.MakeImageFromCanvasImageSource` in core.spec.ts. These
examples use browser APIs to decode images including 2d canvas, bitmaprenderer canvas,
HTMLImageElement and Blob.
- Added support for asynchronous callbacks in perfs and tests.
Here are notes on the image decoding approaches we tested and perfed in the process of finding ways
to use Browser APIs to decode images:
1. pipeline:
ArrayBuffer → ImageData → ctx.putImageData →
context.getImageData → Uint8Array → CanvasKit.MakeImage
❌ Problem: ImageData constructor expects decoded bytes already.
2. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded (async function)
pipeline:
ArrayBuffer → Blob -> HTMLImageElement ->
draw on Canvas2d -> context.getImageData → Uint8Array →
CanvasKit.MakeImage
✅ Works
⏱ Performance: 3rd place (in my testing locally)
3. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2 (async function)
ArrayBuffer → Blob → ImageBitmap → draw on Canvas2d →
context.getImageData → Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 2nd place (in my testing locally)
4. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded3 (async function)
ArrayBuffer → Blob → ImageBitmap →
draw on canvas 1 using bitmaprenderer context →
draw canvas 1 on canvas 2 using drawImage → context2d.getImageData →
Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 1st place (in my testing locally) - quite surprising, this in some ways seems to be a more roundabout way of CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2, but it seems bitmaprenderer context is fairly fast.
Bug: skia:10360
Change-Id: I6fe94b8196dfd1ad0d8929f04bb1697da537ca18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295390
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-15 18:53:27 +00:00
|
|
|
|
2020-06-11 12:44:20 +00:00
|
|
|
### Changed
|
|
|
|
- In all places where color arrays are accepted (gradient makers, drawAtlas, and MakeSkVertices),
|
2020-07-17 15:11:28 +00:00
|
|
|
You can now provide either flat Float32Arrays of float colors, Uint32Arrays of int colors, or
|
2020-06-11 12:44:20 +00:00
|
|
|
2d Arrays of Float32Array(4) colors. The one thing you should not pass is an Array of numbers,
|
|
|
|
since canvaskit wouldn't be able to tell whether they're ints or floats without checking them all.
|
|
|
|
The fastest choice for gradients is the flat Float32Array, the fastest choice for drawAtlas and
|
|
|
|
MakeSkVertices is the flat Uint32Array.
|
|
|
|
- Color arrays may also be objects created with CanvasKit.Malloc
|
2020-07-17 14:28:36 +00:00
|
|
|
- renamed `reportBackendType` to `reportBackendTypeIsGPU` and made it return a boolean
|
2020-07-17 19:20:44 +00:00
|
|
|
- `MakeWebGLCanvasSurface` can now accept an optional dictionary of WebGL context attributes that
|
|
|
|
can be used to override default attributes.
|
2020-07-20 14:10:14 +00:00
|
|
|
|
2020-06-11 17:48:16 +00:00
|
|
|
### Fixed
|
|
|
|
- `TextStyle.color` can correctly be a Malloc'd Float32Array.
|
2020-07-17 15:11:28 +00:00
|
|
|
- Support wombat-dressing-room. go/npm-publish
|
|
|
|
|
2020-06-23 20:58:10 +00:00
|
|
|
### Deprecated
|
|
|
|
- `CanvasKit.MakePathFromCmds` has been renamed to `CanvasKit.SkPath.MakeFromCmds`. The alias
|
|
|
|
will be removed in an upcoming release.
|
2020-07-15 20:46:17 +00:00
|
|
|
- `SkPath.arcTo` Separated into three functions.
|
2020-06-11 17:48:16 +00:00
|
|
|
|
2020-06-05 21:08:01 +00:00
|
|
|
## [0.16.2] - 2020-06-05
|
|
|
|
|
[canvaskit] Fix infrequent crash in SkFontMgr.FromData
The bug here is very subtle, as is the mitigation.
Quick background on WASM memory, there is an object
called wasmMemory (which might be hoisted into scope for
CanvasKit's pre-js functions), of type WebAssembly.Memory
which is a resizable ArrayBuffer. Emscripten provides the
JS code to initialize this and handle size increases.
Emscripten also provides TypedArray "views" into this buffer.
These are called CanvasKit.HEAPU8, CanvasKit.HEAPF32, etc.
When there is a call to CanvasKit._malloc, wasmMemory may
be resized. If that happens, the previous TypedArray views
become invalid. However, in the same call to _malloc,
emscripten will refresh the views [1]. So, dealing with
CanvasKit.HEAPU8 directly (quick aside, we never expect clients
to mess with these views, only us in our glue JS code
[e.g. interface.js]), should always be safe because if they
were to be invalidated in a call to _malloc, the views would
be refreshed before _malloc continues.
The problem that existed before was when we were passing
CanvasKit.HEAP* as a parameter to a function, in which the
function would call _malloc before using the typed array
parameter:
//... let us suppose wasmMemory is backed by ArrayBuffer D
copy1dArray(arr, HEAPU32);
// The HEAPU32 TypedArray (backed by ArrayBuffer D) is stored
// to a function parameter "dest"
function copy1dArray(arr, dest, ptr) {
// ...
if (!ptr) {
ptr = CanvasKit._malloc(arr.length * dest.BYTES_PER_ELEMENT);
// Suppose _malloc needs to resize wasmMemory and is
// now backed by ArrayBuffer E.
// Note: The field CanvasKit.HEAPU32 is correctly backed
// by ArrayBuffer E, but variable dest still points to a
// TypedArray backed by ArrayBuffer D.
}
// dest.set will fail with a "neutered ArrayBuffer" error
// because ArrayBuffer D is effectively gone (replaced by E).
dest.set(arr, ptr / dest.BYTES_PER_ELEMENT);
The fix here is to pass in the field name indicating the TypedArray
view we want to write our data into instead of using the
view itself as the parameter.
[1] https://github.com/emscripten-core/emscripten/blob/e4271595539cf1ca81128280cdc72f7245e700a0/src/preamble.js#L344
Change-Id: I46cfb98f8bdf928b61690a5ced034a5961356398
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294516
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-05 11:13:48 +00:00
|
|
|
### Fixed
|
|
|
|
- A bug where loading fonts (and other memory intensive calls) would cause CanvasKit
|
|
|
|
to infrequently crash with
|
2020-06-05 19:58:01 +00:00
|
|
|
`TypeError: Cannot perform %TypedArray%.prototype.set on a neutered ArrayBuffer`.
|
|
|
|
- Incorrectly freeing Malloced colors passed into computeTonalColors.
|
[canvaskit] Fix infrequent crash in SkFontMgr.FromData
The bug here is very subtle, as is the mitigation.
Quick background on WASM memory, there is an object
called wasmMemory (which might be hoisted into scope for
CanvasKit's pre-js functions), of type WebAssembly.Memory
which is a resizable ArrayBuffer. Emscripten provides the
JS code to initialize this and handle size increases.
Emscripten also provides TypedArray "views" into this buffer.
These are called CanvasKit.HEAPU8, CanvasKit.HEAPF32, etc.
When there is a call to CanvasKit._malloc, wasmMemory may
be resized. If that happens, the previous TypedArray views
become invalid. However, in the same call to _malloc,
emscripten will refresh the views [1]. So, dealing with
CanvasKit.HEAPU8 directly (quick aside, we never expect clients
to mess with these views, only us in our glue JS code
[e.g. interface.js]), should always be safe because if they
were to be invalidated in a call to _malloc, the views would
be refreshed before _malloc continues.
The problem that existed before was when we were passing
CanvasKit.HEAP* as a parameter to a function, in which the
function would call _malloc before using the typed array
parameter:
//... let us suppose wasmMemory is backed by ArrayBuffer D
copy1dArray(arr, HEAPU32);
// The HEAPU32 TypedArray (backed by ArrayBuffer D) is stored
// to a function parameter "dest"
function copy1dArray(arr, dest, ptr) {
// ...
if (!ptr) {
ptr = CanvasKit._malloc(arr.length * dest.BYTES_PER_ELEMENT);
// Suppose _malloc needs to resize wasmMemory and is
// now backed by ArrayBuffer E.
// Note: The field CanvasKit.HEAPU32 is correctly backed
// by ArrayBuffer E, but variable dest still points to a
// TypedArray backed by ArrayBuffer D.
}
// dest.set will fail with a "neutered ArrayBuffer" error
// because ArrayBuffer D is effectively gone (replaced by E).
dest.set(arr, ptr / dest.BYTES_PER_ELEMENT);
The fix here is to pass in the field name indicating the TypedArray
view we want to write our data into instead of using the
view itself as the parameter.
[1] https://github.com/emscripten-core/emscripten/blob/e4271595539cf1ca81128280cdc72f7245e700a0/src/preamble.js#L344
Change-Id: I46cfb98f8bdf928b61690a5ced034a5961356398
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294516
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-05 11:13:48 +00:00
|
|
|
|
2020-06-04 14:35:19 +00:00
|
|
|
## [0.16.1] - 2020-06-04
|
|
|
|
|
2020-06-04 12:25:16 +00:00
|
|
|
### Fixed
|
2020-06-04 14:35:19 +00:00
|
|
|
- Colors are unsigned to be compatible with Flutter Web and previous behavior, not
|
2020-06-04 12:25:16 +00:00
|
|
|
signed ints.
|
|
|
|
|
2020-06-03 18:14:17 +00:00
|
|
|
## [0.16.0] - 2020-06-03
|
|
|
|
|
2020-05-26 17:10:20 +00:00
|
|
|
### Added
|
|
|
|
- Support for wide-gamut color spaces DisplayP3 and AdobeRGB. However, correct representation on a
|
|
|
|
WCG monitor requires that the browser is rendering everything to the DisplayP3 or AdobeRGB
|
|
|
|
profile, since there is not yet any way to indicate to the browser that a canvas element has a
|
|
|
|
non-sRGB color space. See color support example in extra.html. Only supported for WebGL2 backed
|
|
|
|
surfaces.
|
|
|
|
- Added `SkSurface.reportBackendType` which returns either 'CPU' or 'GPU'.
|
|
|
|
- Added `SkSurface.imageInfo` which returns an ImageInfo object describing the size and color
|
|
|
|
properties of the surface. colorSpace is added to ImageInfo everywhere it is used.
|
2020-05-28 18:43:38 +00:00
|
|
|
- `CanvasKit.Free` to explicitly clean up memory after `CanvasKit.Malloc`. All memory allocated
|
|
|
|
with `CanvasKit.Malloc` must be released with `CanvasKit.Free` or it will be leaked. This can
|
|
|
|
improve performance by reducing the copying of data between the JS and WASM side.
|
2020-06-02 20:15:23 +00:00
|
|
|
- `CanvasKit.ColorAsInt`, `SkPaint.setColorComponents`, `SkPaint.setColorInt`,
|
|
|
|
`SkCanvas.drawColorComponents`, `SkCanvas.drawColorInt` for when clients want
|
|
|
|
to avoid the overhead of allocating an array for color components and only need 8888 color.
|
2020-05-26 17:10:20 +00:00
|
|
|
|
2020-05-21 13:59:44 +00:00
|
|
|
### Changed
|
2020-05-26 17:10:20 +00:00
|
|
|
- We now compile/ship with Emscripten v1.39.16.
|
|
|
|
- `CanvasKit.MakeCanvasSurface` accepts a new enum specifying one of the three color space and
|
2020-05-28 18:43:38 +00:00
|
|
|
pixel format combinations supported by CanvasKit.
|
2020-05-26 17:10:20 +00:00
|
|
|
- all `_Make*Shader` functions now accept a color space argument at the end. leaving it off or
|
|
|
|
passing null makes it behave as it did before, defaulting to sRGB
|
|
|
|
- `SkPaint.setColor` accepts a new color space argument, defaulting to sRGB.
|
2020-06-01 19:43:03 +00:00
|
|
|
- Fewer allocations required to send Color and Matrices between JS and WASM layer.
|
|
|
|
- All APIs that take a 1 dimensional array should also accept the object returned by Malloc. It is
|
|
|
|
recommended to pass the Malloc object, as the TypedArray could be invalidated any time
|
|
|
|
CanvasKit needs to allocate memory and needs to resize to accommodate.
|
2020-05-21 13:59:44 +00:00
|
|
|
|
|
|
|
### Breaking
|
|
|
|
- `CanvasKitInit(...)` now directly returns a Promise. As such, `CanvasKitInit(...).ready()`
|
|
|
|
has been removed.
|
2020-05-26 17:10:20 +00:00
|
|
|
- `CanvasKit.MakeCanvasSurface` no longer accepts width/height arguments to override those on
|
|
|
|
the canvas element. Use the canvas element's width/height attributes to dictate the size of
|
|
|
|
the drawing area, and use CSS width/height to set the size it will appear on the page
|
|
|
|
(it is rescaled after drawing when css sizing applies).
|
2020-06-01 19:43:03 +00:00
|
|
|
- Memory returned by `CanvasKit.Malloc` will no longer be automatically cleaned up. Clients
|
2020-05-28 18:43:38 +00:00
|
|
|
must use `CanvasKit.Free` to release the memory.
|
2020-06-01 19:43:03 +00:00
|
|
|
- `CanvasKit.Malloc` no longer directly returns a TypedArray, but an object that can produce
|
|
|
|
them with toTypedArray(). This is to avoid "detached ArrayBuffer" errors:
|
|
|
|
<https://github.com/emscripten-core/emscripten/issues/6747>
|
2020-05-21 13:59:44 +00:00
|
|
|
|
2020-05-21 21:46:16 +00:00
|
|
|
### Fixed
|
|
|
|
- WebGL context is no longer created with "antialias" flag. Using "antialias" caused poor AA
|
|
|
|
quality in Ganesh when trying to do coverage-based AA with MSAA unknowingly enabled. It also
|
|
|
|
reduced performance.
|
|
|
|
|
2020-05-14 19:51:55 +00:00
|
|
|
## [0.15.0] - 2020-05-14
|
|
|
|
|
2020-04-01 17:42:15 +00:00
|
|
|
### Added
|
2020-04-06 17:52:15 +00:00
|
|
|
- Support for DOMMatrix on all APIs that take SkMatrix (i.e. arrays or Float32Arrays of length 6/9/16).
|
2020-05-07 20:25:41 +00:00
|
|
|
- setEdging and setEmbeddedBitmaps to SkFont. You can disable the ability to draw aliased fonts (and save some code
|
|
|
|
size) with the compile.sh argument `no_alias_font`.
|
2020-04-01 17:42:15 +00:00
|
|
|
|
2020-03-27 16:27:06 +00:00
|
|
|
### Removed
|
2020-04-27 14:22:51 +00:00
|
|
|
- Previously deprecated functions `MakeSkDashPathEffect`, `MakeLinearGradientShader`,
|
|
|
|
`MakeRadialGradientShader`, `MakeTwoPointConicalGradientShader`, `MakeSkCornerPathEffect`,
|
|
|
|
`MakeSkDiscretePathEffect`
|
2020-03-27 16:27:06 +00:00
|
|
|
|
2020-03-26 13:27:48 +00:00
|
|
|
### Changed
|
|
|
|
- CanvasKit colors are now represented with a TypedArray of four floats.
|
2020-05-14 13:04:30 +00:00
|
|
|
- Calls to `getError` should be disabled. This may cause a performance improvement in some scenarios.
|
2020-03-26 13:27:48 +00:00
|
|
|
|
2020-03-25 17:13:20 +00:00
|
|
|
### Removed
|
2020-03-26 13:27:48 +00:00
|
|
|
- SkPaint.setColorf is obsolete and removed. setColor accepts a CanvasKit color which is
|
2020-04-01 17:42:15 +00:00
|
|
|
always composed of floats.
|
2020-03-25 17:13:20 +00:00
|
|
|
- localmatrix option for `SkShader.Lerp` and `SkShader.Blend`.
|
|
|
|
|
2020-04-06 17:52:15 +00:00
|
|
|
### Deprecated
|
|
|
|
- `SkCanvas.concat44` has been folded into concat (which now takes 3x2, 3x3, or 4x4 matrices). It will
|
|
|
|
be removed soon.
|
2020-05-14 13:04:30 +00:00
|
|
|
|
2020-05-14 12:27:53 +00:00
|
|
|
### Fixed
|
|
|
|
- Memory leak in paragraph binding code (https://github.com/flutter/flutter/issues/56938)
|
2020-05-14 18:50:54 +00:00
|
|
|
- Safari now properly uses WebGL1 instead of WebGL2 when WebGL2 is not available (skbug.com/10171).
|
2020-03-26 13:27:48 +00:00
|
|
|
|
2020-03-18 19:46:33 +00:00
|
|
|
## [0.14.0] - 2020-03-18
|
|
|
|
|
2020-03-17 16:49:19 +00:00
|
|
|
### Added
|
|
|
|
- `SkShader.MakeSweepGradient`
|
|
|
|
- `SkCanvas.saveLayer` can now be called with 1 argument (the paint). In this case the current
|
|
|
|
effective clip will be used, as the current rect is assumed to be null.
|
|
|
|
- `SkPaint.setAlphaf`
|
2020-03-18 13:15:17 +00:00
|
|
|
- Clients can supply `no_codecs` to compile.sh to remove all codec encoding and decoded code.
|
|
|
|
This can save over 100 kb compressed if codecs are not needed.
|
2020-03-17 16:49:19 +00:00
|
|
|
|
2020-03-04 20:43:50 +00:00
|
|
|
### Deprecated
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeSkDashPathEffect` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkPathEffect.MakeDash`.
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeLinearGradientShader` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkShader.MakeLinearGradient`.
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeRadialGradientShader` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkShader.MakeRadialGradient`.
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeTwoPointConicalGradientShader` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkShader.MakeTwoPointConicalGradient`.
|
|
|
|
|
2020-03-06 15:47:05 +00:00
|
|
|
### Fixed
|
|
|
|
- Shadows are properly draw on fillRect and strokeRect in the canvas2d emulation layer.
|
|
|
|
- Shadow offsets properly ignore the CTM in the canvas2d emulation layer.
|
|
|
|
|
2020-03-09 18:23:30 +00:00
|
|
|
### Changed
|
2020-03-18 13:15:17 +00:00
|
|
|
- Stop compiling jpeg and webp encoders by default. This results in a 100kb binary size reduction.
|
|
|
|
Clients that need these encoders can supply `force_encode_webp` or `force_encode_jpeg` to
|
|
|
|
compile.sh.
|
2020-03-09 18:23:30 +00:00
|
|
|
|
2020-03-10 14:44:04 +00:00
|
|
|
### Removed
|
2020-03-18 13:15:17 +00:00
|
|
|
- Removed inverse filltypes.
|
|
|
|
- Removed StrokeAndFill paint style.
|
2020-03-10 14:44:04 +00:00
|
|
|
- Removed TextEncoding enum (it was only used internally). All functions assume UTF-8.
|
|
|
|
|
2020-02-28 19:26:38 +00:00
|
|
|
## [0.13.0] - 2020-02-28
|
|
|
|
|
2020-02-04 19:18:38 +00:00
|
|
|
### Deprecated
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeSkCornerPathEffect` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkPathEffect.MakeCorner`.
|
2020-03-18 13:53:55 +00:00
|
|
|
- `MakeSkDiscretePathEffect` will be removed soon. Calls can be replaced with
|
2020-03-04 20:43:50 +00:00
|
|
|
`SkPathEffect.MakeDiscrete`.
|
2020-02-04 19:18:38 +00:00
|
|
|
|
2020-01-27 15:01:25 +00:00
|
|
|
### Added
|
|
|
|
- `SkSurface.drawOnce` for drawing a single frame (in addition to already existing
|
|
|
|
`SkSurface.requestAnimationFrame` for animation logic).
|
2020-02-21 13:26:59 +00:00
|
|
|
- `CanvasKit.parseColorString` which processes color strings like "#2288FF"
|
|
|
|
- Particles module now exposes effect uniforms, which can be modified for live-updating.
|
2020-02-22 12:37:33 +00:00
|
|
|
- Experimental 4x4 matrices added in `SkM44`.
|
|
|
|
- Vector math functions added in `SkVector`.
|
|
|
|
- `SkRuntimeEffect.makeShaderWithChildren`, which can take in other shaders as fragmentProcessors.
|
2020-02-24 15:00:20 +00:00
|
|
|
- `GrContext.releaseResourcesAndAbandonContext` to free up WebGL contexts.
|
2020-02-28 13:09:08 +00:00
|
|
|
- A few methods on `SkFont`: `setHinting`, `setLinearMetrics`, `setSubpixel`.
|
2019-11-18 12:22:49 +00:00
|
|
|
|
2020-01-28 15:39:56 +00:00
|
|
|
### Changed
|
|
|
|
- We now compile/ship with Emscripten v1.39.6.
|
2020-02-21 22:15:22 +00:00
|
|
|
- `SkMatrix.multiply` can now accept any number of matrix arguments, multiplying them
|
|
|
|
left-to-right.
|
|
|
|
- SkMatrix.invert now returns null when the matrix is not invertible. Previously it would return an
|
|
|
|
identity matrix. Callers must determine what behavior would be appropriate in this situation.
|
2020-02-28 13:09:08 +00:00
|
|
|
- In Canvas2D compatibility layer, the underlying SkFont will have setSubpixel(true).
|
2020-03-09 18:23:30 +00:00
|
|
|
- Bones are removed from Vertices builder
|
2020-01-28 15:39:56 +00:00
|
|
|
|
2020-01-29 12:30:35 +00:00
|
|
|
### Fixed
|
|
|
|
- Support for .otf fonts (.woff and .woff2 still not supported).
|
|
|
|
|
2020-01-22 20:26:19 +00:00
|
|
|
## [0.12.0] - 2020-01-22
|
|
|
|
|
2020-01-15 18:49:53 +00:00
|
|
|
### Added
|
|
|
|
- `SkFontMgr.countFamilies` and `SkFontMgr.getFamilyName` to expose the parsed font names.
|
|
|
|
|
2020-01-14 13:39:09 +00:00
|
|
|
### Changed
|
|
|
|
- SKP serialization/deserialization now available (can be disabled with the 'no_skp').
|
|
|
|
`SkPicture.DEBUGONLY_saveAsFile` renamed to `SkPicture.saveAsFile` and
|
|
|
|
`CanvasKit.MakeSkPicture` is now exposed. SKP support is not shipped to npm builds.
|
2020-01-15 18:49:53 +00:00
|
|
|
`force_serialize_skp` has been removed since it opt-out, not opt-in.
|
|
|
|
|
|
|
|
### Fixed
|
|
|
|
- Bug that sometimes resulted in 'Cannot perform Construct on a neutered ArrayBuffer'
|
2020-01-22 20:29:14 +00:00
|
|
|
- Bug with SkImage.readPixels (skbug.com/9788)
|
2020-01-22 20:18:03 +00:00
|
|
|
- Bug with transparent colors in Canvas2d mode (skbug.com/9800)
|
2020-01-14 13:39:09 +00:00
|
|
|
|
2020-01-10 17:21:20 +00:00
|
|
|
## [0.11.0] - 2020-01-10
|
|
|
|
|
2020-01-06 13:10:05 +00:00
|
|
|
### Added
|
|
|
|
- A "Core" build that removes Fonts, the Skottie animation player, the Particles demo,
|
|
|
|
and PathOps is available in `bin/core/`. It is about half the size of the "CoreWithFonts"
|
|
|
|
build.
|
|
|
|
- Experimental Runtime shader available for custom builds.
|
2020-01-08 13:02:37 +00:00
|
|
|
- WebP support.
|
2020-01-08 18:29:31 +00:00
|
|
|
- `SkAnimatedImage.getCurrentFrame` which returns an SkImage.
|
2020-01-06 13:10:05 +00:00
|
|
|
|
2019-12-17 21:05:02 +00:00
|
|
|
### Fixed
|
|
|
|
- `CanvasKit.SaveLayerInitWithPrevious` and `CanvasKit.SaveLayerF16ColorType` constants.
|
2020-01-02 13:16:51 +00:00
|
|
|
- Some compilation configurations, for example, those with no fonts or just one of particles/skottie.
|
|
|
|
|
|
|
|
### Changed
|
|
|
|
- Small tweaks to compilation settings to reduce code size and linkage time.
|
2020-01-06 13:10:05 +00:00
|
|
|
- JS functions are no longer provided when the underlying c++ calls have been compiled out.
|
2019-12-17 21:05:02 +00:00
|
|
|
|
2019-12-18 21:24:00 +00:00
|
|
|
### Removed
|
2020-01-06 13:10:05 +00:00
|
|
|
- `SkShader.Empty`
|
2020-01-06 18:28:12 +00:00
|
|
|
- Support for Type 1 Fonts. These are ancient and removing them saves about 135k
|
|
|
|
of code size.
|
2020-01-06 13:10:05 +00:00
|
|
|
|
|
|
|
### Breaking
|
|
|
|
- In an effort to reduce code size for most clients, npm now contains two CanvasKit builds.
|
|
|
|
In `bin/` there is the "CoreWithFonts" build that contains most functionality from 0.10.0.
|
|
|
|
However, we no longer ship the Skottie animation player, nor the Particles demo. Further,
|
|
|
|
PathOps are removed from this build `MakePathFromOp`, `SkPath.op` and `SkPath.simplify`.
|
|
|
|
Clients who need any of those features are encouraged to create a custom build using
|
|
|
|
`compile.sh`.
|
|
|
|
- `SkPicture.DEBUGONLY_saveAsFile` was accidentally included in release builds. It has been
|
|
|
|
removed. Clients who need this in a release build (e.g. to file a bug report that only
|
|
|
|
reproduces in release) should do a custom build with the `force_serialize_skp` flag given.
|
2019-12-18 21:24:00 +00:00
|
|
|
|
2020-01-10 17:21:20 +00:00
|
|
|
### Deprecated
|
|
|
|
- `SkCanvas.drawAnimatedImage` will be renamed soon. Calls can be replaced with `SkCanvas.drawImage`
|
|
|
|
and `SkAnimatedImage.getCurrentFrame`.
|
|
|
|
|
2019-12-09 17:50:43 +00:00
|
|
|
## [0.10.0] - 2019-12-09
|
|
|
|
|
2019-11-20 19:17:53 +00:00
|
|
|
### Added
|
|
|
|
- `SkContourMeasureIter` and `SkContourMeasure` as an alternative to `SkPathMeasure`.
|
2019-11-25 18:45:28 +00:00
|
|
|
- CanvasKit image decode cache helpers: getDecodeCacheLimitBytes(), setDecodeCacheLimitBytes(),
|
|
|
|
and getDecodeCacheUsedBytes().
|
2019-12-09 14:04:26 +00:00
|
|
|
- `SkShader.Blend`, `SkShader.Color`, `SkShader.Empty`, `SkShader.Lerp`.
|
2019-11-20 19:17:53 +00:00
|
|
|
|
2019-11-20 13:27:10 +00:00
|
|
|
### Changed
|
|
|
|
- The returned values from `SkParagraph.getRectsForRange` now have direction with value
|
|
|
|
`CanvasKit.TextDirection`.
|
|
|
|
|
2019-12-02 13:26:48 +00:00
|
|
|
### Fixed
|
|
|
|
- `MakeImage` properly in the externs file and can work with `CanvasKit.Malloc`.
|
|
|
|
|
2019-11-18 12:22:49 +00:00
|
|
|
## [0.9.0] - 2019-11-18
|
2019-10-22 13:04:32 +00:00
|
|
|
### Added
|
|
|
|
- Experimental `CanvasKit.Malloc`, which can be used to create a
|
|
|
|
TypedArray backed by the C++ WASM memory. This can save a copy in some cases
|
|
|
|
(e.g. SkColorFilter.MakeMatrix). This is an advanced feature, so use it with care.
|
2019-10-22 13:43:34 +00:00
|
|
|
- `SkCanvas.clipRRect`, `SkCanvas.drawColor`
|
2019-11-15 19:13:20 +00:00
|
|
|
- Blur, ColorFilter, Compose, MatrixTransform SkImageFilters. Can be used with `SkPaint.setImageFilter`.
|
2019-10-29 14:48:26 +00:00
|
|
|
- `SkCanvas.saveLayer` now takes 3 or 4 params to include up to bounds, paint, SkImageFilter, flags.
|
2019-11-01 18:36:52 +00:00
|
|
|
- `SkPath.rArcTo`, `SkPath.rConicTo`, `SkPath.rCubicTo`, `SkPath.rLineTo`, `SkPath.rMoveTo`,
|
|
|
|
`SkPath.rQuadTo`. Like their non-relative siblings, these are chainable.
|
2019-11-08 14:55:15 +00:00
|
|
|
- Add `width()`, `height()`, `reset()`, `getFrameCount()` to SkAnimatedImage.
|
2019-11-11 15:06:08 +00:00
|
|
|
- `SkCanvas.drawImageNine`, `SkCanvas.drawPoints` and related `PointMode` enum.
|
|
|
|
- `SkPath.addPoly`
|
|
|
|
- `SkPathMeasure.getSegment`
|
2019-11-15 19:48:55 +00:00
|
|
|
- More information on SkParagraph API, eg. `getLongestLine()`, `getWordBoundary`, and others.
|
2019-10-29 13:55:39 +00:00
|
|
|
|
|
|
|
### Deprecated
|
|
|
|
- `CanvasKit.MakeBlurMaskFilter` will be renamed/moved soon to `CanvasKit.SkMaskFilter.MakeBlur`.
|
2019-01-04 19:16:19 +00:00
|
|
|
|
2019-10-28 13:05:54 +00:00
|
|
|
### Changed
|
|
|
|
- Use newer version of Freetype2 (Tracking Skia's DEPS now).
|
2019-10-28 16:03:52 +00:00
|
|
|
- Use newer versions of libpng and zlib (Tracking Skia's DEPS now).
|
2019-10-28 13:05:54 +00:00
|
|
|
|
2019-11-08 14:17:38 +00:00
|
|
|
### Fixed
|
|
|
|
- null dereference when sometimes falling back to CPU.
|
2019-11-15 19:48:55 +00:00
|
|
|
- Actually ask WebGL for a stencil buffer.
|
2019-11-15 20:25:34 +00:00
|
|
|
- Can opt out of Paragraph API with no_paragraph passed into compile.sh or when using primitive_shaper.
|
2019-11-08 14:17:38 +00:00
|
|
|
|
2019-10-21 19:17:02 +00:00
|
|
|
## [0.8.0] - 2019-10-21
|
|
|
|
|
2019-09-18 20:18:17 +00:00
|
|
|
### Added
|
|
|
|
- `CanvasKit.MakeAnimatedImageFromEncoded`, `SkCanvas.drawAnimatedImage`.
|
2019-09-26 17:20:50 +00:00
|
|
|
- `CanvasKit.SkFontMgr.FromData` which takes several ArrayBuffers of font data, parses
|
|
|
|
them, reading the metadata (e.g. family names) and stores them into a SkFontMgr.
|
2019-10-03 15:22:08 +00:00
|
|
|
- SkParagraph as an optional set of APIs for dealing with text layout.
|
2019-09-26 17:20:50 +00:00
|
|
|
|
|
|
|
### Changed
|
|
|
|
- The `no_font` compile option should strip out more dead code related to fonts.
|
|
|
|
- and `no_embedded_font` option now allows creating a `SkFontMgr.FromData` instead of
|
|
|
|
always having an empty one.
|
2019-10-09 14:46:14 +00:00
|
|
|
- Updated to emscripten 1.38.47
|
2019-10-16 14:17:05 +00:00
|
|
|
- Switch to WebGL 2.0, but fall back to 1.0 when unavailable - bug.skia.org/9052
|
2019-09-18 20:18:17 +00:00
|
|
|
|
2019-09-26 17:25:26 +00:00
|
|
|
### Fixed
|
|
|
|
- Null terminator bug in draw text - skbug.com/9314
|
|
|
|
|
2019-09-18 12:21:03 +00:00
|
|
|
## [0.7.0] - 2019-09-18
|
|
|
|
|
2019-08-26 19:48:09 +00:00
|
|
|
### Added
|
|
|
|
- `SkCanvas.drawCircle()`, `SkCanvas.getSaveCount()`
|
|
|
|
- `SkPath.offset()`, `SkPath.drawOval`
|
2019-09-11 18:22:22 +00:00
|
|
|
- `SkRRect` support (`SkCanvas.drawRRect`, `SkCanvas.drawDRRect`, `CanvasKit.RRectXY`).
|
|
|
|
Advanced users can specify the 8 individual radii, if needed.
|
2019-09-12 15:11:25 +00:00
|
|
|
- `CanvasKit.computeTonalColors()`, which returns TonalColors, which has an
|
|
|
|
ambient SkColor and a spot SkColor.
|
|
|
|
- `CanvasKit.SkColorFilter` and a variety of factories. `SkPaint.setColorFilter` is the only
|
|
|
|
consumer of these at the moment.
|
|
|
|
- `CanvasKit.SkColorMatrix` with functions `.identity()`, `.scaled()`, `.concat()` and
|
|
|
|
others. Primarily for use with `CanvasKit.SkColorFilter.MakeMatrix`.
|
2019-08-26 19:48:09 +00:00
|
|
|
|
2019-06-03 18:38:05 +00:00
|
|
|
### Changed
|
|
|
|
- `MakeSkVertices` uses a builder to save a copy.
|
2019-05-06 17:46:22 +00:00
|
|
|
|
2019-08-26 19:48:09 +00:00
|
|
|
### Breaking
|
|
|
|
- When `SkPath.arcTo` is given seven arguments, it no longer turns the first four into
|
|
|
|
a `SkRect` automatically, and instead uses them as
|
|
|
|
`arcTo(rx, ry, xAxisRotate, useSmallArc, isCCW, x, y)` (see SkPath.h for more).
|
|
|
|
|
2019-05-06 17:46:22 +00:00
|
|
|
## [0.6.0] - 2019-05-06
|
|
|
|
|
2019-03-22 19:41:36 +00:00
|
|
|
### Added
|
|
|
|
- `SkSurface.grContext` now exposed. `GrContext` has new methods for monitoring/setting
|
|
|
|
the cache limits; tweaking these may lead to better performance in some cases.
|
|
|
|
`getResourceCacheLimitBytes`, `setResourceCacheLimitBytes`, `getResourceCacheUsageBytes`
|
2019-03-29 14:39:52 +00:00
|
|
|
- `SkCanvas.drawAtlas` for efficiently drawing multiple sprites from a sprite sheet with
|
|
|
|
a set of transforms, color blends, etc.
|
|
|
|
- `SkColorBuilder`, `RSXFormBuilder`, `SkRectBuilder` which increase performance by
|
|
|
|
reducing the amount of malloc/free calls per frame, given that the array size is fixed.
|
2019-04-05 17:00:01 +00:00
|
|
|
- Basic `SkPicture` support. `SkSurface.captureFrameAsSkPicture` is a helper function to
|
|
|
|
capture an `SkPicture`, which can be dumped to disk (for debugging) with
|
|
|
|
`SkPicture.DEBUGONLY_saveAsFile`.
|
2019-05-06 17:04:03 +00:00
|
|
|
- `SkImage.readPixels`, which returns a TypedArray of pixel values (safe to use
|
|
|
|
anywhere, doesn't need a delete()).
|
2019-03-22 19:41:36 +00:00
|
|
|
|
2019-03-28 16:46:40 +00:00
|
|
|
### Changed
|
|
|
|
- Better `GrGLCaps` support for WebGL - this shouldn't have any impacts on APIs or
|
|
|
|
correctness, except by perhaps fixing a few bugs in various surface types.
|
2019-03-29 14:39:52 +00:00
|
|
|
- Use unsigned ints for SkColor on the JS side - this shouldn't have any impacts
|
|
|
|
unless clients have pre-computed colors, in which case, they will need to re-compute them.
|
2019-04-04 13:28:53 +00:00
|
|
|
- [breaking] Moved `CanvasKit.MakeImageShader` to `SkImage.makeShader` - removed clampUnpremul
|
|
|
|
as argument.
|
2019-03-28 16:46:40 +00:00
|
|
|
|
2019-03-21 18:18:37 +00:00
|
|
|
## [0.5.1] - 2019-03-21
|
|
|
|
|
2019-03-15 19:36:29 +00:00
|
|
|
### Added
|
|
|
|
- `SkPathMeasure`, `RSXFormBuilder`, `SkFont.getWidths`, `SkTextBlob.MakeFromRSXform`
|
|
|
|
which were needed to add the helper function `SkTextBlob.MakeOnPath`.
|
2019-03-19 13:34:37 +00:00
|
|
|
- `SkSurface.requestAnimationFrame` - wrapper around window.requestAnimationFrame that
|
|
|
|
takes care of the setup/tear down required to use CanvasKit optimally. The callback
|
|
|
|
has an `SkCanvas` as the first parameter - callers should draw on that.
|
2019-03-15 19:36:29 +00:00
|
|
|
|
2019-03-11 20:11:58 +00:00
|
|
|
### Changed
|
|
|
|
- Location in Skia Git repo now `modules/canvaskit` (was `experimental/canvaskit`)
|
2019-03-08 18:24:58 +00:00
|
|
|
|
2019-03-14 14:55:10 +00:00
|
|
|
### Fixed
|
|
|
|
- Extern bug in `CanvasKit.SkMatrix.invert`
|
2019-03-14 15:25:57 +00:00
|
|
|
- Fallback to CPU now properly refreshes the canvas to get access to the
|
|
|
|
CanvasRenderingContext2D.
|
2019-03-18 15:20:53 +00:00
|
|
|
- Compile flags for better WebGL1 support for some graphics cards.
|
2019-03-21 18:18:37 +00:00
|
|
|
- Antialias bug on large oval paths <https://crbug.com/skia/8873>
|
2019-03-18 15:20:53 +00:00
|
|
|
|
|
|
|
### Deprecated
|
|
|
|
- `SkCanvas.flush` will be removed soon - client should only call `SkSurface.flush`
|
|
|
|
|
2019-03-14 14:55:10 +00:00
|
|
|
|
2019-03-08 18:24:58 +00:00
|
|
|
## [0.5.0] - 2019-03-08
|
|
|
|
|
2019-03-06 13:25:36 +00:00
|
|
|
### Added
|
|
|
|
- isVolitile option to `CanvasKit.MakeSkVertices`. The previous (and current default) behavior
|
|
|
|
was for this to be true; some applications may go faster if set to false.
|
|
|
|
- `SkCanvas.saveLayer(rect, paint)`
|
|
|
|
- `SkCanvas.restoreToCount(int)` which can be used with the output of .save() and .saveLayer().
|
2019-03-06 14:32:55 +00:00
|
|
|
- Optional particles library from modules/particles. `See CanvasKit.MakeParticles(json)`;
|
2019-03-08 15:04:28 +00:00
|
|
|
- More public APIs for working with Surfaces/Contexts `GetWebGLContext`,
|
|
|
|
`MakeGrContext`, `MakeOnScreenGLSurface`, `MakeRenderTarget`.
|
|
|
|
- `SkSurface.getSurface()` and `SkCanvas.getSurface()` for making compatible surfaces (typically
|
|
|
|
used as a workspace and then "saved" with `surface.makeImageSnapshot()`)
|
|
|
|
|
|
|
|
### Breaking
|
|
|
|
- `CanvasKit.MakeWebGLCanvasSurface` no longer takes a webgl context as a first arg, only a
|
|
|
|
canvas or an id of a canvas. If users want to manage their own GL contexts, they should build
|
|
|
|
the `SkSurface` themselves with `GetWebGLContext` -> `MakeGrContext` ->
|
|
|
|
`MakeOnScreenGLSurface`.
|
2019-03-01 16:23:49 +00:00
|
|
|
|
|
|
|
## [0.4.1] - 2019-03-01
|
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
### Added
|
2019-02-28 21:05:09 +00:00
|
|
|
- Optional arguments to `MakeManagedAnimation` for supplying external assets (like images, fonts).
|
2019-02-25 21:04:02 +00:00
|
|
|
|
|
|
|
## [0.4.0] - 2019-02-25
|
|
|
|
|
2019-01-07 16:08:55 +00:00
|
|
|
### Added
|
|
|
|
- `SkPath.addRoundRect`, `SkPath.reset`, `SkPath.rewind` exposed.
|
|
|
|
- `SkCanvas.drawArc`, `SkCanvas.drawLine`, `SkCanvas.drawOval`, `SkCanvas.drawRoundRect` exposed.
|
|
|
|
- Can import/export a SkPath to an array of commands. See `CanvasKit.MakePathFromCmds` and
|
|
|
|
`SkPath.toCmds`.
|
2019-01-14 13:36:08 +00:00
|
|
|
- `SkCanvas.drawTextBlob()` and `SkCanvas.SkTextBlob.MakeFromText()` to draw text to a canvas.
|
|
|
|
- `CanvasKit.TextEncoding` enum. For use with `SkTextBlob`.
|
2019-02-22 15:04:06 +00:00
|
|
|
- Text shaping with `ShapedText` object and `SkCanvas.drawText`. At compile time, one can choose
|
|
|
|
between using Harfbuzz/ICU (default) or a primitive one ("primitive_shaper") which just does
|
|
|
|
line breaking. Using Harfbuzz/ICU substantially increases code size (4.3 MB to 6.4 MB).
|
2019-01-14 13:36:08 +00:00
|
|
|
|
|
|
|
### Changed
|
2019-02-22 15:04:06 +00:00
|
|
|
- `SkCanvas.drawText()` now requires an `SkFont` object for raw strings.
|
|
|
|
|
2019-01-14 13:36:08 +00:00
|
|
|
|
|
|
|
### Removed
|
|
|
|
- `SkPaint.setTextSize()`, `SkPaint.getTextSize()`, `SkPaint.setTypeface()`
|
|
|
|
which should be replaced by using `SkFont`.
|
2019-02-25 21:04:02 +00:00
|
|
|
- Deprecated `CanvasKitInit().then()` interface (see 0.3.1 notes)
|
2019-01-14 13:36:08 +00:00
|
|
|
|
2019-01-07 16:08:55 +00:00
|
|
|
|
2019-01-07 03:27:54 +00:00
|
|
|
### Fixed
|
|
|
|
- Potential bug in `ready()` if already loaded.
|
2019-01-04 19:16:19 +00:00
|
|
|
|
|
|
|
## [0.3.1] - 2019-01-04
|
2019-01-02 20:13:57 +00:00
|
|
|
### Added
|
|
|
|
- `SkFont` now exposed.
|
2019-01-03 21:20:04 +00:00
|
|
|
- `MakeCanvasSurface` can now take a canvas element directly.
|
|
|
|
- `MakeWebGLCanvasSurface` can now take a WebGL context as an integer and use it directly.
|
2019-01-02 20:13:57 +00:00
|
|
|
|
2019-01-04 19:16:19 +00:00
|
|
|
### Changed
|
|
|
|
- `CanvasKitInit(...).then()` is no longer the recommended way to initialize things.
|
|
|
|
It will be removed in 0.4.0. Use `CanvasKitInit(...).ready()`, which returns a real Promise.
|
|
|
|
|
2019-01-02 20:13:57 +00:00
|
|
|
### Removed
|
|
|
|
- `SkPaint.measureText` - use `SkFont.measureText` instead.
|
2018-12-07 13:29:52 +00:00
|
|
|
|
2018-12-18 12:43:02 +00:00
|
|
|
## [0.3.0] - 2018-12-18
|
|
|
|
|
2018-12-07 13:29:52 +00:00
|
|
|
### Added
|
|
|
|
- Add Canvas2D JS layer. This mirrors the HTML Canvas API. This may be omitted at compile time
|
|
|
|
it by adding `no_canvas` to the `compile.sh` invocation.
|
2018-12-12 15:35:13 +00:00
|
|
|
- `CanvasKit.FontMgr.DefaultRef()` and `fontmgr.MakeTypefaceFromData` to load fonts.
|
2018-12-14 21:10:38 +00:00
|
|
|
- Exposed `SkPath.setVolatile`. Some animations see performance improvements by setting
|
|
|
|
their paths' volatility to true.
|
2018-12-07 13:29:52 +00:00
|
|
|
|
2018-12-07 18:03:08 +00:00
|
|
|
### Fixed
|
|
|
|
- `SkPath.addRect` now correctly draws counter-clockwise vs clockwise.
|
|
|
|
|
2018-12-07 13:29:52 +00:00
|
|
|
### Changed
|
2018-12-18 12:43:02 +00:00
|
|
|
- `CanvasKit.MakeImageShader` no longer takes encoded bytes, but an `SkImage`, created from
|
2018-12-07 13:29:52 +00:00
|
|
|
`CanvasKit.MakeImageFromEncoded`. Additionally, the optional parameters `clampIfUnpremul`
|
|
|
|
and `localMatrix` have been exposed.
|
2018-12-07 18:03:08 +00:00
|
|
|
- `SkPath.arcTo` now takes `startAngle`, `sweepAngle`, `forceMoveTo` as additional parameters.
|
|
|
|
- `SkPath.stroke` has a new option `precision` It defaults to 1.0.
|
2018-12-12 15:35:13 +00:00
|
|
|
- CanvasKit comes with one font (NotoMono) instead of the Skia TestTypeface. Clients are encouraged
|
|
|
|
to use the new `fontmgr.MakeTypefaceFromData` for more font variety.
|
|
|
|
|
|
|
|
### Removed
|
|
|
|
- `CanvasKit.initFonts()` - no longer needed.
|
2018-12-07 13:29:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
## [0.2.1] - 2018-11-20
|
2019-03-06 13:25:36 +00:00
|
|
|
Beginning of Changelog history
|