Improved performance of new version of ReaderSvg library

by abenedik 1. June 2010 15:33

The biggest improvement of the new version of ReaderSvg is improved performance.

To prepare the new version a lot of time was spent in a profiler. I used some very complex files from some common applications that can save drawings into svg file.

It was quickly clear that the most of the CPU cycles were spend to solve svg's style inheritance. A lot of the time was also used to resolve many possibilities to define styles in svg file (svg styles, css, attributes, ect.).

For example if we have a complex hierarchy, the root group element can define stroke thickness for the path element that is 10 children away. The process of getting the correct style declarations was before not optimal and is now much faster.

The SVG Specification allows some very complex stlye declararions that are very rarely used. The code that tries to support all the possibilities is much quite complex and takes significant time to execute. I have analyzed the svg files I have (really a lot of them - lots of them from users feedback) and found out that almost all of them are using only simple style declarations. So I have decided that by default only simple style declarations would be processed. But if needed the complex style processing can be used by setting the new OptimizeStyleProcessing property on ReaderSvg to false.

For example the following style declaration is by default not processed correctly (but magically it is read correctly with setting OptimizeStyleProcessing to false):

<defs>
   <style type="text/css"><![CDATA[
            .mummy circle, .mummy rect, .mummy polygon { fill: green}
            .mummy > .thischild { fill: red }
            .primus + .secundus { fill: red }
            .mummy circle:first-child { fill: red}
         ]]></style>
</defs>

 

Improved performance is not the only improvement. There is more:

  • Added support for text and tspan baseline-shift.
  • Now polyline and polygon are read as WPF's Polyline and Polygon elements (in previous version they were read as Path).
  • Fixed measuring size - improved for bigger stroke thickness on some shapes (when AutoSize property on ReaderSvg is true - by default).
  • Fixed SvgViewbox and SvgDrawing controls - they do not throw exceptions when Source is not set but some other property like AutoSize is set.


As usual the existing customers can download the new version from their User Account page. Others can download a 60-days trial version from my Downloads page.

Tags: , , ,

ReaderSvg

Improved design time support for Visual Studio 2010 and Blend

by abenedik 23. April 2010 20:22

We are all very excited about the new Visual Studio 2010.

Among other great new features there is also a new visual designer for Silverlight projects. But the new designer still has some problems. One of them was reported by "ttiggemann" on my forum and is related to xaml created from svg file with ViewerSvg.

The problem is that RenderTransfrom that is written as attribute is not well formed for the designer.

For example the following line is reported as incorrect:

<Canvas RenderTransfrom="1.5 0 0 1.5 100 50">

Such xaml is compiled successfully and also runs correctly shown in the Silverlight application.

The workaround for the designer is to change the attribute into element:

<Canvas>
    <Canvas.RenderTransfrom>
        <MatrixTransform>1.5 0 0 1.5 100 50</MatrixTransform>
    </Canvas.RenderTransfrom>
</Canvas>

 

The same problems occur in Expression Blend.

 

To support this case the Ab2d.ReaderSvg library and the ViewerSvg applications have been changed.

In Ab2d.ReaderSvg library there are now additional properties in BaseXamlWriterSettings that can be passed to GetXaml method. The WriteTransformationsAsElement can be set to true to write RenderTransfroms as elements instead of attributes. This property is by default set to false for xaml for WPF and to true for Silverlight xaml.

The xaml is now furher optimized by converting the transformation that only translate the objects into Canvas.Left and Canvas.Top properties.

For example the following:

<Path RenderTransfrom="1 0 0 1 100 50" ...

is now by default changed into:

<Path Canvas.Left="100" Canvas.Top="50" ...

This behavior is controlled by new UseCanvasPositionForTranslateTransform property on BaseXamlWriterSettings class.

 

The new properties are also reflected in ViewerSvg. This is the screenshot of the new export dialog (new options are marked with red):

ViewerSvg export dialog

 

Besides new settings for displaying transformations, there are also two additional new settings.

Now it is possible to control if the default xaml namespace is added to the xaml (useful when exporting as Canvas, Viewbox, etc.)

