SvgImage
classin packageklyn.gui.images
public class SvgImage extends Image
└ SvgImage

Scalable Vector Graphics image.

SvgImage represents a SVG document loaded from disk. It keeps the vector source and lets the native window backend render it at any destination size. The logical image area is a viewBox: resize(...) changes its size and crop(...) changes its origin and size. Icons should generally use currentColor so they can be tinted by the active theme.

icon = SvgImage("assets/icons/save.svg")
icon.render(painter, 12, 12, 24, 24, Color.parse("#9AA3B2"), false, Color.white())
Properties
Modifier and Type Member Description
public override readonly property height
height as Int
Logical SVG viewBox height when set.
public override readonly property width
width as Int
Logical SVG viewBox width when set.
Inherited Properties
propertyInherited Properties from Image: fileName, height, width
Constructors
Modifier and Type Member Description
public SvgImage
SvgImage(fileName as String = "")
Creates a SVG image descriptor.
Methods
Modifier and Type Member Description
public override crop
crop(x as Int, y as Int, width as Int, height as Int) as Void
Crops the logical SVG viewBox.
public override load
load(fileName as String) as Void
Loads another SVG file into this image descriptor.
public render
render(painter as Painter, x as Int, y as Int, width as Int, height as Int, tint as Color = null, hovered as Boolean = false, hoverTint as Color = null) as Void
Renders the SVG into the given painter.
public override resize
resize(width as Int, height as Int) as Void
Resizes the logical SVG viewBox.
Inherited Methods
methodInherited Methods from Image: crop, getImage, load, resize