I've spent a lot of time writing simple C++ applications to test out some kind of rendering algorithm. Internally we had a tool that automated a lot of it. The tool uses a very simplistic, reg-exp based language to specify commands. I wanted something more powerful. This is how scripter came to be. Scripter is a very simple application that uses QtScript's bindings to Arthur to do its rendering. It allows for rapid prototyping of algorithms and most importantly for me, quick testing of Qt's rendering framework. At first it was a whole IDE with its own code editor, very quickly though I decided to remove the editor and just make it a content widget that monitors the file it was opened with for changes. The reason for that is that I wanted to keep working in my own editor and just have a dynamic, visual preview of everything I was doing. So with Scripter one can be writing rendering code while the visuals effects of the editing are immediately visible. Here are two screenshots of examples included with it:
But the whole beauty of this application is ability to create animations, while seeing the changes done in real-time. I recorded two demos:
- The first one shows me just playing around with an example. In this case it's a freedesktop.org clock.
- The second shows me writing a simple animation from scratch. This one has an added benefit of seeing me hack in real-time, no copy&pasting, a little bit of chaos (next time I should probably figure out what kind of animation I want to do before start recording, but oh, well, live and learn). Fun. This one is 12mb though.
svn co svn://labs.trolltech.com/svn/graphics/scripter
9 comments:
Amazing stuff. This will trigger fantastic plasmoids. I'm gonna have to rewrite my dbKalendar and trailertracker as soon as KDE 4 is out. :D
It almost makes one think KDE 4 should be based on Qt 4.4... Of course, that would lead to a delay, so that sucks.
Really cool, thanks! :)
However your code states that you use anti aliasing and at the edges your picture is still crippled. Why is that?
@Guybrush: as you point out it's a picture that undergoes transformation. To get smooth pixmap transformation you use QPainter::SmoothPixmapTransform.
I have played around with this for about an hour or so, it will be a great time-saver for trying to create effects.
I had encountered a few problems ( which might be my fault as a graphics newbie ):
- Setting the painter's composition mode using painter.setCompositionMode(QPainter.CompositionMode_XXX)
didn't appear to have any effect.
- I wasn't able to create a painter on a pixmap.
px = new QPixmap("/path/to/pixmap");
painter = new QPainter(px);
- With the 'modification' button enabled in the UI, it detected the first time a change in the .js file being shown occurred but ignored subsequent ones.
@Robert Knight: 1) we haven't bound them, use integer values. 2) we haven't bound that. 3) never seen it and i kinda doubt that, i think it's more likely that the script had errors and simply was throwing an exception that you weren't catching, otherwise you'll have to debug it
It looks like it should be possible to use these bindings with 4.3 too which is nice. :-) Should be useful for my qtscriptable plasmoid!
Cool. For some reason, this reminds me of Ken Silverman's EvalDraw.
zack, you are the SHIT. period.
Post a Comment