ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Overview
  • How to?
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Modifying an SVG image (XML functions)
Overview
SVG (Scalable Vector Graphics) is a vector image format: this means that the image is drawn on demand and is not "fixed"..
The advantage of these images is that they never pixelate.
SVG is an XML-based format: in WLanguage, it is very easy to modify the properties and attributes of these images.
The advantage of modifying an SVG image in the code is that the same source image can be used in several themes/colors.
How to?
To modify an SVG image in the code:
  1. Load an SVG image:
    To open and edit an SVG image in the code, simply use the xmlDocument type:
    MySVG is xmlDocument
     
    // Opens the original document
    MySVG = XMLOpen(...
     "C:\[..]\Badge-SVG.svg", fromFile)
  2. Modify the image:
    To modify the image, simply access the properties (attributes) or values to be modified.
    // Changes the color
    // - of the borders
    MySVG.svg.path..Attribute["fill"] = ...
     "#9C27B0"
    // - text
    MonSVG.svg.text..Attribute["fill"] = ...
     "#E91E63"
     
    // Changes the text
    MonSVG.svg.text..Text = "Great!"
  3. Save the modified image:
    The string that corresponds to the modified XML document must be rebuilt. The SVG content can be saved to a file or displayed directly in an Image control.
    // Rebuilds the SVG image
    // to display it in the Image control
    IMG_Preview = XMLBuildString(MySVG)
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help