mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
10 lines
442 B
TypeScript
10 lines
442 B
TypeScript
import { GrayImage } from '../graphics/image'
|
|
declare const com: any
|
|
export function rasterizeSvg(svg: string, size: number, strokeWidth: number): GrayImage | null {
|
|
const bytes = com.faceclaw.app.IconRenderer.renderSvgGray(svg, size, strokeWidth)
|
|
if (!bytes || bytes.length < size * size) return null
|
|
const image = new GrayImage(size, size, 0)
|
|
for (let i = 0; i < size * size; i++) image.pixels[i] = bytes[i] & 0xff
|
|
return image
|
|
}
|