Click here to Skip to main content
11,644,731 members (66,721 online)
Click here to Skip to main content
Add your own
alternative version

Convert XAML Vector Graphic to PNG

, 23 Oct 2012 CPOL 29.2K 3.6K 36
An introduction to the usage of vector graphics as a source of bitmap graphics.
OpenIconLibrary.zip
PNG
XAML
arrow-down-dash-small.backup
TangoProject.zip
XAMLtoPNG.zip
XAMLtoPNG
Properties
XAMLtoPNG.csproj.user
XAMLToPNG_Sample.zip
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,507.946,507.946" />
    </DrawingGroup.ClipGeometry>
    <DrawingGroup x:Name="g2795">
      <GeometryDrawing x:Name="rect14">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="0.145454,0.257812" EndPoint="0.599999,0.570312" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1" Transform="1,0,0,1,-7.61378E-09,-1.86769E-08">
            <GradientStop Color="#FDFBDDB2" Offset="0" />
            <GradientStop Color="#F3EFA81A" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="11.905" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter">
            <Pen.Brush>
              <SolidColorBrush Color="#FF580400" Opacity="0.992157" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <RectangleGeometry RadiusX="0" RadiusY="0" Rect="126.604,52.0403,51.3235,120.5982" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path15">
        <GeometryDrawing.Pen>
          <Pen Thickness="11.905" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF154850" Opacity="0.988235" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M111.364,481.507C382.161,479.905,383.764,481.507,383.764,481.507L382.161,253.973 247.564,120.978 112.966,257.178C111.363,258.78,112.966,479.905,111.364,481.507z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path48">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="-0.0270271,0.46875" EndPoint="0.783784,0.476562" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,3.52391E-08,-2.90476E-08</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-12.0839,-29.7941</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#FD787878" Offset="0" />
            <GradientStop Color="#FDFFFFFF" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M117.773,475.097C177.06,475.097 177.06,473.495 177.06,473.495 177.06,473.495 177.06,302.044 177.06,302.044 177.06,302.044 119.375,258.78 119.375,258.78 116.17,260.382 117.773,476.7 117.773,475.097z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path49">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="0.235289,0.265619" EndPoint="0.672269,0.59375" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,1.18803E-07,-1.01189E-08</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-12.0839,-29.7941</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#FD787878" Offset="0" />
            <GradientStop Color="#FDFFFFFF" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M117.773,258.78L242.756,132.194 271.6,217.118 177.06,302.044 117.773,258.78z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path51">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="0.981639,0.0312495" EndPoint="0.146789,0.601562" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,-5.18186E-08,1.7497E-08</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-12.0839,-29.7941</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#FD787878" Offset="0" />
            <GradientStop Color="#FDFFFFFF" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M229.938,205.902L252.371,130.592 375.752,255.575 316.464,306.85 229.938,205.902z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path52">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="1.20507,0.523438" EndPoint="0.102482,0.515617" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,8.20491E-05,8.70101E-06</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-12.0839,-29.7941</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#FD787878" Offset="0" />
            <GradientStop Color="#FDFFFFFF" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M314.862,475.098L313.26,302.044 377.354,253.973 378.957,475.098 314.862,475.098z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path13">
        <GeometryDrawing.Brush>
          <RadialGradientBrush Center="5.85956,5.90413" RadiusX="0.928056" RadiusY="0.928056" GradientOrigin="5.85956,5.90413" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <RadialGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>0.981788,0,0,1.01855,0.891037,0.918408</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-5.19257,-47.0224</MatrixTransform>
              </TransformGroup>
            </RadialGradientBrush.Transform>
            <GradientStop Color="#FF006C8B" Offset="0" />
            <GradientStop Color="#FFBDDAFF" Offset="1" />
          </RadialGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="11.9213" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Round">
            <Pen.Brush>
              <SolidColorBrush Color="#FF1C6671" Opacity="0.988235" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-5.19257,-47.0224" Figures="M177.06,486.314L175.458,332.488C175.458,295.634 195.487,269.997 237.949,269.997 282.014,269.997 303.646,300.441 303.646,332.488L303.646,486.314C303.646,486.314,177.06,484.712,177.06,486.314z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
      <GeometryDrawing x:Name="path16">
        <GeometryDrawing.Brush>
          <LinearGradientBrush StartPoint="0.242009,0.382812" EndPoint="0.497717,0.507812" MappingMode="RelativeToBoundingBox" SpreadMethod="Pad" Opacity="1">
            <LinearGradientBrush.Transform>
              <TransformGroup>
                <MatrixTransform>1,0,0,1,5.50934E-10,1.51001E-09</MatrixTransform>
                <MatrixTransform>1.07519,0,0,1.07519,-12.0839,-29.7941</MatrixTransform>
              </TransformGroup>
            </LinearGradientBrush.Transform>
            <GradientStop Color="#FDCA536D" Offset="0" />
            <GradientStop Color="#F3A81837" Offset="1" />
          </LinearGradientBrush>
        </GeometryDrawing.Brush>
        <GeometryDrawing.Pen>
          <Pen Thickness="11.905" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter">
            <Pen.Brush>
              <SolidColorBrush Color="#FF580400" Opacity="0.992157" />
            </Pen.Brush>
          </Pen>
        </GeometryDrawing.Pen>
        <GeometryDrawing.Geometry>
          <PathGeometry FillRule="EvenOdd" Transform="1.07519,0,0,1.07519,-12.0839,-29.7941" Figures="M63.293,303.646C213.914,159.434 213.914,159.434 213.914,159.434 213.914,159.434 282.815,157.832 284.417,157.832 286.02,157.832 423.822,295.634 423.822,295.634 423.822,295.634 455.87,261.985 455.87,261.985 455.87,261.985 249.166,55.2812 249.166,55.2812 249.166,55.2812 32.8482,269.997 32.8482,269.997 32.8482,269.997 63.293,303.646 63.293,303.646z" />
        </GeometryDrawing.Geometry>
      </GeometryDrawing>
    </DrawingGroup>
  </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

Dirkster99
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.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 23 Oct 2012
Article Copyright 2012 by Dirkster99
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid