WPF: Path stroke + Fill transparency artefact issue

by alski 25. June 2009 22:14

I’ve found an issue with rendering paths in WPF. To see this draw a path and use a partially transparent colour to render its Stroke and another partially transparent colour for the fill

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>  
   <Path Data="M0,0 L1,0 1,1 0,1 Z" Stroke="#800000ff" StrokeThickness="40" Fill="#8000ff00"
       Width="100" Height="100" Stretch="Fill" ></Path>
  </Grid>
</Page>

image

Where did the third colour come from? Well it appears that a stroke is drawn inside the path that you construct but the fill starts halfway into the width of the stroke. It doesn’t matter how thick the stroke is, the fill always starts halfway through.

How do I fix this?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS