How do I get BYTE* from a Pixmap?

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

7 posts / 0 new
Last post
How do I get BYTE* from a Pixmap?

Submitted by Anonymous on Thu, 08/31/2000 - 17:41. Developers
I am having some problems getting the actual bits that compose a pixmap. I need a way to fill in image data using the pointer to raw data, then blt that to a Motif viewport. If anyone can give me suggestions or references, I would appreciate it much.

Se7en

Anonymous

Have you tried using XPM or IMlib APIs? If you use IMlib, you can load many different ytpes of images into a pixmap, and render it easily to any X window.

Where does your "pointer to raw data" come from? What format is it?

- scorch

Anonymous

Let me try again...

I am writing a program that needs to write directly to memory, much like an assembly programmer writes directly to the video buffer to output graphics. I`m sure that all pixmaps store the image data somewhere as a big huge array that represents the data (size of array = width*height*bitsPerPixel), and I need access to that image data directly, since I don`t plan on calling setpixel for each and every pixel on the image.

So basically, I cannot find how to get the start of this big array of image data. I was hoping that there is a utility function that I can use to get this, or if there are any suggestions you may have to get that data.

Thanks,

Se7en

Anonymous

If you are talking about writing directly to the screen buffers memory, it does not work that way in Motif or X11.

You can use the drawing primitives to write into a drawable which can be a window or a pixmap, both of which are server side resources (basically outside the user memory space of your app.)

So, to manipulate the drawable`s data in user space, you can use the XGetImage() and XPutImage() functions.

For more info, try
man XGetImage
and
man XPutImage

There is the X Image Extension (XIE), of which O`Reilly has a thick book on, but I have no dorect experience with.

Let me know if you need more,

- scorch

Anonymous

Thank you, with that reference to XGetImage, I was able to figure out what I needed. You rule!

Se7en

Anonymous

Hi,
I have the same problem with it.
I still can`t use the function well for dealing with the program.
so, can you give me a example for it ??

thanks a lot...

Anonymous

Hi, I have an even better idea!

There are some handy applications that come with X11, one of
which is xpaint.

I would look at the sources for it, and hunt around for the
invocations of the functions I mentioned previously.

Good luck!

-scorch