Click here to Skip to main content
15,895,084 members
Articles / Desktop Programming / WPF

Convert XAML Vector Graphic to PNG

Rate me:
Please Sign up or sign in to vote.
4.87/5 (11 votes)
23 Oct 2012CPOL12 min read 74.5K   6.8K   43  
An introduction to the usage of vector graphics as a source of bitmap graphics.
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Canvas Canvas.Left="-7.11613036063955" Canvas.Top="-11.0200489163399">
    <Canvas>
      <Path Data="F1M33.278212,34.94062A10.31934,2.320194,0,1,1,12.639532,34.94062A10.31934,2.320194,0,1,1,33.278212,34.94062z" Stroke="{x:Null}" StrokeThickness="1" Opacity="0.10824742">
        <Path.Fill>
          <RadialGradientBrush Center="23.070683,35.127438" RadiusX="10.31934" RadiusY="10.31934" GradientOrigin="23.070683,35.127438" MappingMode="Absolute">
            <RadialGradientBrush.GradientStops>
              <GradientStop Color="#FF000000" Offset="0" />
              <GradientStop Color="#00000000" Offset="1" />
            </RadialGradientBrush.GradientStops>
            <RadialGradientBrush.Transform>
              <MatrixTransform Matrix="0.914812028408051,0.0126502299681306,-0.00821502041071653,0.213561996817589,2.25391411781311,27.1888904571533" />
            </RadialGradientBrush.Transform>
          </RadialGradientBrush>
        </Path.Fill>
        <Path.RenderTransform>
          <MatrixTransform Matrix="1.55048704147339,0,0,1.97871398925781,-12.4813003540039,-32.4910316467285" />
        </Path.RenderTransform>
      </Path>
      <Path Data="F1M27.514356,37.542682L27.514356,28.515722 37.49282,28.475543 37.49282,21.480219 27.523285,21.480219 27.514356,11.520049 20.498082,11.53121 20.502546,21.462362 10.51292,21.536022 10.477206,28.504561 20.511475,28.475543 20.518171,37.515896 27.514356,37.542682z" Fill="#FF75A1D0" Stroke="#FF3465A4" StrokeThickness="1.00000035762787" StrokeMiterLimit="4" />
      <Path Data="F1M26.498702,36.53392L26.498702,27.499738 36.501304,27.499738 36.494607,22.475309 26.50763,22.475309 26.50763,12.480335 21.512796,12.498193 21.521725,22.475309 11.495536,22.493166 11.46875,27.466256 21.533143,27.475185 21.51975,36.50267 26.498702,36.53392z" StrokeThickness="1.00000059604645" StrokeMiterLimit="4" Opacity="0.40860215">
        <Path.Fill>
          <LinearGradientBrush StartPoint="16.8749981241455,22.8517991196289" EndPoint="27.9008461241455,34.9767991196289" MappingMode="Absolute" SpreadMethod="Pad">
            <LinearGradientBrush.GradientStops>
              <GradientStop Color="#FF729FCF" Offset="0" />
              <GradientStop Color="#FF5187D6" Offset="1" />
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Path.Fill>
        <Path.Stroke>
          <LinearGradientBrush StartPoint="16.874998,22.851799" EndPoint="27.900846,34.976799" MappingMode="Absolute" SpreadMethod="Pad">
            <LinearGradientBrush.GradientStops>
              <GradientStop Color="#FFFFFFFF" Offset="0" />
              <GradientStop Color="#57FFFFFF" Offset="1" />
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Path.Stroke>
      </Path>
      <Path Data="M11,25C11,26.9375,36.984375,24.03125,36.984375,24.96875L36.984375,21.96875 27,22 27,12.034772 21,12.034772 21,22 11,22 11,25z" Fill="#50FFFFFF" Stroke="{x:Null}" StrokeThickness="1" Opacity="0.31182796" />
    </Canvas>
  </Canvas>
</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)


Written By
Germany Germany
The Windows Presentation Foundation (WPF) and C# are among my favorites and so I developed Edi

and a few other projects on GitHub. I am normally an algorithms and structure type but WPF has such interesting UI sides that I cannot help myself but get into it.

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

Comments and Discussions