Notes on writing a new OpenLaszlo kernel; SVG
I've been interested in SVG (Scalable Vector Graphics) for a long time, and have thought
it would make a good runtime platform for OpenLaszlo applications. With the development of the Legals release, I wanted to see how difficult it would
be to port the DHTML kernel (which is still under development) to SVG. Since Firefox and Opera now support SVG 1.1 natively, it seemed like it was a good time to try this out. SVG is strong on graphics imaging and text rendering, I think of it like a free-software version of Adobe's crown jewels.
With two days of hacking over the weekend, I got a large about of the Sprite API ported to SVG.
Here's a version of the SVG kernel running, try this in Firefox: Try clicking on the gray area of the gray square, the red rect, or the blue rect, or the text string
http://www.beartronics.com/svg/svg.html
source of test LZX app
http://www.beartronics.com/svg/sprite.lzx
Flash version
http://www.beartronics.com/svg/sprite.lzx.swf
This tells me that the kernel API is pretty much on target, certainly for runtimes which have HTML/SVG javascript-like event handling.
I was disappointed to learn that SVG 1.1 (which is what Firefox supports now) does not handle input text or wrapping text regions, however
SVG 1.2 does have these, so I look forward to finishing this work when Firefox SVG 1.2 support is released, and then we will have
an OpenLaszlo runtime with the beautiful imaging model from SVG.
If time permits, I will try to clean up the SVG kernel enough to stick into an upcoming Legals release, so interested people can look at it. I
haven't implemented image or data loading yet, and there's some bugs with background color names and defaults.
SVG has been slow to gain traction, but I think it is one of the best hope for high quality portable graphics, and maybe even rich internet apps that
use them, in the future.









