Platforms to show: All Mac Windows Linux Cross-Platform

ReSVGMBS class   New in 23.0

Type Topic Plugin Version macOS Windows Linux iOS Targets
class SVG MBS Images Plugin 23.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Function: A class to render SVG data to a picture.
Example:

// we load this file
Dim file As FolderItem = SpecialFolder.Desktop.Child("test.svg")

Dim p As New ReSVGMBS(file)

// and render them in their normal size:
Dim pic As picture = p.RenderToPicture(p.Width, p.Height)

// show in the window
Window1.Backdrop = pic
Notes:
This uses the ReSVG library written in Rust.
ReSVG is a fast, small, portable SVG library with the goal to support the whole SVG spec.

see
https://github.com/RazrFalcon/resvg
  • 4 properties
  • 9 shared properties
  • 12 methods
    • method Constructor(data as MemoryBlock)
    • method Constructor(data as String)
    • method Constructor(file as FolderItem)
    • method ImageBox(byref x as double, byref y as double, byref width as double, byref height as double) as Boolean
    • method NodeBox(id as string, byref x as double, byref y as double, byref width as double, byref height as double) as Boolean
    • method NodeExists(id as string) as Boolean
    • method Render(width as Integer, Height as Integer, pixmap as Ptr, FitToType as Integer = 0, FitToValue as single = 0.0, transform as Ptr = nil)
    • method RenderNode(ID as string, width as Integer, Height as Integer, pixmap as Ptr, FitToType as Integer = 0, FitToValue as single = 0.0, transform as Ptr = nil)
    • method RenderNodeToPicture(ID as string, width as Integer, Height as Integer, FitToType as Integer = 0, FitToValue as single = 0.0, transform as Ptr = nil) as Picture
    • method RenderToFile(file as FolderItem, FitToType as Integer = 0, FitToValue as single = 0.0)
    • method RenderToPicture(width as Integer, Height as Integer, FitToType as Integer = 0, FitToValue as single = 0.0, transform as Ptr = nil) as Picture
    • method ViewBox(byref x as double, byref y as double, byref width as double, byref height as double) as Boolean
  • 2 shared methods
  • 19 constants

Errors

Constant Value Description
kErrorElementsLimitReached 4 We do not allow SVG with more than 1_000_000 elements for security reasons.
kErrorFileOpenFailed 2 Failed to open the provided file.
kErrorInvalidSize 5 SVG doesn't have a valid size.
Occurs when width and/or height are <= 0.
Also occurs if width, height and viewBox are not set.
kErrorMalformedGZip 3 Compressed SVG must use the GZip algorithm.
kErrorNotAnUTF8String 1 Only UTF-8 content are supported.
kErrorOK 0 Everything is ok.
kErrorParsingFailed 6 Failed to parse an SVG data.

Fit Types

Constant Value Description
kFitToTypeHeight 2 Fit an image to a specified height.
kFitToTypeOriginal 0 Use an original image size.
kFitToTypeWidth 1 Fit an image to a specified width.
kFitToTypeZoom 3 Zoom an image using scaling factor.

Image Rendering

Constant Value Description
kImageRenderingOptimizeQuality 0 Optimize for quality
kImageRenderingOptimizeSpeed 1 Optimize for speed

Shape Renderings

Constant Value Description
kShapeRenderingCrispEdges 1 Crisp Edges
kShapeRenderingGeometricPrecision 2 Geometric precision
kShapeRenderingOptimizeSpeed 0 Optimize speed

Text Renderings

Constant Value Description
kTextRenderingGeometricPrecision 2 Geometric precision
kTextRenderingOptimizeLegibility 1 Optimize legibility
kTextRenderingOptimizeSpeed 0 Optimize for speed

This class has no sub classes.

Blog Entries


The items on this page are in the following plugins: MBS Images Plugin.


ResStreamMBS   -   RFCClassDescriptionMBS


💬 Ask a question or report a problem
The biggest plugin in space...


Start Chat