Repository navigation
v3.6.0 - html-in-canvas engine added to core #550
Replies: 1 comment
|
Chrome 157, rolling out now, ships html-in-canvas: the browser paints a DOM element into a canvas by itself. SnapDOM 3.6.0 can use it as a second engine: import { snapdom } from '@zumer/snapdom'
const result = await snapdom(el, { engine: 'html-in-canvas' })
const png = await result.toPng()Where the API is missing (Firefox, Safari, older Chrome), SnapDOM falls back to the SVG engine on its own and returns the same result, so you can set the option everywhere. SVG stays the default because it is faster. Try html-in-canvas when native form controls or scrollbars have to look exactly like the page.
SnapDOM 3.6.0:新增第二个渲染引擎 html-in-canvasChrome 157 正在陆续推送,带来了 html-in-canvas:浏览器可以自己把 DOM 元素绘制到 canvas 中。SnapDOM 3.6.0 可以把它作为第二个引擎使用: import { snapdom } from '@zumer/snapdom'
const result = await snapdom(el, { engine: 'html-in-canvas' })
const png = await result.toPng()在没有这个 API 的浏览器中(Firefox、Safari、旧版 Chrome),SnapDOM 会自动回退到 SVG 引擎,返回同样的结果,所以可以在所有环境中直接开启这个选项。 默认仍然是 SVG 引擎,因为它更快。当原生表单控件或滚动条需要和页面完全一致时,可以试试 html-in-canvas。
|
Uh oh!
There was an error while loading. Please reload this page.
Features
8294802932df5eFull Changelog: v3.5.0...v3.6.0
This discussion was created from the release v3.6.0.
All reactions