Also by default the number of displayed decimals is now unlimited - because in most cases the xaml is compiled so the number of decimals in xaml does not affect the size of the final product.

 

Unfortunately the RenderTransform is not the only problem. The xaml with changed transformations is still not shown in the Visual Studio 2010 designer.

The reason for this is a bug in VS. It does not show Path elements that are children of a Canvas. Frown

For example the following xaml is not shown in the designer:

<Canvas Width="400" Height="300">
    <Path Fill="Red" Stroke="Black" StrokeThickness="2" Data="M10,10 L300,10 300,100 10,100z"/>
    <Path Stroke="Blue" StrokeThickness="2">
        <Path.Data>
            <LineGeometry StartPoint="10 10" EndPoint="100 100"/>
        </Path.Data>
    </Path>
</Canvas>

I have already submitted the problem to Microsoft Connect and it is already confirmed as a bug. Hopefully there will be a fix for it available soon. Please vote for the bug here and help programmers to decide what to fix first.

 

But the good news is that the new xaml export options fix the problems with the visual designer in Expression Blend.

 

Besides changes in generated xaml there are also two other improvement in the new ReaderSvg:

  • Added support for some svg files that define url references with "&quot;" - for example: style="stroke: url(&quot;#linearGradient4603&quot;)".
  • Added support for lengthAdjust attribute in text and tspan elements.

 

As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

Tags: , ,

ReaderSvg

New major update of ReaderSvg with additional support for Microsoft Visio released

by abenedik 29. March 2010 09:22

 

I am happy to announce that a new major update for Ab2d.ReaderSvg library has been released.

ViewerSvg, a svg to xaml converter for WPF and Silverlight, has also been improved.

ViewerSvg

The new version 4.0 brings many new features and improvements. The most important new features are support for svg marker element (adds support for arrows and other line start and end markers) and svg symbol element (adds support for embedded fonts and other symbols).

But I am the most excited about the additional support for svg files created in Microsoft Visio. One step for improved Visio support was the implementation of marker elements (for connection line arrows). Another change was that now the names of read objects can be get from svg id attribute (as in most svg files) or from svg title element (used by Visio). This means that the names of the objects that were defined in Microsoft Visio are preserved when the svg file is read.

But I did not stop there. I have also added support for layers defined in Visio and for reading custom properties and attached data.

Some time ago I have found a demonstration on how to connect data to Visio diagram. I was amazed with how easy is to do this and how good the results look like. The demonstration can be seen here: http://office.microsoft.com/en-us/visio/HA100518191033.aspx

The demonstration ends with the statement: "the possibilities are endless".

Now imagine that it is also possible to get the Visio diagram with embedded data and animate it, add mouse events to the diagram elements and make other modification of the diagram in a WPF or a Silverlight application.

This is very easy to do with ViewerSvg or Ab2d.ReaderSvg library.

With ViwerSvg it is possible to convert diagrams from svg file to xaml file. It also possible to export the embedded data into xml serialized DataTable. It is easy to use the xaml and the xml (DataTable) to create WPF or Silverlight applications.

With using Ab2d.ReaderSvg in WPF application it is possible to open the svg file directly in the application. The embedded data and the data about layers can be accessed from the application (note that layers data cannot be exported from ViewerSvg and therefore cannot be used in Silverlight applications).

The new version of ReaderSvg comes with new samples that demonstrate various uses of diagram data and layers. The following screenshots show one scenario:


Creating Network diagram in Microsoft Visio:

Network diagram in Visio


Network diagram opened in ViewerSvg with previewing the embedded data:

Network diagram in ViewerSvg


Network diagram svg file opened in WPF application with Ab2d.ReaderSvg:
Network diagram in WPF

 

To see more screenshots and complete list of features check out the new ViewerSvg and the Ab2d.ReaderSvg pages.

 

