Canvas2dCanvas
KiteCanvas backed by a browser-side CanvasRenderingContext2D. Pure Kotlin/JS + DOM: no Compose for Web, no Skia/WASM bundle.
The right choice for in-browser PDF viewers that want minimal bundle size and to inherit whatever rendering acceleration the browser already provides for <canvas>.
Honest scope:
Path operations, gradients, blend modes (all 16) and clipping use the standard Canvas2D API. A transparency group with an alpha or a blend mode, and a soft mask, paint into an offscreen canvas that composites onto the page once.
Embedded image XObjects: ⚠️ JPEG / JP2 are decoded asynchronously by the browser (
HTMLImageElement.src = …), which doesn't fit the renderer's synchronous draw pass. v1 paints placeholders for image XObjects; an async render path is roadmapped.
Functions
ISO 32000-1, 11.6.5.2: the content and the mask group each paint into a layer of their own. The mask layer's alpha, or for a luminosity mask its luminosity over a black backdrop, gates the content layer, which then composites onto the page. The mask group's colours never reach the page (#161). The transfer table maps each mask value.
ISO 32000-1, 11.4.5: a group's constant alpha and blend mode apply once, when the group composites onto its backdrop. So a group that has them paints into a layer first (#77). The layer is isolated, and knockout is not honoured (#125).