[vox-tech] reading bitmaps in XLib

Bill Kendrick vox-tech@lists.lugod.org
Thu, 16 Oct 2003 23:06:21 -0700


On Fri, Oct 17, 2003 at 03:21:39PM +1000, Julie Russell wrote:
> Hi Everyone,
> 
> I am trying to display a bitmap(.bmp) on the screen using xlib. I am using
> XReadBitmapFile to load the bitmap but it is giving me a BitmapFileInvalid
> on return.

As someone else mentioned Xlib's idea of a "bitmap" is an XBM file
(literally a bit map... black, white, the end :^) ), and can't open
Windows BMP files.

Depending on what you're doing, you might want to look into a higher
level API.  Personally, I write lots of games, and use
Simple DirectMedia Layer (SDL) to handle all of the blitting and
dealing with input and sound and such.

What's nice about it, is that it runs on a variety of platforms.
It's Open Source (LGPL), of course.  And, it handles BMP loading internally!
(There's also an add-on lib to load GIF, JPEG, PNG, etc.)
See: http://www.libsdl.org/


If you need something less gamey and more GUI, you might want to look
into the usual suspects like GTK+ and Qt, or the less usual suspects like
wxWindows.[*]

Good luck!

-bill!
-- 
bill@newbreedsoftware.com                           Got kids?  Get Tux Paint! 
http://newbreedsoftware.com/bill/       http://newbreedsoftware.com/tuxpaint/

[*] Or is it wxWindow?