Tuesday, October 12, 2010

Hidden features in the FXG converter...

Hi there,
for those of you that use the fxg converter (unfortunately i have no idea if somebody use it at all), otherwise just for me to remember i'll explain two little features in the fxg converter that saves some lines of code...
Because the Adobe Fireworks fxg file looks different from the Adobe Illustrator fxg file (don't ask me why), it happens that even if you define a ellipse or rounded rectangle in Fireworks, it will convert it to a fxg path instead of a fxg ellipse or fxg rect element. In principle this is not a problem because the converter will convert the path to a java2d generalpath BUT...this means a lot of code for a simple ellipse or rounded rectangle.
Therefor i added the possibility to use the elementname to mark it for special treatment.

Ellipse:
A ellipse in Adobe Fireworks will get the default name "Ellipse"


If you leave it with this name it will be exported as fxg path which means it will also be converted to a java2d generalpath.
The trick is to start the name with "E_" which will have no effect to the fxg export (it's still a fxg path) but the fxg converter will create a ellipse from the given fxg path.

RoundedRectangle:
A rounded rectangle will get the default name "Rounded Rectangle Auto Shape"




Here we'll get the same problem as with the ellipse, it will be exported as a fxg path which will lead to lots of lines of code after the conversion. That's not needed because it's a simple rounded rectangle right ?
So to get rounded rectangle after the conversion you need to follow the upcoming procedure:

  1. Create the rounded rectangle in Adobe Fireworks
  2. Open the "AUTO SHAPE PROPERTIES" dialog
  3. Note the corner radius (n.m)
  4. Ungroup the rounded rectangle in Adobe Fireworks
  5. Name the shape starting with "RRn_m_" followed by your name
You could either use a integer (yellow box at the screenshot) or a float (green box at the screenshot) as the corner radius for the rounded rectangle.

Example:
RoundedRectangle with the name "Box" and a corner radius of 5.5 should be named "RR5_5_Box" to get a rounded rectangle after the conversion to java2d.

You could also use it with a integer like this, "Box" and a corner radius of 5 should be named "RR5_Box".
 
With this small modifications in your drawing you could save a lot lines of converted code in your java file and you will get a better, more precise scalability.

So i hope for whoever uses the converter this hint will be helpfull...

1 comment:

  1. Well, I use the converter and i think it's a real great idea!!! It makes my life much easier, so thank you for this great work :)

    ReplyDelete