SVG file format
#1
Posted 03 June 2008 - 05:34 PM
[*:15cfkgt3]Use Magic Wand to grab some area. Convert the selected boundary to SVG path and fill with a color.
[*:15cfkgt3]Iterate through the surface as long as all the pixels of the surface has not been covered by the magic wand.
A bit rough, isn't it ? No circle or rectangle tag, this is just a raster-image converter.
Is it a too naive algorithm ? While simulating it, I see that my selection with magic wand isn't as smooth as vectormagic. This is what make me feel as a bad algorithm. Am I right ?
#2
Posted 03 June 2008 - 06:05 PM
Donations are always appreciated! http://www.getpaint.net/donate.html
#3
Posted 03 June 2008 - 06:32 PM
IMO there is nothing to gain from converting to SVG anyway, trying to smooth the curves would destroy some detail, depending on the tolerance JPG pictures (and other noisy images) may end up being encoded as width*height squares, gradients are hard to detect, and because you can never guess the correct curve from a raster image it won't be very scalable anyway.
Unless perhaps you use a very complex algorithm that takes a lot of time - and it still probably won't look the way you'd vectorize the picture yourself in most cases.
An SVG importer may come in handy though..
edit: I just tried that vectormagic thing on a multi-coloured font - complete disaster, but a nice try anyway. It can clearly be seen that it does not use the algorithm you described, the bitmap importer of Inkscape however looks like it does.
#4
Posted 04 June 2008 - 07:51 AM
I don't want to pay a designer for a little game I wrote as freeware and I don't know anybody who may draw for me. So the easiest way for me is to convert png image scanned or found.
#5
Posted 04 June 2008 - 08:30 AM
Donations are always appreciated! http://www.getpaint.net/donate.html
#6
Posted 04 June 2008 - 09:44 AM
#7
Posted 04 June 2008 - 12:23 PM
My guess is that it if it's just a moderately high number, there would be no trouble with memory. Of course it's always nice to use less.. But is it really crucial?
I know that game, unless you're going to substantially increase the number of tiles in the computer version there shouldn't be a problem at all, you could even sub-tile the tiles, or have base-tiles (grass, city part, combinations in various shapes) + several detail sprites (clumps of grass etc) on top (basically sub-tiling with a separate background)
#8
Posted 04 June 2008 - 01:28 PM
Thank you, I will do that way
Yes I will increase the number (I consider implementing the different extensions) and provide zooming feature (to see the table in its entirety)
#9
Posted 04 June 2008 - 05:37 PM
Donations are always appreciated! http://www.getpaint.net/donate.html
#10
Posted 18 August 2008 - 12:17 PM
I'm working on a file plugin to load .SVG files.
Unless somebody out there is beating me to it...?
#11
Posted 18 August 2008 - 03:23 PM

Take responsibility for your own intelligence.
#12
Posted 18 August 2008 - 05:49 PM
#13
Posted 18 August 2008 - 07:40 PM

Take responsibility for your own intelligence.
#14
Posted 18 August 2008 - 09:18 PM
http://directory.fsf...roject/svg2png/
but maybe librsvg is better, not sure
http://ftp.gnome.org...ources/librsvg/
#15
Posted 19 August 2008 - 08:39 PM
If you're coding a game and performance is a concern, you should probably use Direct3D and DDS textures.
Sorry for off-topic, but one thing I've never understood about games is how textures affect performance. I mean, the texture is just covering a model, so why does it improve your performance if you have texture settings lower?

#16
Posted 19 August 2008 - 09:03 PM
2) less GPU bandwidth is used on textures (leading to faster transfers of vertices etc)
3) better locality of reference in the pixelshader when using the texture (since it's smaller) so better use of GPU texture caches
there are probably more reasons
For 1 less mipmap, the ram usage for that texture is approximately divided by 4
#17
Posted 19 August 2008 - 09:13 PM
If you're coding a game and performance is a concern, you should probably use Direct3D and DDS textures.
Sorry for off-topic, but one thing I've never understood about games is how textures affect performance. I mean, the texture is just covering a model, so why does it improve your performance if you have texture settings lower?
Remember that the texture must be loaded from memory, transformed to the shape of the object and sent to the screen each time a new frame is rendered.
#18
Posted 19 August 2008 - 09:34 PM
usually, the texture will already be in the GPU's dedicated ram during rendering (if it exists and is big enough)
the texture will not be transformed:
the vertices* will be transformed (or not, depending on the vertex shader, when it exists), and a pixel shader (or fragment shader, the GL equivalent) will sample from the texture (which is probably where the GPU's texture samplers come in)
The number of pixels send to the screen per second only depends on the size of the viewport and FPS
*: someone may decide to transform per-pixel instead, but I've never heard of anyone who did












