Skip to content
FutureBlitz

    Install

    Import std.image.svg

    std.image.svg

    SVG, over nanosvg: Svg.Parse reads an SVG's shapes, paths, strokes, fills, and gradients into an Svg, whose Width and Height are its size in pixels at 96 dots an inch, and Rasterize draws it into an Image, its edges antialiased. nanosvg leaves out SVG's text, images, filters, masks, and clipping, and style sheets but for style attributes.

    std/image/svg.fb

    Types

    Svg class

    Public Class Svg

    An SVG's shapes, which Rasterize draws into an Image.

    std/image/svg.fb, line 12

    • Public Static Method Parse(text: String): Svg Throws IOError static method #

      The SVG in text. Throws an IOError of INVALID_DATA when the text isn't an SVG, or is one without a size, by its width and height or its viewBox.

    • Public Property Width: Double property #

      How wide it is, in pixels at 96 dots an inch.

    • Public Property Height: Double property #

      How tall it is, in pixels at 96 dots an inch.

    • @PanicsAtCaller Public Method Rasterize(scale: Double = 1): Image method #

      It drawn at scale, in an image of its size times the scale, each side rounded up. Panics when the scale isn't above 0, or the image would have more pixels than an Image holds.

    • @PanicsAtCaller Public Method Rasterize(width: Int, height: Int): Image method #

      It drawn as large as it fits in an image of width by height, in the middle of it. Panics when the size is one an Image can't be.

    Report an issue with this page or with FutureBlitz on GitHub.