Click here to Skip to main content
12,303,940 members (74,468 online)
Click here to Skip to main content

Stats

34.5K views
4.2K downloads
39 bookmarked
Posted

Convert XAML Vector Graphic to PNG

, 23 Oct 2012 CPOL
An introduction to the usage of vector graphics as a source of bitmap graphics.
PNG
XAML
arrow-down-dash-small.backup
XAMLtoPNG
Properties
XAMLtoPNG.csproj.user
00_Go up
980b4f92-db2c-46f8-83ca-042b70ced31a.png
go-up.Canvas.backup
01_mail forward
bc241dff-27e2-42a4-b252-35a170dc68d6.png
02_tango network wireless encrypted
9d7bd680-e0c7-4038-ab20-cb7bf590f0ef.png
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Canvas.Background>  <DrawingBrush><DrawingBrush.Drawing><DrawingGroup>
  <DrawingGroup x:Name="DrawingLayer">
    <DrawingGroup.ClipGeometry>
      <RectangleGeometry Rect="0,0,160,160" />
    </DrawingGroup.ClipGeometry>
    <DrawingGroup x:Name="g47" Transform="1,0,0,1,0,4.03785">
      <GeometryDrawing x:Name="path1761">
        <GeometryDrawing.Brush>
          <RadialGradientBrush Center="3.03981,1.05578" RadiusX="0.773346" RadiusY="0.773346" GradientOrigin="3.03981,1.05578" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <RadialGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>0.945877,0,0,1.05722,0.264368,0.249996</MatrixTransform>
                <MatrixTransform>0.343119,0.0837266,-0.0592633,0.120197,28.844,55.371</MatrixTransform>
              </TransformGroup>
            </RadialGradientBrush.Transform>
            <GradientStop Color="#FFCDFFFF" Offset="0" />
            <GradientStop Color="#E70C5D7D" Offset="1" />
          </RadialGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="4.03585" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter">
            <Pen.Brush>
              <SolidColorBrush Color="#FF0C5D7D" Opacity="0.99" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.343119,0.0837266,-0.0592633,0.120197,28.844,55.371" Figures="M35.399,39.1321L375.893,33.5501 377.219,548.198 35.399,548.198 35.399,39.1321z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path1762">
        <GeometryDrawing.Brush>
          <SolidColorBrush Color="#FFFFFFFF" Opacity="0.699301" Transform="0.343119,0.0837266,-0.0579864,0.117606,28.4038,56.2633" />
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="16.2714" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter">
            <Pen.Brush>
              <SolidColorBrush Color="#FF2EA6B9" Opacity="0.82" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.343119,0.0837266,-0.0579864,0.117606,28.4038,56.2633" Figures="M23.9471,20.1241L364.441,25.8291 365.767,535.103 23.9471,535.103 23.9471,20.1241z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path1764">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="2.69643,1.14655" EndPoint="3.85147,0.623116" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,-2.65767,-0.201241</MatrixTransform>
                <MatrixTransform>-0.377479,-0.35111,0.608169,-0.108749,100.73,203.492</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#E5D7FFFF" Offset="0" />
            <GradientStop Color="#F32EA6B9" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="7.27265" StartLineCap="Round" EndLineCap="Round" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF2EA6B9" Opacity="0.91" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="-0.377479,-0.35111,0.608169,-0.108749,100.73,203.492" Figures="M251.136,102.707L365.767,120.124 241.171,-3.33314 251.136,102.707z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path1033">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="2.69643,1.14655" EndPoint="3.85147,0.623116" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,-2.65767,-0.201241</MatrixTransform>
                <MatrixTransform>0.377479,0.35111,-0.608169,0.108749,58.0855,7.73449</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#E5D7FFFF" Offset="0" />
            <GradientStop Color="#F32EA6B9" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="7.27265" StartLineCap="Round" EndLineCap="Round" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF2EA6B9" Opacity="0.91" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.377479,0.35111,-0.608169,0.108749,58.0855,7.73449" Figures="M254.059,105.609L365.767,120.124 241.42,-2.12248 254.059,105.609z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path1035">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="2.69643,1.14655" EndPoint="3.85147,0.623116" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,-2.65767,-0.201241</MatrixTransform>
                <MatrixTransform>-0.566564,0.161296,-0.298853,-0.374622,253.198,106.511</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#E5D7FFFF" Offset="0" />
            <GradientStop Color="#F32EA6B9" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="7.19028" StartLineCap="Round" EndLineCap="Round" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF2EA6B9" Opacity="0.91" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="-0.566564,0.161296,-0.298853,-0.374622,253.198,106.511" Figures="M235.786,86.3366C235.568,97.5235 242.472,102.643 248.275,108.48 254.886,114.477 264.563,120.344 269.447,120.773L364.018,127.287 369.222,121.063 235.859,-12.3448 234.593,-5.9569 235.786,86.3366z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path1032">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="2.69643,1.14655" EndPoint="3.85147,0.623116" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,-2.65767,-0.201241</MatrixTransform>
                <MatrixTransform>0.61213,-0.209878,0.291546,0.432968,-107.633,113.839</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#E5D7FFFF" Offset="0" />
            <GradientStop Color="#F32EA6B9" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="6.42469" StartLineCap="Round" EndLineCap="Round" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF2EA6B9" Opacity="0.91" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="Nonzero" Transform="0.61213,-0.209878,0.291546,0.432968,-107.633,113.839" Figures="M239.418,91.2228C240.625,104.208 244.532,110.088 250.335,115.925 256.946,121.922 263.23,123.516 275.971,123.436L353.134,125.25 365.266,122.743 236.95,-6.48603 236.079,12.753 239.418,91.2228z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
    </DrawingGroup>
    <GeometryDrawing x:Name="path266">
      <GeometryDrawing.Brush>
        <LinearGradientBrush StartPoint="-0.01654,-0.546712" EndPoint="0.0148676,0.138341" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
          <LinearGradientBrush.Transform>
            <TransformGroup>
              <MatrixTransform>1.27999,-1.2809,0.380134,0.400852,0.419179,0.455777</MatrixTransform>
              <MatrixTransform>-0.224854,1.28309,-1.32246,-0.231754,180.986,12.4749</MatrixTransform>
            </TransformGroup>
          </LinearGradientBrush.Transform>
          <GradientStop Color="#FDFBDDB2" Offset="0" />
          <GradientStop Color="#F3EFA81A" Offset="1" />
        </LinearGradientBrush>
      </GeometryDrawing.Brush>
      <GeometryDrawing.Pen>
        <Pen Thickness="4" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Round">
          <Pen.Brush>
            <SolidColorBrush Color="#FF580400" Opacity="0.992157" />
          </Pen.Brush>
        </Pen>
      </GeometryDrawing.Pen>
      <GeometryDrawing.Geometry>
        <PathGeometry FillRule="Nonzero" Transform="-0.224854,1.28309,-1.32246,-0.231754,180.986,12.4749" Figures="M41.6706,66.0692L65.306,74.3775 14,84 22.2649,29.1887 29.102,54.2767C35.4348,45.7126 37.0391,44.8945 46.1854,35.4188 66.589,19.806 90.7515,11.1958 108.324,12.7748 99.3652,20.259 86.6398,27.3093 73.805,35.2633 59.6141,46.1963 54.9652,50.1565 41.6706,66.0692z" />
      </GeometryDrawing.Geometry>
    </GeometryDrawing>
  </DrawingGroup>
      </DrawingGroup></DrawingBrush.Drawing></DrawingBrush></Canvas.Background></Canvas>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dirk Bahle
Germany Germany
The Windows Presentation Foundation (WPF) and C# are one of my favorite past time hobbies since I started developing Edi:

https://edi.codeplex.com/

and a few other sub-projects on Codeplex. I am normally an algorithms and structure type person but WPF has such interesting sides that I cannot help myself but get into this and MVVM.

https://de.linkedin.com/in/dirkbahle

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 23 Oct 2012
Article Copyright 2012 by Dirk Bahle
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid