elecman
Topic Author
Posts: 90
Joined: 20 Jul 2014, 04:28

Rotation center with XAML export

07 Feb 2015, 05:40

I noticed that an XAML file exported by InkScape does not contain object rotation center information. This is a major issue for my project as many objects shouldn't rotate around its center, so I can't use
SetRenderTransformOrigin(new Point(0.5f, 0.5f))
;

The XAML format support this: https://msdn.microsoft.com/en-us/librar ... 10%29.aspx

So is it an InkScape bug / lack of feature?
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Rotation center with XAML export

07 Feb 2015, 15:15

You should be able to set the rotation center by code (property RenderTransformOrigin). Remember that it is relative to the bound of the element. So, 0.5 is the center.
 
elecman
Topic Author
Posts: 90
Joined: 20 Jul 2014, 04:28

Re: Rotation center with XAML export

07 Feb 2015, 16:48

Setting the rotation center by code is possible, but it still requires you to know the coordinates of the rotation center. But this information is only available in the SVG. So this fix would required you to load the SVG, scan file for the missing information, and then inject it into the XAML file.

I filed a bug report for InkScape which has since been confirmed:
https://bugs.launchpad.net/inkscape/+bug/1419229

I'm a bit surprised no one else came across this bug though. For example, if you create a gauge, you have to place the rotation center at the base of the pointer. Doing this in InkScape and exporting to XAML will instantly materialize this bug. I saw that one of the examples consists of a few pointer gauges. With which program was that designed then?

Either way, I am going to write a standalone program which solves this by modifying an existing XAML by adding the missing rotation centers from the SVG source. Will post it here when done. I am sure others will find it useful until they guys at InkScape fix it.
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Rotation center with XAML export

09 Feb 2015, 14:01

The gauges sample was initially designed by an artist in Adobe Illustrator, then fine tuned by me in Microsoft Expression Blend for things like adjusting pointers rotation centers. It was a manual work, but very fast to accomplish within Blend.

But as you explained it would be better to have that information directly from the artist design.
 
elecman
Topic Author
Posts: 90
Joined: 20 Jul 2014, 04:28

Re: Rotation center with XAML export

12 Feb 2015, 09:31

I did some more research regarding the xaml exporter in Inkscape. I guess the best way is to modify the source and go through the politics of getting the moderators to include it in a release version. Second best would be to write an extension. But unfortunately, for both options, I am way in over my head. Getting InkScape to compile on Windows is not easy, and even on Linux it requires lots of steps. The python scripting system seems sparsely documented and many of the examples out there are outdated. I wrote a python script for Blender once, but I am reminded of the horrors of not being able to single step and debug.

So I am left with what I know. C#. It looks like it is going to be a normal windows C# form application which takes the xaml file and the cvg file, does some logic and then spits out a modified xaml file. One disadvantage is that I have to calculate the bounding box of groups and objects myself.

I know a standalone converter application is not ideal, but in my case is definitely the quickest way.
 
elecman
Topic Author
Posts: 90
Joined: 20 Jul 2014, 04:28

Re: Rotation center with XAML export

16 Feb 2015, 03:25

Good news. It seems that the lack of a rotation center and a bounding box (required for rotation center since it is relative to the center of the bounding box) in the xaml export is being addressed:

https://bugs.launchpad.net/inkscape/+bug/1419229
https://bugs.launchpad.net/inkscape/+bug/1421639

I have got the Inkscape source now and managed to compile it on windows, so I can test it out as soon as a dev version is ready.
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Rotation center with XAML export

17 Feb 2015, 02:31

Truly good news! Thanks a lot for pushing this. I am sure this is going to be useful to more users.
 
elecman
Topic Author
Posts: 90
Joined: 20 Jul 2014, 04:28

Re: Rotation center with XAML export

17 Mar 2015, 05:45

I now use the ViewerSVG XAML converter which correctly exports RenderTransformOrigin.
viewtopic.php?f=3&t=660

Who is online

Users browsing this forum: Google [Bot] and 1 guest