Wrongly filled EMF file
#1
I tried to render some EMF files with ReadGeometry() method. File version of Ab2d.ReaderWmf.dll is 7.2.5960.1045.
Attached file (yy.eml) consists from 2 overlapping drawings, both are filled in green.
It is displayed in Paint, Powerpoint, Libreoffice Draw etc as expected, most inner parts are filled.
However rendered result is different, some parts are not filled.

So far I have tried both GeometrySettings.FullOptimization and GeometrySettings.NoOptimization but the result is same.
I also attached capture image of expected result (expected.png) and rendered result (result.png).

Best Wishes,


Attached Files Thumbnail(s)
       

.emf   yy.emf (Size: 824 bytes / Downloads: 2)
#2
If I changed the color of one of the drawings, no problems in the result, xaml of which got via ReadXML() looks:


<Image xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Stretch="Uniform">
    <Image.Resources>
    </Image.Resources>
    <Image.Source>
        <DrawingImage xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" PresentationOptions:Freeze="True">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="Aqua" Geometry="F1M807,379L630,578 407,724 322,471 308,204 569,258z"/>
                    <GeometryDrawing Brush="Green" Geometry="F1M889,0L544,988 1002,1092 318,299 0,643 1029,448z"/>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Image.Source>
</Image>

However with original file, 2 GeometryDrawing entry is combined into one:

            <DrawingImage.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="Green" Geometry="F1M807,379L630,578 407,724 322,471 308,204 569,258z M889,0L544,988 1002,1092 318,299 0,643 1029,448z"/>
                </DrawingGroup>
            </DrawingImage.Drawing>

Is it the cause of this problem?
#3
I cannot reproduce your problem.

It works correctly in Paste2Xaml and in a simple application that uses ReaderWmf.

In Paste2Xaml I got the following xaml:

    <Image Stretch="Uniform">
        <Image.Source>
            <DrawingImage>
                <DrawingImage.Drawing>
                    <DrawingGroup>
                        <GeometryDrawing Brush="Green" Geometry="F1M807,379L630,578L407,724L322,471L308,204L569,258z"/>
                        <GeometryDrawing Brush="Green" Geometry="F1M889,0L544,988L1002,1092L318,299L0,643L1029,448z"/>
                    </DrawingGroup>
                </DrawingImage.Drawing>
            </DrawingImage>
        </Image.Source>
    </Image>

The simple test application was:
var readerWmf = new Ab2d.ReaderWmf();
var image = r.ReadGeometry(@"C:\Users\Andrej\Downloads\yy.emf");
RootGrid.Children.Add(image);

But the problem happened when the geometries are combined. With this option it is not possible to correctly generate the xaml.

Cold you please check again.
Andrej Benedik
#4
I confirmed it shows as expected as long as CombineGeometries is unset.
(Sorry, I had checked xaml of other instance that are not passed to viewer.)
Thank you for your support.
  


Forum Jump:


Users browsing this thread:
1 Guest(s)