PureSVG - now with LoadSVG() !

Share your advanced PureBasic knowledge/code with the community.
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: PureSVG - now with LoadSVG() !

Post by electrochrisso »

I have been thinking that it might be better off waiting for a while so you can concentrate on implementing the filters and canvas and perhaps animation into the code, as this would be a great addition. I still have to spend a bit of time learning about svg anyway, and have a heap of other coding to catch up on, and I do have your existing code to trawl and learn from for the time being.
PureBasic! Purely the best 8)
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

Animation will not be in the next version, because I haven't decided how to implement it. SVG elements can be animated in different ways - JavaScript, SMIL and CSS among them. I don't know enough to make the right choice!

However, canvas and filters are do-able. :)
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

Electrochrisso, I am currently working on PureSVG, implementing canvas drawing. (I should be specific: this will be for converting an SVG into JavaScript code for drawing on an HTML5 canvas, not PB's canvas.)

I also checked Wikipedia again and it seems SMIL is now the recommended way to animate SVG. It's good that a consensus has emerged. SMIL+SVG is supported by all the browsers except IE (of course) though IE10 may fix this. Therefore I will implement SMIL in PureSVG, so that people can make animations with PureBasic!

This won't be in the upcoming version, though. I want that to be focused on filters, canvas, and using less memory. Animation will be in the next version.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

I tell a lie.

Last night I took the plunge and implemented two of SVG's three animation functions:
  • Animate
  • AnimateMotion
So those will certainly be in the next version. I still need to do AnimateTransform. Some "helper" functions for animators were also written - copy, paste, clear all, etc.

I also started writing the canvas code. Once that is done, the only thing left is filters. These are more complicated! I may leave some filters for a future version.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PureSVG - now with LoadSVG() !

Post by c4s »

This whole SVG support looks good. I'm pretty excited ybout your new update as well!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

Thanks, c4s! Encouragement is always appreciated!
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: PureSVG - now with LoadSVG() !

Post by electrochrisso »

Hi Semour, sorry I could not reply sooner, I was up the Murray River in my paddle boat and offline for a few days and have just caught back up with the forum.
Your next version sounds great with a lot of new features. 8)
I am new to SVG and will now need to go and check out info on HTML5 and SMIL. :idea:
Keep up the good work. :)
PureBasic! Purely the best 8)
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

electrochrisso wrote:Your next version sounds great with a lot of new features. 8)
Well, I hope it doesn't disappoint! To be honest, I think the best thing about it is that it uses about 5% of the memory that the last version used. Real improvements have been made there.

But of course it's more exciting for a new version to have new features! There are quite a few of them already. Animation and canvas will be in it. Filters, not so sure.
I am new to SVG and will now need to go and check out info on HTML5 and SMIL. :idea:
Ideally, PureSVG should take care of SMIL for you. However, it may be useful for you to know about this stuff so that you can suggest improvements to PureSVG (apart from anything else). I'm trying to support as much of the spec as possible, but I may have overlooked some stuff because I'm no expert myself!

The SVG spec is much more extensive than it looks. The best thing is to imagine what you'd like to be able to do in PB code, then build a bridge to it.

On that note, is there anything you'd like to be able to do, in terms of animation? Any way you'd like it to work?
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: PureSVG - now with LoadSVG() !

Post by electrochrisso »

On that note, is there anything you'd like to be able to do, in terms of animation? Any way you'd like it to work?
I will check out a bit of info and get back to you soon. :)
PureBasic! Purely the best 8)
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: PureSVG - now with LoadSVG() !

Post by electrochrisso »

I think that I will leave for you to work out the best way to implement the animation, as I am still wading through hundreds of pages of docs on SVG and SMIL. The more I look into this language the more seems to appear and is way more than just a simple graphics engine. I have so far only read a basic tutorial on rotating, moving and scaling an element, so these would be a useful addition.
Here is a link to an advanced animation. http://apike.ca/prog_svg_animaze.html, would this be possible?.
Because there are so many commands to this language and it codes like html and xml it might be easier to somehow implement a way to use PB as the front end for the coding and testing using the w3c syntax (like the simple example SVG code below), then output the code to a viewer, or event better if the web gadget is now able to read the code, since ie9+ is supposed to be able to do now. I am still checking out what is possible myself to see what ie or Firefox are currently capable of in this arena, I will keep you posted on my progress.

Code: Select all

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="rotateSquare">
<rect fill="#AFBCC7" stroke="#646464" stroke-width="5px" x="100px" y="100px" width="100px" height="100px">
<animateTransform
attributeType="XML"
attributeName="transform"
type="rotate"
from="0,150,150" to="360,150,150"
begin="0s" dur="5s"
repeatCount="indefinite"/>
</rect>
</g>
</svg>
PureBasic! Purely the best 8)
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

Someone else can worry about that. I have little interest in making apps with PB. The web is the platform now.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 450
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Re: PureSVG - now with LoadSVG() !

Post by Didelphodon »

The chm-file included in the download archive seems to be broken. At least I don't get any information in the pane on the right side besides some "cant-connect-error".
Go, tell it on the mountains.
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

I'll be uploading a new version soon. In the meantime I'll PM you a help file.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PureSVG - now with LoadSVG() !

Post by Seymour Clufley »

Mevedia, I'm afraid I am extremely busy just now. The functionality you want would not be of any use to my own projects, so I can't justify abandoning my current work to do this. If someone else wants to do it, that's great, but I can't.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: PureSVG - now with LoadSVG() !

Post by Danilo »

@mevedia.de:
If EMF (Windows Enhanced Metafile) is OK instead SVG, you can try gDrawing_v0.85b.zip.
This experimental version of gDrawing has gLoadMetafile() for loading EMF and WMF
and gMetafileOutput() for writing EMF.
Post Reply