2D vector graphics - Libart or cairo?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

2D vector graphics - Libart or cairo?

Post by Shine »

I want to include some vector graphics capabilities to Lua Player. This may be useful for other programs as well, so what do you think, if I'll add it to PSPSDK?

There are at least two libraries, which looks like good candidates and which are used in other large projects. But I don't know the libs.

http://www.levien.com/libart/

This looks like a nice small lib, which does just vector graphics and some image scaling operation, with some low level operations, like creating vector paths from bezier paths.

http://cairographics.org/introduction

Looks like a big lib, with font support and nice high level functions, similiar to SVG or postscript.
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

I seriously doubt pspsdk is the place to put such a port.

Both libs look very cool, not that I've ever used them.

It's also probably worth mentioning that I have submitted a SDL_gfx port to svn. SDL_gfx can rotate/zoom images and draw antialiased gfx primitives, including bezier curves (and has framerate control, whoop!).
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

Comparing cairo and libarts is a little unfair, the counterpart to libarts is more the GL rendering backend of cairo: glitz. If you compare these two, you'll get a slight advantage for glitz (in terms of lines of code) -- and hardware-accelerated graphics:

$ wc -l glitz-0.4.4/src/*.[hc] glitz-0.4.4/src/egl/*.[hc]
12423 total

$ wc -l libart_lgpl-2.3.3/*.[hc]
13434 total
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

note: glitz does the compositing, so if you are looking more for a vector primitive renderer you'll go probably better with libarts...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

rinco wrote:I seriously doubt pspsdk is the place to put such a port.
Yes, you are right, I really meant psp svn repository, parallel to PSPSDK, please move this thread to "PSP Software Development".
rinco wrote: It's also probably worth mentioning that I have submitted a SDL_gfx port to svn. SDL_gfx can rotate/zoom images and draw antialiased gfx primitives, including bezier curves (and has framerate control, whoop!).
SDL_gfx looks useful for the very low level side of such a library, but it is too limited, for example I can't set the line width and miter limit. And for bezier paths it is better to set the flatness instead of the number of steps.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

The eyeGT thing is interesting, but looks like it is a commercial library, so I've compiled Libart for the PSP and wrote a sample program. The full source code with EBOOT.PBP for 1.00 and 1.50 firmware:

http://www.frank-buss.de/tmp/libart.zip

Conclusion: it is not usable (or I've done something very wrong), because it needs some 10 seconds for rendering a simple 512x512 bitmap. Now I try Cairo.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Shine wrote:Conclusion: it is not usable (or I've done something very wrong), because it needs some 10 seconds for rendering a simple 512x512 bitmap. Now I try Cairo.
I haven't looked at libart, but I can tell you that Cairo makes extensive use of doubles, everywhere. My guess is that it will run as slow as libart.
Leviathan2040
Posts: 7
Joined: Sat Jul 09, 2005 5:26 pm

Post by Leviathan2040 »

Shine wrote:The eyeGT thing is interesting, but looks like it is a commercial library, so I've compiled Libart for the PSP and wrote a sample program.
You're right, eyeGT is a commercial library but not for PSP. This is because unless we decide to become Tools & Middleware developers with Sony it can't be sold as it is to do any commercial development. eyeGT is not a Virtual Machine or a Player and it is more than just a graphic library a la Libart or Cairo, as eyeGT abstract the whole GUI concept and makes it independent from the underlying platform.

We having been toying with the idea of releasing it for free (of course for non-commercial use) for the LUA pplayer as it seems the perfect combination; of course in order to be compatible with our license it has to stay closed source.

I would like to hear your comments on this.


Cheers,
Lev
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

just wanted to put in the info that someone already brought eyeGT to psp

http://bareblogs.com/BB.php?itemid=8

maybe this helps? (maybe contact this guy)

greets
Lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Leviathan2040
Posts: 7
Joined: Sat Jul 09, 2005 5:26 pm

Post by Leviathan2040 »

LuMo wrote:just wanted to put in the info that someone already brought eyeGT to psp

http://bareblogs.com/BB.php?itemid=8

maybe this helps? (maybe contact this guy)

greets
Lumo

He is the same guy that write in this forum under the Leviathan2040 nickname ;-)

Cheers,
Lev
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

could not know that ;)
good to know now :))

greets
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Leviathan2040
Posts: 7
Joined: Sat Jul 09, 2005 5:26 pm

Post by Leviathan2040 »

Shine wrote: http://www.frank-buss.de/tmp/libart.zip

Conclusion: it is not usable (or I've done something very wrong), because it needs some 10 seconds for rendering a simple 512x512 bitmap. Now I try Cairo.
I took the chance of converting your code to use eyeGT and yes, vector graphics can be fast. The PSP has a decent FPU but of course is not a PentiumIV running at 3.4GHz.

Have you tried to take out the alpha value out of the middle gradient color stop? Alpha values are killer for vector layered graphics, even if the libart rendering model seems to be incorect when draws over already drawn stuff.

Anyway grab the example from http://bareblogs.com/files/RandomStar_PSP.zip

I've included the modified source code.


Cheers,
Lev
Ska
Posts: 4
Joined: Mon Oct 10, 2005 3:58 am

Post by Ska »

I've an alternative ! ;)
I'm one of the developers of Amanith (www.amanith.org), it's a crossplatform opensource framework of classes in ansi c++ for handle vector graphics with powerful modelling functions (like curves cut, joins, flatten, and so on) and in the near future also with a good rendering layer and gfx-vector file format support (SVG, SWF). Amanith is also very portable, we have used only Ansi C++ with STL, so it compile under many environments (linux, freebsd, windows, macosx, irix, solaris) with gcc or visualstudio, on several platforms/processor (we have tested x86 and x86_64 intel machines, g4&g5 mac, mips from sgi, and sparc workstations). Some cool guys are porting Amanith also on BeOs, AmigaOS and MorphOS.
Post Reply