I am trying to create an XImage, but after the function call to XCreateImage(), my XImage pointer's value is 0. I really don't know much about Xlib. I want to create an XImage for image data that I already have.

Can someone give me a list of steps to follow that lead to a properly created XImage?

I am currently getting the WindowAttributes from the root window and passing its Visual* to the XCreateImage() function, while guessing at some of the other values. The image data that I have is for a 24-bit image. I assume that I should put the data into a contiguous char array. Below is the relevant portion of my code...
--------------------------------------
const int DEPTH = 24;
const int WIDTH = 100;
const int HEIGHT = 100;
const int FORMAT = ZPixmap;
const int OFFSET = 0;
const int BITMAP_PAD = 0;
const int BYTES_PER_LINE = (WIDTH * 3);


const int IMAGE_BYTES = WIDTH * HEIGHT * 3;

XWindowAttributes* rootWindowAttributes = new XWindowAttributes;

Visual* visual = rootWindowAttributes->visual;

char* data = new char[IMAGE_BYTES];

XImage* xImage = XCreateImage(display,
                             visual,
                             DEPTH,
                             FORMAT,
                             OFFSET,
                             data,
                             WIDTH,
                             HEIGHT,
                             BITMAP_PAD,
                             BYTES_PER_LINE);
--------------------------------------

Josh Davis


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to