Here is a full list of changes in Ab2d.ReaderSvg v4.0:

  • Added support for "marker" svg element - add support for arrows and other line start and end markers
  • Added support for "symbol" svg element - this also adds support for embedded fonts inside svg file
  • Added support for "clipPath" - object clipping
  • Added support for "use" element
  • Added support for xml:space="preserve" attribute - preserves the space before and after the text
  • Added support for textLength attribute in text and tspan elements
  • Fixed reading Rect data written with ',' instead of ' ' (for example '0,0,1,1' works now)
  • The Name property on the read objects is now set (so it is not needed to use NamedObjects dictionary or GetObjectName method). Setting Name can be turned off wuth SetNameProperty no ReaderSvg.
  • Improved the algorithm to correct the names read from svg file (now the name is not changed to lower case any more and also all letters are allowed and not only letters from 'a' to 'z').
  • Added FallbackBrush property to SilverlightXamlWriterSettings so it is possible to control which brush is used instead of VisualBrush that is not supported in Silverlight
  • Added GetLayerNames and GetElementsForLayerName methods to read layer information from svg file defined in Microsoft Visio
  • Added support to read embedded data from svg file created in Microsoft Visio - added the following methods: GetCustomProperties, GetObjectsWithCustomProperties, GetCustomPropertiesDataTable
  • Added NamedObjectsSource property to ReaderSvg to specify the source of the object names - for example for Microsoft Visio or other application that do not allow to set the svg's id attribute, the NamedObjectsSource can be set to NamedObjectsSourceType.Title or NamedObjectsSourceType.TitleIfExist.
  • Added NamedObjectsSource property to SvgViewbox and SvgDrawing


The following is a list of changes in ViewerSvg application:

  • Added support for showing custom properties defined in svg file
  • Improved selection of objects
  • Added Export image button - export selected element into bitmap image
  • Added batch convertion of svg files to XAML for Silverlight

 

The 60-day evaluation version can be downloaded from my Downloads page. (If you already have an evaluation version, please uninstall it before installing the new version)

The existing customers can get the new version from their Users Account page (note that the commercial version is now different from the evaluation version available from my Downloads page)

Tags: , ,

ReaderSvg

Major update for Ab2d.ReaderWmf published

by abenedik 10. February 2010 22:20

I am proud to announce that a major update for Ab2d.ReaderWmf library was released.

Ab2d.ReaderWmf library can read Windows metafiles (wmf), Enhanced Metafiles (emf) or get metafile content from clipboard and convert the read objects into WPF elements or export the read objects into XAML for WPF or Silverlight.

The library went through thorough refactoring and is now much faster (this is especially useful with big metafiles that are exported from AutoCad). It can also read metafiles much more accurately.

Existing users that tried to convert Microsoft Office 2007 elements into XAML were probably not satisfied with the quality of the bitmap images that were part of the exported elements. This is now fixed because the new version of Ab2d.ReaderWmf can read the high quality images that are embedded into EMF+ records that are used with Office 2007.

The following two images show the difference:

Export from Excel with old ReaderWmf
Export from Excel with new ReaderWmf

There are also some other improvements and fixes. Here is the fill list of changes:

  • Greatly improved performance when reading metafiles.
  • Greatly improved reading and pasting objects from Microsoft Office 2007 - images are now read from EMF+ part of the matafile and are much better quality than images stored in EMF part of the metafile.
  • Added support for Pie and Chord elements.
  • Added support for stretched text (condensed, widened).
  • Fixed licensing issues on 64 bit Windows.
  • Fixed importing text rotated by 180 degrees.
  • Added ReadGeometry methods without geometry settings parameters that use default NoOptimization geometry settings (simplified use of ReadGeometry).
  • Improved support for clipping.
  • Changed calculation of MinLineWidthFactor (see help for more info).
  • Imporved GetXaml - now know colors are by default displayed by their name (Black, Red, etc.). This can be turned off by setting UseColorNames property on XamlWriterSettings.
  • Separate evaluation and commercial version.

 

Paste2Xaml application was also improved.

Now it has support for batch exporting metafiles into XAML for Silverlight (before only export for WPF was available).

