Re: Best tool? gdkpixbuf?



> My needs are fairly simple;
> 
> 1) Access to a rectangular area for pasting sprites into. Double buffered
> is better. Auto handling of expose events for me is better still.
> 
> 2) Convenience method to load .gif's/.other_file_format's into a sprite
> buffer.
> 
> 3) Convenience method to paste sprites into the rectangular area,
> regardless of screen depth and also sprite bitmap depth. THIS MUST BE
> FAST!! A notion of transparent would be good, too.
> 
> 
> Previously, I wrote all these by hand. But I'm guessing there will be
> GNOME API's to handle this? gnome-canvas? gdk-pixbuf? Are they fast?

I've been using GnomeCanvas and GdkPixbuf (and libart_lgpl) extensively
lately. They are very good, and I would recommend them. Don't use
GnomeCanvasImage (a GnomeCanvasItem); use GnomeCanvasPixbuf (another
GnomeCanvasItem) instead. They satisfy all 3 of your requirements.
	(1) The GnomeCanvas and it's GnomeCanvasItems are always flicker
		free. Events can be tied to induvidual GnomeCanvasItems
		(or groups using GnomeCanvasGroup).
	(2) GdkPixbuf can load practically any image format, and since
		it uses dynamically loaded modules to do so, it's
		memory conservative. Also, several GnomeCanvasPixbufs
		can use one GdkPixbuf, and GdkPixbuf's reference
		counting ability can automatically remove the image
		from memory when no more CanvasItems are using it.
	(3) Transparencies inside images loaded with GdkPixbuf are
		retained. GnomeCanvasItems can be layered on top of
		each other, and layers can be reordered. That way
		the GnomeCanvasItem for the sprite can be placed on
		top of all the background GnomeCanvasItems, but below
		GnomeCanvasItems representing objects in between the
		sprite and the player (such as the pillars in Prince of
		Persia ;-)
I use libart_lgpl to perform transformations on the GnomeCanvasPixbufs.
I'm not so sure how FAST everything is though. I guess you could find
out by writing a quick test app that has a sprite moving around a
canvas. 

Have fun!

|       LOBAN AMAAN RAHMAN  <-- anagram of -->  AHA! AN ABNORMAL MAN!      |
|   Snail: MSC #763, Caltech, Pasadena, CA 91126, USA. ** 1-626-395-1407   |
|     Wired: loban@earthling.net, loban@caltech.edu, http://i.am/loban     |
| (Do 'finger loban@ugcs.caltech.edu' for my PGP public key and more info) |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]