NanoSVG::Rasterizer
Inherits Reference < Object
Constants
Class methods
One-shot convenience (creates a throwaway rasterizer context).
Instance methods
Rasterizes an SVG image into a caller-provided RGBA buffer. image - parsed image (see NanoSVG.parse) tx, ty - image offset (applied after scaling) scale - image scale dst - destination buffer, 4 bytes per pixel (RGBA) stride - number of bytes per scanline in the destination buffer
dst is cleared first, so callers may reuse a buffer between calls. (Bytes.new does NOT guarantee zeroed memory — the GC hands out recycled pages — so the clear is not optional.)
premultiplied: true skips the final unpremultiply+defringe pass and returns RGBA with color channels premultiplied by alpha (the format the blend loops naturally produce). GPU pipelines that expect premultiplied textures avoid a full-buffer extra pass this way; the output then DIFFERS from the C twin's straight-alpha format.
Convenience overload: allocates an RGBA buffer of wh4 (stride = w*4) and returns it (non-premultiplied alpha unless premultiplied: true).