The following two screenshots show Paste2Xaml in action (the first showing Excel Graph that was pasted into the application and the other drawing created in AutoCad and exported to metafile):

Paste2Xaml with graph pasted from MS Excel

Drawing created in AutoCad and exported as metafile

 

IMPORTANT NOTICE:

Existing customers of Ab2d.ReaderWmf and Paste2Xaml should get the new version from their User Account page (login credentials were provided in the email that was send to you after purchasing the product).

Other users who are still evaluating the product or would like to try it, can get the evaluation version from my Downloads page.

Tags: , ,

ReaderWmf

Added 13 payment options with integrating Gate2Shop services

by abenedik 28. January 2010 21:07

I have just finished with integration of Gate2Shop services into my Purchase page.

This brings 13 more payment options:

Credit Cards: Visa, Mastercard, Diners, Carta Si, American Express
Debit Card: Maestro, Solo, Switch, Visa Electron, Delta, Dankort, Carte Bleue
ClickandBuy

Gate2Shop logo

 

I must admit that I hear for some of them for the first time.

Anoter advantage of Gate2Shop is that users do not need to create an account on Gate2Shop to make the payment (this has to be done with PayPal).

 

Another change that I am proud of is that from a few days ago all the installers, that can be downloaded from my site, are now digitally signed - no more "Unknown publisher" warning when trying to install them Cool.

Tags:

Web Page

New version of Paste2Xaml application available

by abenedik 2. January 2010 16:38

A new version of Paste2Xaml application is available.

It fixes some problem with the previous version. It can be downloaded from my Downloads page.

 

Here is a short description of the application.

As its name suggests, it can be used to copy vector graphics from almost any 2D vector drawing application and simply paste it into Paset2Xaml. There it can be exported into XAML than be used for WPF and Silverlight. The application can be also used to open Windows Matafiles (wmf) or Enhanced Metafiles (emf) and convert them into XAML.

It is internally using Ab2d.ReaderWmf library that can be also used in your application to read metafiles at runtime.

 

The following example is showing the Paste2Xaml screenshot after the graph from Excel 2003 has been pasted into the application.

Paste2Xaml with Excel graph

Note:

For creating xaml from Excel graphs I recommend using Excel 2003. The Excel 2007 usually does not put the graph as vector data into the clipboard. Instead it renders the graph into bitmap and stores graph as image into the clipboard. This usually happens for 3D graphs or when special effects are used (shadows, etc.). Simple 2D graphs are pasted as vector elements. But for 3D graphs, Excel 2003 is recommended.

 

There is also a Silverlight tutorial on how to create animated graph from Excel - check it out here.

 

The following are screenshots of metafiles converted to xaml and show in IE (click on image to see it in full size):


Word art from Microsoft Word 2003

Formated cells from Microsoft Excel 2007
   

Calendar created in Microsoft Visio 2003

Database schema created in Microsoft Visio 2003
   

Meeting Room schema created in Microsoft Visio 2003

Electrical equipment schema created in Microsoft Visio 2003
   

Brainstorm diagram created in Microsoft Visio 2003

Sample from Microsoft Office free Clip Arts
   

Sample from Microsoft Office free Clip Arts

Sample from Microsoft Office free Clip Arts
   

Sample from Microsoft Office free Clip Arts

Sample from Microsoft Office free Clip Arts

Tags: , , ,

ReaderWmf

20% discount for Ab3d.PowerToys and Ab3d.Reader3ds Pro

by abenedik 21. December 2009 10:37

Santa

To celebrate the launch of Ab3d.PowerToys and to bring some christmas felling to my web page, I have decided to give you 20% discount for all Ab3d.PowerToys licenses and to Ab3d.Reader3ds Pro licenses.

To apply for the discount enter "PowerToys" into the discount textbox on my Purchse page. Than click Apply and add the items to shopping cart.

The discount is valid until the end of January 2010.

 

And here is another gift. A 3D santa model (available in 3ds and xaml):

Santa3D.zip (473.10 kb)


Merry Christmas and Happy New Year!

Tags:

Ab3d.PowerToys | Reader3ds