Advertisement

simple

Started by November 09, 2000 04:48 AM
5 comments, last by kroiz 23 years, 10 months ago
I''m learning xlib in a course and i was given an assignment to make a painter, and for the saving and loading option i need some sort of a function to load and save image to and from a file. I undertand that there is no function like that on the Xlib, where can i find this function on some other lib. some thing simple no SDL please remember this a class assignment not a comercial software. plz help.
0 error(s), 0 warning(s)
Ugh, one of *those* instructors. :p

Well, it''s a steep learning curve but...
I have an Xlib example `handout'' I usually give to posts like this, if yer interested let me know, it''s not too long but I need
to send it via e-mail, so e-mail address please if yer
interested!

If you want to `paint'', Xlib gives you two options,
one is the Pixmap object, it''s an `offscreen'' Drawable
that you call Xlib functions to draw to it.
It''s a bit slow and limited but a good starter.

Next is XImage, this is another one of XLib''s objects
but there are no XLib functions to draw things to it, rather it requires that you draw to it yourself using your own
`blitting'' code.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
Advertisement
quote: Original post by LearFox

If you want to `paint'', Xlib gives you two options,
one is the Pixmap object, it''s an `offscreen'' Drawable
that you call Xlib functions to draw to it.
It''s a bit slow and limited but a good starter.

Next is XImage, this is another one of XLib''s objects
but there are no XLib functions to draw things to it, rather it requires that you draw to it yourself using your own
`blitting'' code.


tanx but i know how to use pixmaps and images but
i just dont know how to load them from disk, i think there
is no support for that in xlib.
0 error(s), 0 warning(s)
It sounds like you''re looking for a method of reading and writing a binary image file of some sort (i.e. bitmap, Jpeg, tga, etc..) What you really need to do is decide on a format. Once that''s done, you can get all the exact specs at www.wotsit.org




Next, you can find one of Nehe''s tutorials (I''ve got several of them translated to GLX on my site: www.jacksonville.net/~planetes in order to find a function that reads a image file. For example, Lesson 22, has a loadtexture function that loads a BMP (bitmap). The method is the same for any format. You''d need to study the format and then read the correct bits for the correct portion of the image.
Or, if you want to use the self-proclaimed "Turbo-Studly Image Format," check out PNG at http://www.libpng.org/pub/png/.

-benc
You might want to look into Imlib, it''s a big wrapper
library to load virtually any image format you want
under Linux.

I can''t seem to find the tutorial for it anymore, so
if you''d like to see an example let me know.
To load one using Imlib into data for an XImage is a snap.
Hardest part is just setting up the XImage.

ftp://ftp.enlightenment.org/enlightenment/enlightenment/libs/

Basically Imlib has a function that lets you load
an image into a RRGGBB format, where that is three
u_int8_t''s. (mask/alpha channel stuff available too).
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
Advertisement
quote: Original post by LearFox

You might want to look into Imlib, it's a big wrapper
library to load virtually any image format you want
under Linux.


tnx allot this ImLib is pretty cool very simple
just what i needed.
again tank you.


Edited by - kroiz on November 16, 2000 6:00:33 PM
0 error(s), 0 warning(s)

This topic is closed to new replies.

Advertisement