RenderSvgz.vb
C# VB
'''' This code is part of Document Solutions for Imaging demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports SystemImports System.IOImports System.DrawingImports System.Collections.GenericImports System.LinqImports System.NumericsImports GrapeCity.Documents.DrawingImports GrapeCity.Documents.TextImports GrapeCity.Documents.ImagingImports GrapeCity.Documents.Svg
'' This sample shows how to render an SVGZ (compressed SVG) image.'' The SVG art used in this sample is from freesvg.org.Public Class RenderSvgz Public Function GenerateImage(pixelSize As Size, dpi As Single, opaque As Boolean, Optional sampleParams As String() = Nothing) As GcBitmap Dim svgPath = Path.Combine("Resources", "SvgMisc", "Smiling-Girl.svgz") Using svg = GcSvgDocument.FromSvgz(File.ReadAllBytes(svgPath))
'' Render the SVG image and a border around it: Dim bmp = New GcBitmap(pixelSize.Width, pixelSize.Height, opaque, dpi, dpi) Using g = bmp.CreateGraphics(Color.White) Dim pt = New PointF(dpi, dpi) g.DrawSvg(svg, pt) Dim sz = svg.GetIntrinsicSize(SvgLengthUnits.Pixels) g.DrawRectangle(New RectangleF(pt, sz), Color.MediumPurple) End Using
'' Done: Return bmp End Using End FunctionEnd Class