July 31st, 2006 at 12:59 pm
holy crap henry!
July 31st, 2006 at 1:31 pm
[...] Henry Minsky contacted me about his work creating a SVG kernel for the OpenLaszlo project. I encouraged him to take make his experiments public. Looks like promising stuff for only two days worth of effort! [...]
July 31st, 2006 at 4:51 pm
Very nice, added it to http://svg.startpagina.nl
July 31st, 2006 at 4:52 pm
Very nice, added it to http://svg.startpagina.nl/
July 31st, 2006 at 5:01 pm
[...] source: OpenLaszlo Project Blog [...]
July 31st, 2006 at 10:01 pm
[...] Over on the OpenLaszlo Weblog, Henry Minsky blogged about testing out a new OpenLaszlo kernal based on Scalable Vector Graphics (SVG). Right now it looks to be a very rough cut, but according to Henry, he is going to see about cleaning it up and adding it to the Legals release which I blogged about earlier. [...]
July 31st, 2006 at 11:15 pm
Everything about OpenLaszlo continues to impress.
This is wicked cool stuff and only getting better.
August 1st, 2006 at 11:39 am
[...] Henry Minsky took the first steps to genereate SVG out of OpenLaszlo’s programming language LZX. Wow! Never thought that OpenLaszlo could take a next step to SVG. Ryan Stewart of ZDNet has some infos on that, too. And if you don’t know OpenLaszlo checkout Ryan’s article series on building Rich Internet Applications. Laszlo Systems, LZX, OpenLaszlo, svg Web 2.0 [...]
August 15th, 2006 at 6:49 pm
Hey,
http://www.mainada.net/comicssketch/
In this site, there is a simple implementation o SVG in DrawView.
All drawings are in SVG format and drawn as such.
I’ll be very happy and looking forward for this.
August 16th, 2006 at 6:18 pm
Howdy,
A friend of mine pointed me at this post. Very interesting! I’m the head of an open multiplayer game platform called Volity (http://volity.net) and we are very SVG-friendly, encouraging game developers to create their games’ UIs as SVG documents.
Currently we use the Apache project’s Java-based Batik library in our client application (which we call Gamut), and it is both very complete and very… Java. So I look forward to seeing what direction your work develops in, and offer myself as a source for further SVG advice, especially if it happens to intersect its application in gaming.
August 17th, 2006 at 5:26 pm
I think you could speed up the rendering, tiago, by making use of the new Flash cacheAsBitmap flag for the underlying Flash movieclip used by the OpenLaszlo drawview.
If you put this in the oninit method for your drawview, it might make rendering faster
this.getMCRef().cacheAsBitmap = true;
I don’t know if this will work, but it might. Otherwise Flash redraws the entire view every frame, which gets expensive.
September 1st, 2006 at 6:48 pm
[...] Further demonstrated the capabilities of the Kernel API by prototyping an SVG kernel in just a few days. [...]
September 4th, 2006 at 6:59 am
[...] The OpenLaszlo Team announced, that they are in time to get the DHTML runtime up and running like described on their roadmap. They are on the right way! Beside, a few weeks ago, they have another entry in the developer blog. Henry Minski wrote a SVG-Kernel for the OpenLaszlo project. So, in the future OpenLaszlo will not bound to flash for output any longer, that´s an important point for many people here in Germany. And they show us that it is possible to provide support for other runtimes as well. Very good work from the OpenLaszlo Team, go on! [...]
January 5th, 2007 at 12:08 am
Adobe was the champion of SVG in a production environment. Soon their viewer will no longer be supported by them, leaving it in limbo. That is unfortunate.
So my question is, rather than generating SVG, would it make sense to convert SVG to Flash? Another Media Transcoding?
January 5th, 2007 at 8:00 am
SVG is natively supported now in Firefox and Opera. If Microsoft comes along, then SVG will be the standard web image rendering language and model. We don’t need Adobe anymore.
January 5th, 2007 at 10:16 pm
Re: SVG to Flash - google for “deng”
February 2nd, 2007 at 3:05 pm
The other big JS gripe is debugging on IE. Nope, sorry, that works really well too
February 15th, 2007 at 2:17 pm
This is a good start.
Is the SVG Kernel part of the Legals or can it be downloaded from some place. I am interested in HTML/JavaScript Events on SVG Elements. Is it possible today?
February 15th, 2007 at 2:34 pm
The legals branch has a kind of placeholder SVG kernel in it. It can be invoked by fetching a URL with these query args
foo.lzx?lzt=svgwrapper&lzr=svg
Unfortunately I just tried that and it is broken right now, it isn’t including the LFC library for some reason. I will fix it when I get a chance, but I’m kind of overloaded with stuff related to the OL4 release now, so it may need to wait until after we do the release.
The SVG kernel in there now is only a basic skeleton, and was based on an earlier version of the DHTML kernel, so it needs updating as several things have been improved in the DHTML support.
Also, there are several issues with SVG which I ran up against, and which I am writing up to send to the SVG developers, which limit the full range of features that can be supported in SVG at this time.
One modestly important issue is that I cannot see any way in straight SVG to query a loaded bitmap image to find it’s “pixel” dimensions, which many Laszlo apps tend to want to do. You have to know the width and height of your image resources at compile time and specify them on your views. Workarounds would be to have some out-of-band way to get that info via a server or something using data requests.
The other more serious issue is that there really isn’t good support for input text entry in SVG, nor for querying the runtime for the dimensions of text strings. Hopefully that will be addressed in the future.
February 15th, 2007 at 2:35 pm
But to answer your question, most of the events do work, and they work very close to how the Firefox browser events work. Look at the SVG kernel in WEB-INF/lps/lfc/kernel/svg to see how the events are caught and turned into Laszlo events.
February 15th, 2007 at 3:31 pm
Thanx, I will check the events model. I believe there was a blog post today on a new HTML Tag in DHTML, I could embedded my SVG content in the HTML tag, and it shows up well. I don’t know if that is the right approach, just another thought.. .
February 15th, 2007 at 4:58 pm
Hi ,
I came across the Dojo Tookit, which has the dojo.gfx 2D Vector Graphics API which renders natively to browsers using SVG and VML.
Can we incorporate/integrate Laszlo Script with Dojo and has there been any proposal to avoid reworks. I will post this on the mailing list as well.
Thanx!
February 17th, 2007 at 11:29 am
To answer the original question, SVG does support a DOM and DOM Events (just like HTML).
My understanding was that Dojo and Laszlo were already collaborating - hopefully more integration with vector graphics can happen.
Jeff
March 10th, 2007 at 9:29 pm
As already mentioned here, SVG has a very important role in the mobile world. Being the company I work for in that area, I’d be very interested to see your work development with the SVG runtime, particularly its support for SVG-T 1.2.
Thanks!
Ricardo
June 11th, 2007 at 2:42 pm
This example works very well with the Safari 3.0 Beta ( http://www.apple.com/safari/download/ ) which supports SVG 1.1.
Considering that SVG 1.1 doesn’t seem to support all that you need, it would be interesting to see if you could mix SVG with HTML (as is implied to be possible in a post on the webkit blog, i.e. http://webkit.org/blog/?p=35) and essentially get your missing functionality through the resultant hybrid.
July 26th, 2007 at 3:13 am
Thanx, I will check the events model.
August 1st, 2007 at 5:41 pm
SVG is natively supported now in Firefox and Opera. If Microsoft comes along, then SVG will be the standard web image rendering language and
August 1st, 2007 at 5:46 pm
So my question is, rather than generating SVG, would it make sense to convert SVG to Flash? Another Media Transcoding?
August 1st, 2007 at 5:47 pm
A friend of mine pointed me at this post. Very interesting! I’m the head of an open multiplayer game platform called
August 6th, 2007 at 8:57 am
You menation about very important subject.
August 8th, 2007 at 7:23 pm
I have been wanting to start an open online gaming site, but been having problems with some of the coding. I have heard that they were going to standardize JavaScript. Could this be a problem that I am having? Have they already changed the coding that would be causing me problems with my site? I heard about this one a site a few weeks ago, and have been looking around for a site that could give me some idea when they are going to change over to the new JavaScript. Or even somewhere that could tell me if they have already switched over. Also, could this even be causing a problem with my site and my start up. If anyone has any information on this and could help, I would appreciate it. Thank you all for you time and all the good information.
August 10th, 2007 at 4:35 pm
Earlier this week SiliconBeat lamented the seeming demise of one the key tools in the blogging community: Trackbacks. While I can entirely sympathize with the barage of spam Trackbacks, I too have been forced into a position where by I…
August 27th, 2007 at 2:49 am
Interesting! Why don’t you try to include this one to the Wiki intended for SVG User Experiences.
September 3rd, 2007 at 2:25 pm
Thanx, I will check the events model. I believe there was a blog post today on a new HTML Tag in DHTML, I could embedded my SVG content in the HTML tag, and it shows up well. I don’t know if that is the right approach, just another thought..
September 16th, 2007 at 4:06 pm
DOM elements. Was there a reason specifically or some obvious constraint I’m missing? Also, any idea on what document.matchAll() will return in the next generation of browsers? Thanks for the library, we need more devs with your approach.
September 16th, 2007 at 10:29 pm
I think everything about OpenLaszlo continues to impress.This is wicked cool stuff and only getting better…