3.4 Loading SVG images

Pangomonium can also load and draw SVG images. As soon as the plugin is installed, Hollywood will 'automagically' be able to open SVG images. So when you use LoadBrush(), for example, on an SVG image, Pangomonium will automatically load it. Note that since there is another Hollywood plugin that can load SVG images, it is recommended that you use the Loader tag to specify which plugin should be used to load the SVG image, e.g.

 
; this code will make Pangomonium load the image
LoadBrush(1, "test.svg", {Loader = "pangomonium"})

; this code will make the svgimage.hwp plugin load the image
LoadBrush(1, "test.svg", {Loader = "svgimage"})

If you don't specify the Loader tag and you have two plugins that can load SVG images installed, the plugin that Hollywood has loaded first will be the one that will load your SVG image. But since the order Hollywood plugins are loaded is dependent on the file system you can't really rely on anything so it's better to explicitly use the Loader tag to tell Hollywood which plugin to use to load the SVG image. To see which plugin loaded your SVG image, you can use the #ATTRLOADER attribute like this:

 
DebugPrint(GetAttribute(#BRUSH, 1, #ATTRLOADER))

When it loads an SVG image, Pangomonium will always create a vector brush for you. This means that you can transform it using commands like ScaleBrush(), RotateBrush(), and TransformBrush() without any losses in quality. In case layers are enabled and you display a vector brush using DisplayBrush(), the layer graphics can also be transformed without any quality loss. The same is true for BGPics using vector graphics.

Please note that Pangomonium will also always create images with alpha channel by default. If you don't want that, you have to manually delete the alpha channel using DeleteAlphaChannel() after loading the image. In case you want to use an SVG image as a BGPic, you can also work around this problem by defining a background for this BGPic, e.g. like this:

 
@BGPIC 1, "test.svg", {FillStyle = #FILLCOLOR, FillColor = #WHITE,
                        Loader = "pangomonium"}


Show TOC