Search

When scaling Polygons that are close together artifacts are shown (WPF) by Andrej Benedik

Closed
as By Design Help for as By Design

2
0
Sign in
to vote
Type: Bug
ID: 572019
Opened: 6/30/2010 3:47:31 PM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
The following WPF xaml shows artifacts (white lines) between polygons - the lines are actually background that is visible through, but becuase the polygons are define one next to another, there should be no empty space between them.

The xaml is rendered correctly if ScaleX is 1 (no scale), but with any other value different white lines are shown.

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
     <Canvas Width="200" Height="200" >
        <Canvas.RenderTransform>
            <ScaleTransform ScaleX="0.8"/>
        </Canvas.RenderTransform>        
        <Polygon Points="106,20 106,120 109,120 109,20" Fill="#FFA603AB"/>
        <Polygon Points="109,20 109,120 113,120 113,20" Fill="#FFA804A9"/>
        <Polygon Points="113,20 113,120 116,120 116,20" Fill="#FFAA04A7"/>
        <Polygon Points="116,20 116,120 118,120 118,20" Fill="#FFAB05A5"/>
        <Polygon Points="118,20 118,120 120,120 120,20" Fill="#FFAD05A4"/>
        <Polygon Points="120,20 120,120 122,120 122,20" Fill="#FFAE06A2"/>
    </Canvas>
</Grid>
</Page>

This works the same in .Net 3.0, 3.5 SP1 and 4.0 and in Tier 0 (Virtual PC) and Tier 2 (ATI HD 4850)

Note: The upper xaml is part of the xaml that was generated from metafile with Paste2Xaml (metafiles do not support gradients but define them as set of polygons).
Details (expand)

Product Language

English

Visual Studio Version

.NET Framework 4

Operating System

Windows 7

Operating System Language

English

Steps to Reproduce

Copy the xaml above into xaml file in WPF project (Visual Studio 2008 or 2010). When ScaleX is 1 the rendering is correct, but when ScaleX is changed, some artifacts begin to show.

Actual Results

The above xaml is not correctly renderd.

Expected Results

No empty space (background) should be rendered between polygons.
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey.

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 7/5/2010 at 1:12 PM
Unfortunately, this is a well-known limitation for WPF. We use extensive anti-aliasing and we do not handle abutting shapes correctly. There are some workarounds for limited scenarios: layout rounding and pixel snapping. But these do not work in all scenarios.

http://msdn.microsoft.com/en-us/library/aa970908(VS.85).aspx
Posted by Microsoft on 7/1/2010 at 10:31 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/1/2010 at 5:01 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.