Rasterizing a Vector Drawing
To rasterize a vector drawing, use the Rasterize Method of ImGearVectorPage Class. This creates a copy of the drawing in bitmap format. For example:
C# |
Copy Code |
if (igPage is ImGearVectorPage)
igPage = ((ImGearVectorPage)igPage).Rasterize(); |
To control the size of the rasterized bitmap, you can do one of following:
SVG cannot be resized before it's rasterized; SVG doesn't have control parameters, and cannot be resized using the Resize Method. To resize an SVG, you need to rasterize it first, then resize it.
- Before loading the vector drawing, set the Width filter control parameter of the format filter used to load the drawing to the desired width of the rasterized image in pixels. The height will be calculated automatically based on the aspect ratio of the drawing. When a width is not specified, the default is used, which is defined by the file format (see File Formats Reference).
- Call the Resize Method of ImGearProcessing Class before calling the Rasterize Method. This will allow you to specify the rasterized dimensions in pixels.