Drawing RAW image to X-Window
I want to draw image on an X-Window. This will be so simple than reading a Jpeg file and drawing it I guess. Here is what I need:
I have completely RAW images. Think of it as a matrix of any size, for example size=4x4 and the image is like this:
10 125 43 157
99 45 182 84
59 168 39 65
16 67 154 27
That is, the values are from 0 to 255, so they represent graylevels. (No color is involved.) Of course, the above is a simple example; I'll work on images of larger sizes.
I have compiled the simple programs at this address. I want to modify them according to my needs and I know that, I need to work with XImage, XCreateImage and related functions but I don't know how to do it.
For example, one program uses the function
int rc = XReadBitmapFile(display, win,
and reads and displays a BMP image BUT I only want to display the values of a matrix MyImage[i][j], where i=j= 1 to 4 for above matrix.
Would any one help me on how to use the X library functions with examples if possible? :confused:
Thanks a lot!!
How to use the functions to display?
Well, thanks for the valuable ideas.
Would anyone give me some idea how to go with either Xlib or Imlib2?
Like, read the file like this, using this function and display it using this function.