<?php include("sample_utils.php"); // provides some utils and using mk //$svgFN = "linuxtag.svg"; // various svg to try... //$svgFN = "sample01.svg"; // //$svgFN = "vgai01.svg"; // //$svgFN = "tux.svg"; // //$svgFN = "tiger.svg"; // $svgFN = "three_hearts.svg"; // //$svgFN = "powerpuff01.svg"; // //$svgFN = "picasso_woman_vect01.svg"; // //$svgFN = "pclinux.svg"; // $sv = new MKsimple_svg_reader($svgFN); $wd = $sv->get_svgWidth(); // get svg width $hg = $sv->get_svgHeight(); // get svg height $sd = $sv->update_tagData(); // get tag data $po = $sv->update_place_tagData(); // get placing data $swf = new MKswf("test_svg01.swf"); // start a fresh swf $swf->set_swfDir(SERVER_MKTMP); // change default working dir $swf->set_stageWidth($wd); // set stage dimensions $swf->set_stageHeight($hg); // $swf->add_tagData($sd); // populate with shape $swf->add_tagData($po); // place on stage $swf->swf_output(); // save to disk $swfHeader = $swf->fetch_assoc(); $str = render_swf_box($swfHeader, $imgDir, false); $str .= "<br/><strong>test_svg01.swf created in" .SERVER_MKTMP ."</strong></td></tr>"; ?>
Earlier snapshot releases had a little svg support to let drawing with a graphic package such inkscape and make some kind of conversion.
The good news is a consistent svg handling improvement, you can see some working samples, complex svg drawings taken from various internet resources such open clipart gallery and inkscape samples.
Now mk supports most basic drawing commands, transformations and linear/radial gradient fills. I'd like to think svg means: simple vector graphics, but unfortunately it is not! S is for scalable...
Svg is an xml dialect that can reach an high level of complexity, it supports scripting and animation, it can contain linked resources and get the same result in various ways.
In most cases if you need to convert svg to swf you have to accommodate your svg following this simple rules:
svg radial gradients have focal points that they are available only in flash 8. In the near future I will add such interesting thing. Scripting, animation and linked resources are not planned to be supported. The main goal of svg support is to give a way to create vector content to insert later in swf that will be handled by actionscript, or simply used as static visual content.
Sometimes svg conversion it's a piece of cake, sometimes it's an hell, there are some issue to fix, much test have to do.
Base xml support is given using xmllib, since mk don't use extensions by definition, I've made some little bug fixing e.g. in parsing attributes, but that library has to be considered not definitive, waiting for php6 mass support. That php version will support xml natively, php5 looks good but yet has not massive support.
I also made some few test using svg generated by illustrator, but it has to be simplified because that software tend to generate a large amount of complex data that mk can't handle properly.
![]()