resvg-js
resvg-js copied to clipboard
feat: `.pixels` return type changed to Uint8ClampedArray
Part of #300
Now you can pass the resvg-js rendered pixels to the canvas in the browser via new ImageData().
const resvgJS = new resvg.Resvg(svgString)
const pngData = resvgJS.render()
const imageData = new ImageData(pngData.pixels, pngData.width, pngData.height)
let canvas = document.createElement('canvas')
canvas.width = imageData.width
canvas.height = imageData.height
let ctx = canvas.getContext('2d')
ctx.putImageData(imageData, 0, 0)
document.body.appendChild(canvas)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| resvg-js | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 28, 2024 0:51am |