Click here to Skip to main content
15,886,067 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.3K   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="-9.38676116099305" Canvas.Top="-0.690304263178405">
    <Canvas>
      <Canvas>
        <Canvas>
          <Path Data="F1M340.65368,448.95599C332.44825,473.90459 286.95395,488.04323 237.34157,485.87384 187.72919,483.70445 152.69325,466.04448 160.89869,441.09589 169.10414,416.1473 217.45906,393.31102 267.07142,395.48039 316.6838,397.64977 348.85913,424.00739 340.65368,448.95599z" Fill="#44000000" Stroke="{x:Null}" StrokeThickness="1" Opacity="0.26808514" />
          <Path Data="F1M350.29695,346.24575C349.36955,421.78083 304.32799,469.3722 249.55859,468.69976 194.78919,468.02729 150.92968,419.34435 151.8571,343.80931 152.78451,268.27426 198.1494,194.34963 252.91879,195.02208 307.68817,195.69451 351.22436,270.7107 350.29695,346.24575z" Fill="#FFE9B96E" Stroke="#FFC17D11" StrokeThickness="6" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeLineJoin="Bevel" StrokeMiterLimit="4" />
          <Path Data="F1M252.84375,201.03125C228.17805,200.72841 204.77487,217.37669 187.1875,244.125 169.60013,270.87331 158.29301,307.28437 157.84375,343.875 156.94524,417.05541 198.36982,462.05817 249.625,462.6875 300.88024,463.31679 343.41402,419.36822 344.3125,346.1875 344.76175,309.59758 334.33822,272.92249 317.40625,245.75 300.47428,218.57751 277.50942,201.33408 252.84375,201.03125z" Fill="{x:Null}" Stroke="#78FFFFFF" StrokeThickness="6" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeLineJoin="Bevel" StrokeMiterLimit="4" Opacity="0.47234042" />
          <Path Data="F1M350.29695,346.24575C349.36955,421.78083 304.32799,469.3722 249.55859,468.69976 194.78919,468.02729 150.92968,419.34435 151.8571,343.80931 152.78451,268.27426 198.1494,194.34963 252.91879,195.02208 307.68817,195.69451 351.22436,270.7107 350.29695,346.24575z" Stroke="{x:Null}" StrokeThickness="1" Opacity="0.37021275">
            <Path.Fill>
              <LinearGradientBrush StartPoint="191.23862,331.86215" EndPoint="350.31149,331.86215" MappingMode="Absolute" SpreadMethod="Pad">
                <LinearGradientBrush.GradientStops>
                  <GradientStop Color="#FFFFFFFF" Offset="0" />
                  <GradientStop Color="#00FFFFFF" Offset="1" />
                </LinearGradientBrush.GradientStops>
              </LinearGradientBrush>
            </Path.Fill>
          </Path>
        </Canvas>
        <Canvas.RenderTransform>
          <MatrixTransform Matrix="0.144934892654419,0,0,0.144934892654419,-12.1857347488403,-27.1397361755371" />
        </Canvas.RenderTransform>
      </Canvas>
    </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