From bf8fa96777f81de19faa83de9e8600dd21293296 Mon Sep 17 00:00:00 2001 From: Osei Fortune Date: Sun, 8 Nov 2026 01:33:40 -0400 Subject: [PATCH] docs: update for canvas 3.0.0 - New pages: OffscreenCanvas and Workers, Web API Compatibility, and canvas-svg Styling - Windows and Linux in the platform and context tables, and across the svg, media, gamepad, audio-context and polyfill pages - Performance: threaded 2D and WebGL rendering (what waits on the thread, how to opt out) and image/GPU memory behaviour - Images: ImageAsset toImageSource() and toNativeImage(), and createImageBitmap rejecting undecodable bytes - WebGPU: importExternalTexture on Android 10+, Windows and Linux - canvas-svg: the stylesheet property, the error event, and CSS animations started by any selector - Upgrading to 3.0: the late threading, WebGL, image and svg behaviour changes --- .vitepress/config.ts | 3 + .vitepress/theme/PluginsHome.vue | 4 +- .vitepress/theme/components/AudioDocsHome.vue | 2 +- .../theme/components/CanvasDocsHome.vue | 2 +- .vitepress/theme/components/CanvasHome.vue | 2 +- content/audio-context/installation.md | 3 +- content/canvas-svg/guides/animation.md | 4 +- .../guides/properties-and-events.md | 3 + content/canvas-svg/guides/styling.md | 56 ++++++ content/canvas-svg/index.md | 5 +- content/canvas/api.md | 21 +- content/canvas/compatibility.md | 186 ++++++++++++++++++ content/canvas/events.md | 3 +- content/canvas/guides/images-and-bitmaps.md | 32 ++- content/canvas/guides/offscreen-canvas.md | 155 +++++++++++++++ content/canvas/guides/webgpu-recipes.md | 3 +- content/canvas/installation.md | 18 +- content/canvas/performance.md | 46 ++++- content/canvas/rendering-contexts.md | 8 + content/canvas/upgrading.md | 22 ++- content/plugins/canvas-gamepad.md | 3 +- content/plugins/canvas-media.md | 4 +- content/plugins/canvas-polyfill.md | 4 +- 23 files changed, 563 insertions(+), 26 deletions(-) create mode 100644 content/canvas-svg/guides/styling.md create mode 100644 content/canvas/compatibility.md create mode 100644 content/canvas/guides/offscreen-canvas.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index f381039..fe5fee2 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -89,6 +89,7 @@ export default defineConfig({ { text: 'WebGL Recipes', link: '/canvas/guides/webgl-recipes' }, { text: 'WebGPU Recipes', link: '/canvas/guides/webgpu-recipes' }, { text: 'Images and ImageBitmap', link: '/canvas/guides/images-and-bitmaps' }, + { text: 'OffscreenCanvas and Workers', link: '/canvas/guides/offscreen-canvas' }, { text: 'Fonts', link: '/canvas/guides/fonts' }, ], }, @@ -99,6 +100,7 @@ export default defineConfig({ { text: 'Events and Input', link: '/canvas/events' }, { text: 'Performance', link: '/canvas/performance' }, { text: 'API Overview', link: '/canvas/api' }, + { text: 'Web API Compatibility', link: '/canvas/compatibility' }, { text: 'Ecosystem Packages', link: '/canvas/ecosystem' }, ], }, @@ -114,6 +116,7 @@ export default defineConfig({ text: 'Guides', items: [ { text: 'Properties and Events', link: '/canvas-svg/guides/properties-and-events' }, + { text: 'Styling', link: '/canvas-svg/guides/styling' }, { text: 'Building SVG with the DOM', link: '/canvas-svg/guides/dom' }, { text: 'Animation', link: '/canvas-svg/guides/animation' }, { text: 'Drawing SVG into a Canvas', link: '/canvas-svg/guides/canvas-integration' }, diff --git a/.vitepress/theme/PluginsHome.vue b/.vitepress/theme/PluginsHome.vue index 621acab..25bf66b 100644 --- a/.vitepress/theme/PluginsHome.vue +++ b/.vitepress/theme/PluginsHome.vue @@ -13,7 +13,7 @@ const plugins = [ stats: { contexts: '2D + WebGL + WebGPU', engine: 'Skia + WGPU', - platforms: 'iOS, tvOS, visionOS & Android', + platforms: 'Apple, Android & Windows', }, }, { @@ -304,7 +304,7 @@ onBeforeUnmount(() => {
- iOS, tvOS, visionOS & Android + Apple, Android & Windows
diff --git a/.vitepress/theme/components/AudioDocsHome.vue b/.vitepress/theme/components/AudioDocsHome.vue index d1670cb..85bebb3 100644 --- a/.vitepress/theme/components/AudioDocsHome.vue +++ b/.vitepress/theme/components/AudioDocsHome.vue @@ -11,7 +11,7 @@ const rootRef = ref(null);

Native audio graphs with a web-audio mental model

@nativescript/audio-context

- Build playback, synthesis, effects, routing, and offline rendering pipelines on iOS, tvOS, visionOS and Android with a familiar AudioContext-style API. + Build playback, synthesis, effects, routing, and offline rendering pipelines on iOS, tvOS, visionOS, Android and Windows with a familiar AudioContext-style API.

diff --git a/.vitepress/theme/components/CanvasDocsHome.vue b/.vitepress/theme/components/CanvasDocsHome.vue index ca09f2a..cad8637 100644 --- a/.vitepress/theme/components/CanvasDocsHome.vue +++ b/.vitepress/theme/components/CanvasDocsHome.vue @@ -17,7 +17,7 @@ const rootRef = ref(null);

- iOS, tvOS, visionOS + Android + iOS, tvOS, visionOS, Android + Windows Skia-backed rendering GPU-ready workflows Web API muscle memory diff --git a/.vitepress/theme/components/CanvasHome.vue b/.vitepress/theme/components/CanvasHome.vue index 884b39b..55cd5c1 100644 --- a/.vitepress/theme/components/CanvasHome.vue +++ b/.vitepress/theme/components/CanvasHome.vue @@ -167,7 +167,7 @@ onBeforeUnmount(() => { Canvas Docs - Set up @nativescript/canvas and render with native iOS, tvOS, visionOS and Android surfaces. + Set up @nativescript/canvas and render with native iOS, tvOS, visionOS, Android and Windows surfaces. Rendering Recipes diff --git a/content/audio-context/installation.md b/content/audio-context/installation.md index 7442d81..d55bf32 100644 --- a/content/audio-context/installation.md +++ b/content/audio-context/installation.md @@ -20,7 +20,8 @@ npm install @nativescript/audio-context ## Requirements - `@nativescript/audio-context` 2.x requires **NativeScript 9.1 or later**. Pair it with `@nativescript/canvas` 3.x if you use both packages. -- Supported platforms: iOS, tvOS, visionOS and Android. The tvOS simulator build is arm64 only, so use an Apple silicon Mac to run it in the simulator. +- Supported platforms: iOS, tvOS, visionOS, Android, Windows and Linux. The tvOS simulator build is arm64 only, so use an Apple silicon Mac to run it in the simulator. +- On Windows and Linux the graph is rendered by the [web-audio-api](https://github.com/orottier/web-audio-api-rs) engine, playing through WASAPI on Windows and ALSA on Linux (PulseAudio and PipeWire work through their ALSA plugins). `decodeAudioData` reads WAV, MP3, Ogg Vorbis, FLAC and AAC. A `WaveShaperNode` takes only one curve: assigning a second throws `InvalidStateError`. ## Verify setup diff --git a/content/canvas-svg/guides/animation.md b/content/canvas-svg/guides/animation.md index be38639..789f8de 100644 --- a/content/canvas-svg/guides/animation.md +++ b/content/canvas-svg/guides/animation.md @@ -38,7 +38,9 @@ A `begin` that waits for an event (such as `click`) never starts on its own. ``` - Keyword easings and `cubic-bezier()` are supported. `steps()` runs as linear. -- Only `#id` selectors are read, which is what SVG exporters produce. +- Any selector that the [stylesheet](/canvas-svg/guides/styling#selectors) supports can start an animation, and so can an element's own `style="animation: …"`. `@keyframes` can be in any `