ReaderWMF & Gradient
#1
Hi,

I have a simple question:
Does the ReaderWMF treats the gradient color?

Because I have test to import an EMF file with gradient color from my favorite software Visio 2003. After transformation, the XAML string contains a drawing with many SolidColorBrush as ressources but they are never used.

My image is white when I use :
Code:
Image myImage = metafileReader.GetGeometryFromHemf(hEmf, GeometrySettings.BasicOptimization);

It that a normal behaviour ?

Antony.
#2
Hi,

Actually enhanced metafile could theoretically use gradients - at least there is a EMR_GRADIENTFILL record type. But so far I have not seen a single emf file that would use it (and I have seen lots of them).

Instead, gradients are composed of many polygons that stick together and where each of them have slightly different fill color defined - the colors that you saw defined in the resources (they are surely used in the XAML below).

This can be easily observed when you export your drawing as Shapes (instead of Geometries). For example:
Code:
<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"/>

But unfortunately there is a problem with this approach in WPF. It looks like there is a bug or some other problem in WPF that draws lines between two polygons or rectangles that lie one by another - actually have 2 points with the same coordinates. There should be no empty space between than (in GDI rendering of metafile there is no empty space), but in WPF you could see a thick line between them. Strange is that you can zoom in to the line and the line will still be very thick.

I am still not sure how to overcome this problem.

I have just posted a bug about it to Microsoft Connect:
https://connect.microsoft.com/VisualStud...-shown-wpf

I am not expecting any quick solution from them, but I think that they should be aver of this problem.

If anybody is having any idea, you are most welcome.
  


Forum Jump:


Users browsing this thread:
1 Guest(s)