Jump to content
  • Advertisement
Sign in to follow this  
Borneq

How copy bitmaps from memory to screen? (X11)

This topic is 1105 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

X11 has architecture client-server. Client send requests to draw simple primitives. Request CopyArea copy pixels from one screen area to other.

But if is possible copy whole bitmaps from client memory to server screen? For example, I read jpg or png file to memory and I want display it.

Share this post


Link to post
Share on other sites
Advertisement

I think this should do it for you:

  1. Load the image data (perhaps use something like libmagic).
  2. Create an image using XCreateImage.
  3. Create an off-screen pixel map using XCreatePixmap.
  4. Put the image in the pixel map using XPutImage.
  5. Paint the image onto the window using XCopyArea on all expose events.

I did the same thing a while back from something base on a solution I read on stackoverflow. Luckily I save the link the code comments. http://stackoverflow.com/questions/6609281/how-to-draw-an-image-from-file-on-window-with-xlib 

 

Hope it helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!