It seems like SVG has be "deprecated" in Flex 4 in favor of Adobe's FXG. What can I do if I have a bunch of SVG graphics that I want to keep using. Is there something reliable to convert SVG to FXG? Are they in feature parity? Is there a converter out there that won't cost me $1500?
Inkscape also exports fxg now (see comments #24 and #42), but with some limitations.
It uses simple XSLT as extension, so you can write simple script in any language that supports XML transformations to produce FXG from your SVG's.
Actually if you are programming in flex 4, check out the spark path primitive. For path data it uses a string that has the same syntax as an svg path. You just have to parse it out but actionscript fully supports regular expressions so it shouldn't be too hard to load an svg as a text/xml file with urlrequest and parse out the path data for your primitives.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/Path.html
Path Objects only support transforms on their entire path so if you want to manipulate path data in real time you will just have to parse the data in a data structure and convert to a string for display.
It used to be that if you wanted to display an svg path with the actionscript 3.0 graphics library you would have to approximate the cubic berzier with quadratic berziers upon display but the spark primitive does do away with that by accepting path data in cubic form-- although even the spark primitives, when they draw themselves out, do seem to be approximations that are reaaallly close.
Depends how much work you want to do to interpret the svg data. If you want to do things like implement styles, masks/clipping and blur effects, the functionality is there in flex 4 with path and all of it's properties but implementing it from the data is going to require work.
Most of the svg graphical elements(shapes and text) can be converted to path data in programs like inkscape. Even so, actionscript has draw method geomitries that most likely support the basic shapes.
Also transforms on groups of elements will have to be parsed if you want to use that as well, or you can just not use groups, they are rather pointless when you aren't manipulating them.
Related
Is there a way to restrict paper.js to only the SVG Tiny standard? The current output is more verbose than necessary and some of our downstream processes only allow SVG Tiny.
No, there is no built-in way to do this from Paper.js.
The SVG export options are listed here, maybe some of them will help you getting closer to the expected format.
But you will have to transform the output yourself.
As part of my software I have to somehow convert and display Esri ASCII (.asc) files on a leaflet map.
The files are in the filesystem and the backend is in nodeJS.
.asc is a raster format and gdal_translate manages to translate the files as I like. Unfortunately I can't use GDAL in node and as far, as I see it, gdal-node is not able to convert the files. Manually converting files is not an option.
My data is always somehow geo referenced, so if I get an image, it has to be placed on the right spot on the worldmap.
Help would be highly appreciated, because I feel kinda overwhelmed by all this GEO stuff.
If you want the normal set of features Leaflet offers, like zooming, what you need is called a map tile service.
There are a few map tile standards that Leaflet supports. Generally though, making map tiles is complicated — particularly if your ASCII grids are in lat/long but you're using a background layer from Google, Bing, OSM that's in "web Mercator" — so you probably don't want to write one in Node yourself.
Look at GeoServer and see if that will fit into your setup.
Is there a way or a library available that can load an image (jpeg, png, etc) and assign the pixel values of that image into a list or matrix? I'd like to do some experiments with image and pattern recognition.
A little nudge in the right direction would be appreciated.
You can use JuicyPixels, a native Haskell library for image loading. This is rather easy to convert to REPA as well (manually or with JuicyPixesl-repa).
I've used the repa-devil package for this in the past. It lets you work with a bunch of formats using Developer's Image Library (DevIL). You can read and write all the formats you are likely to care about.
The actual image data is given as a Repa array. This is a great library for array operations and makes it very easy to write parallel code.
Try the repa library
.Also there is a small tutorial here
Here is a new Haskell Image Processing library, which uses JuicyPixels for encoding, provides interface for you to read and write all of the supported formats in a very easy manner and manipulate them in any way you can imagine. Just as a simple example on how easy it is:
>>> img <- readImageRGB "image.jpg"
>>> writeImage "image90.png" $ rotate90 img
Above will read a JPG image in RGB color space, rotate it 90 degrees clockwise and save it as a PNG image.
Oh yeah, it also can use Repa, so you will get parallel processing for free as well.
GTK supports loading and saving JPEG and PNG. [AFAIK, no other formats though.] There is a Haskell binding named Gtk2hs. It supports vector graphics very well, but bitmap graphics, while supported, isn't especially easy to figure out. So I wrote AC-EasyRaster-GTK, which wraps GTK in a more friendly interface. (It still needs Gtk2hs though.) The only real down-side is that Gtk2h is a bit fiddly to set up on Windows. (And it's arguably overkill to install an entire GUI toolkit just to load and save image files.)
I gather the "GD" library supports writing several image formats, and is quite small and simple. I believe Hackage has Haskell bindings for GD as well. I haven't tried this personally.
There is a file format called PPM which is deliberately designed to be ridiculously easy to implement (it's a tiny header and then an array of pixels), and consequently there's at least a dozen packages on Hackage which implement it (including my own AC-PPM). There are also lots of programs out there which can display and/or convert images in this format.
How to render (to image) text on path with any renderer working on linux?
Like this: text on path.
Performance is important.
Short answer:
I'm on a Debian Squeeze system with the python-cairo package installed. If I run the warped text example it provides (85 lines of Python):
python /usr/share/doc/python-cairo/examples/warpedtext.py
it produces a warpedtext.png file like this:
I imagine it'd be fairly easy to modify/adapt/port the example.
Long answer:
There are two things you need to do this.
The ability to generate the transforms which will place individual letters with the correct position and orientation along the path. This is basic 2D transform geometry.
The ability to render transformed characters/font glyphs with a decent level of quality (sub-pixel precision, antialiasing etc).
For the latter, I'd be looking at one of
Qt's QPainterPath (this example seems to be exactly what you want, but see also this one).
Cairo (another example).
Anti-Grain Geometry.
I need to create graphics for documentation, e.g. different functions of soft-keys or pin assignments for embedded systems with different firmware. My first thought was to use an SVG template, i.e. comfortably create the basic graphic with e.g. Inkscape and then use some XML library to set/replace respective strings for labels automatically. The SVG then can be embedded or rendered to any other format required.
I would like to know other ideas, or if there is some sort of standard method of doing this.
SVG is just XML, hence is fairly easy to generate.
You can easily generate SVG using XSLT: http://www.carto.net/papers/svg/samples/xslt/
Many programming languages provide efficient APIs for manipulating XML, which can also be applied to generate SVG. For example, I have had good success using Python and the lxml library.