ImageEn, unit iexSVG

IEParseSVGImageTag


Declaration

function IEParseSVGImageTag(const TagContent: string; out X, Y, Width, Height: Double; var PreserveAspectRatio: Boolean;
                            var Image: string; var Bitmap: TIEBitmap; var Opacity: Double; StyleDefinitions: TStringList = nil; InitializeStyles: Boolean = True): Boolean; overload;
function IEParseSVGImageTag(const Tag: TIESVGTag; ScaleX, ScaleY: Double; out X, Y, Width, Height: Double; var PreserveAspectRatio: Boolean; var Image: string; var Bitmap: TIEBitmap;
                            var Opacity: Double; var ToRotate: Double; StyleDefinitions: TStringList = nil; InitializeStyles: Boolean = True; ProcessTransforms: Boolean = True): Boolean; overload;


Description

Parse an SVG image tag and output the image and style properties.
If Bitmap is passed as nil, only Image will be filled with the href value. If bitmap is valid, it will be filled with the image.
The image can be an embedded base64 "xlink:href" reference, or an web-based file (if AllowWebDownload is enabled).
If InitializeStyles is true, any styles not specified will be reset to SVG defaults.
If ProcessTransforms is true, any transforms attributes found in the tag will be used to move or scale the object (and the ToRotate var will be filled).
Result is false if the tag could not be parsed.


Demo

Demo  Demos\InputOutput\SVGParsing\SVGParsing.dpr


Examples

// Load a web-based images using an SVG tag
IEParseSVGImageTag( '<image x="20" y="20" height="94" width="313" href="http://www.imageen.com/graphics/ImageEnLogo.png" />', x, y, w, h, ar, imageStr, ImageEnView1.IEBitmap, opacity );
ImageEnView1.Update();

// Get the HREF for a web-based images in an SVG tag
IEParseSVGImageTag( '<image x="20" y="20" height="94" width="313" href="http://www.imageen.com/graphics/ImageEnLogo.png" />', x, y, w, h, ar, imageStr, NIL, opacity );

IEParseSVGImageTag( '<image x="94px" y="201px" width="51px" height="33px" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQO
                     DwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR
                     CAAhADMDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRol
                     JicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3
                     +Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5
                     OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIR
                     AxEAPwD6pooPSvmX9r7x5rehXGjaFoV/c6elxG9zcS27GN352qoccgfeJA9qAPpSWaONWLyIuBzk9K+dfg5rvja81+e7v31W90l0IDzKxjPzdVJ6/hXI/s8fFnUIbHUdG1UrdzWsLXltMygzOi8yRlv4
                     uOQTz1GemPSfAfiiZPAuiQxu2Bb9M4/iP9KTjeSOqjW9nQqLlTvZa9N3p9x7A+sxRxBnilU4+64AIrO/4SmGOfFwqrETjcrZK/WvP7jVppupJ+tYesXExQ7WIBBJrSyOK7Pf45UkRXVgVIyKK4Lw5fTt
                     odkTI3+rHeioLPQDXx5+2qry+NfD8caFn+wtgLyT857V7T4uPjDS7+drXUL+8tHkLIls0UciIe3zRFTjpXEyeJvF1vqM062TXiNGIimt2atIAOyyQkDHsVp2Fc+d/hat3p+vX9wLeQSppl0Y1dDhj5ZG
                     PfrXuXw2kuH8EaQ13G0U3lsuxkKEAMQMg/5PFVxP4m1TxML+7srK3sUVglpZWzJhiODvbk/oPauu0rQPEGosClusCEDBfLtnvnt+VLQd3bl6f1/myYMAvJ4qhqEyOjxId8rKQqrzknj8K7jTPhvJJhtT
                     unkz1XPH5Diuw0zwlpdgBst1Zh3IoFY5/wAO2kq6HZK6MGEYBFFd6sSIoVUAA6cUUDM++6Gubvfvt9aKKAK0H+uFdnpf+pWiigC9RRRQAUUUUAf/2Q=="/>',
                    x, y, w, h, ar, imageStr, ImageEnView1.IEBitmap, opacity );
ImageEnView1.Update();


See Also

ParseSVG
IEParseSVGLineTag
IEParseSVGPathTag
IEParseSVGPolyTag
IEParseSVGShapeTag
IEParseSVGTextTag