PDA

View Full Version : using svg images on windows mobile



Mrgoos
04-08-2008, 08:20 AM
Hi.
I am trying for 2 days now to understand how to manipulate openvg to handle svg images on windows mobile.
Im creating a location based app and i need svg basically for maps, street names etc.
I read that openvg is suitable for me - am i write ?

So please, can you tell me how to use it to load an image or reffer me to an example ?
The only examples that i see are not loading phisical image, but reading some code from an array.

Thanks.

Ivo Moravec
04-10-2008, 07:32 AM
By physical image, I imagine you mean things like .jpg, .png, .bmp, etc?

OpenVG deals with decompressed pixel data. The above files are compressed, have image headers, comments, etc. You will need an image library for converting these various file formats into uncompressed pixel data. Then you will be able to use vgImageSubData() normally.

The other possibility it to use some program like gimp, to convert your files into a C source files which define the uncompressed pixel data, and include those in your program.

Mrgoos
04-13-2008, 02:28 AM
Hi and thanks for your reply.
No, i ment image like tiger.svg. this is an image in an svg format, am i wrong ?

i will check the info you told me about gimp to convert the data to a c file. i always see image data on examples that is in fact a c code that contains an array of values - i guess that's what gimp does ?
there isnt any other way to load direct an *.svg image ?

thanks.

Ivo Moravec
04-14-2008, 08:35 AM
Hi and thanks for your reply.
No, i ment image like tiger.svg. this is an image in an svg format, am i wrong ?

i will check the info you told me about gimp to convert the data to a c file. i always see image data on examples that is in fact a c code that contains an array of values - i guess that's what gimp does ?
there isnt any other way to load direct an *.svg image ?

thanks.

SVG is an XML description of the shapes and stuff that should be rendered. OpenVG is an API that does rendering (like OpenGL or DirectX). There is no mechanism in OpenVG to parse the SVG's XML input, and turn it into compiled binary code which uses the OpenVG API to render. OpenVG has the feature set to allow someone to implement an SVG viewer with it, but OpenVG itself will not render SVG files.

In short, if you want to display SVG files directly, you will need to write (or find) a program to do do the conversion for you (the full SVG spec is a bit complicated though, so it woud end up being a fair amount of work). I don't know of any public programs to do this conversion for you though.

My suggestion to use gimp was in the event you were trying to display picture/image files like *.jpg with the VGImage type. Gimp could help you there, but it wont help you on *.svg files.

Depending on your application, you may wish to use some tool to convert the svg file to bitmap file.

Mrgoos
04-14-2008, 08:47 AM
but it is very problematic. it means that anytime when i add a new image to my project i need to compile it instead of just add a resource image (*.svg) to the server and than manipulate it.
even if i want to change an image on the same name i need to compile it since it's code changes.

Thanks.

Ivo Moravec
04-14-2008, 02:59 PM
but it is very problematic. it means that anytime when i add a new image to my project i need to compile it instead of just add a resource image (*.svg) to the server and than manipulate it.
even if i want to change an image on the same name i need to compile it since it's code changes.

Thanks.

OpenVG is a rendering API. It basically a set of functions which you can say "draw me an arrow of this type over there" through a set of librbary calls. e.g. In a C source file, the line:

vgDrawPath(pth, VG_FILL_PATH);

SVG is a description file of what should be drawn how and where in XML (something similar to what HTML looks like). e.g.:

<p= "M 10 10 L 20 20 L 20 10 z">

You need a program to convert the XML description into the correct API calls with the correct parameters.

If you're trying to hardcode the displaying of a particular svg file, you may as well convert the XML data directly into something OpenVG can render and render it directly through OpenVG.

If you need to display any arbitrary SVG file, you need a program that parses the XML file and and renders it using OpenVG. An SVG viewer is possible to be written using OpenVG as it supports the necessary functions to implement all functionality (with creative use of pbuffers and alphamasks to support more advanced features like clipping and group opacity), but SVG is rather a complicated standard. You are probably looking at several months of development time to write your own implementation. As I said - I am not aware of any publically available source that does this SVG -> VG conversion (that doesn't mean it doesn't exist though - do a search for it).

Mrgoos
04-15-2008, 12:09 AM
Mrgoos.