SVG -> WPF linear gradient
Posted
by Otaku
on Stack Overflow
See other posts from Stack Overflow
or by Otaku
Published on 2009-08-30T04:05:55Z
Indexed on
2010/03/15
18:59 UTC
Read the original article
Hit count: 549
Does anyone know if there is an equilant attribute of SVG's "gradientUnits=userSpaceOnUse" in WPF for a LinearGradientBrush? I can't seem to find this.
If not, does anyone know about how to calculate it in (C# or VB.NET)? For example if I have a StartPoint of 0,0 and EndPoint of 1,1 on a Rectangle that is 100x100, the angle is 45 degrees. However, when I change either the width or height of the Rectangle, for example Width=150, the axis is no longer at 45 degrees. How could I calculate to keep the angle at 45 degrees in a rectangle that is not a square so that it runs from bottom left to top right corner for a middle gradientstop.
© Stack Overflow or respective owner