Hi, all
Last year Sun Microsystems released JavaFX Production Suite
(together with JavaFX 1.0) which have Adobe Photoshop CS3
and Adobe Illustrator CS3 plugins for exporting graphical assets
into JavaFX format.
The output (.fxz) is a ZIP archive containing 'content.fxd' file
representing vector graphics picture in JavaFX format.
Optionally, this archive may contain images and fonts referenced by the
'content.fxd' file. The content file can be viewed in netbeans IDE
(JavaFX plugin should be installed!). The netbeans has UIStub generator
for building a JavaFX class based on content.fxd and users may
manipulate graphic
objects by changing object properties, moving them, animating, making them
visible/invisible and so on. The objects you want to control in JavaFX should
have special prefix in naming of Inkscape "id" attribute like
"jfx:object_name".
Others will be anonymous in JavaFX.
I propose that this plugin for Inkscape be used. It is based on the work of
B.Jamison, S.Neto and J.Clarke for JavaFX Export (javafx-out.h, javafx-out.cpp).
My updates to it were posted a few weeks ago.
Personally I consider the "FXD/FXZ Content file" format more useful and I am
going to use this actively in future projects, which explains my motivation.
Implementation.
----------------------
The implementation is obvious: scan the object's tree and write the
corresponding JavaFX constructs. The output has all attributes embedded in line
therefore the information about gradients, filters and clip-paths are
stored (only
pointer information) and then used when actual graphic objects in the
scene are built.
Embedded images are decoded and external images are copied into the
output ZIP archive automatically. Fonts should be handled in the same way
(any volunteers!?).
Like Illustrator plugin I always try to recognize simple objects
(circles, ellipses, rectangles)
behind the paths to reduce the output size.
As a zip library implementation I used
http://www.nih.at/libzip.
Actually I am working with Linux, openSUSE 11.1 distribution, where
this library is
known as libzip1. It seems that Ubuntu distribution supports it as well.
The Windows platform is also supported:
http://www.nih.at/listarchive/libzip-discuss/msg00009.html
While I might agree that introducing a new dependency into inkscape may not be
welcomed, my attempt to use inkscape/src/dom/util/ziptool.[h,cpp] was unhappy:
extremally slow! (~ 30 secs on some pictures).
Testing.
-----------
It is checked on the following pictures:
http://chrisdesign.wordpress.com/2008/02/14/simple-metal-orb-using-gradie...
-- gradients
http://howto.nicubunu.ro/shiny_web_buttons_inkscape/
-- gradients, embedded images
http://openclipart.org/people/Chrisdesign/Chrisdesign_Golden_mask_Tutanch...
-- large picture with clip paths
and I have used this simple tutorial to check clipping mask handling
http://www.bestechvideos.com/2008/07/12/screencasters-episode-064-bitmap-...
Installation.
----------------
The installation is simple if you are able to build svn version of
inkscape on your platform.
1. Make sure you have libzip1 + libzip-devel packages installed in
your system. Or you should have
this installed from sources. See the reference above for instructions.
2. Get SVN version of inkscape:
svn co
https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk
inkscape
3. Copy 'javafx-fxz.h' and 'javafx-fxz.cpp' from attachment into
'inkscape/src/extension/internal'
4. Create build directory:
cd inkscape
mkdir build
5. Add 'javafx-fxz....' entries just above 'javafx-out' entries into
po/POTFILES.in
src/Makefile.in
src/extension/internal/Makefile_insert
src/extension/internal/CMakeLists.txt
src/extension/init.cpp
and in the last file (init.cpp) put just before
"Internal::JavaFXOutput::init();" line the following...
Internal::JavaFXZ::init();
6. Go back into inkscape (top) directory and do ...
./autogen.sh
cd build
LIBS="-lzip" ../configure --prefix=/opt/inkscape
or
CFLAGS="-g -O0" CXXFLAGS="-g -O0" LIBS="-lzip"
../configure
--prefix=/opt/inkscape
if you want to build inkscape with debug information
then
make && su -c "make install"
7. Use /opt/inkscape/bin/inkscape executable and enjoy!
Of course, I am interested if some person(s) from development team might review
the code and make a decision. Anyway I hope it will be useful.
Cheers,
Sergey