By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

How to save XImage as bitmap?

P: 2
Hello,
i'm trying to create JNI C++ library that will capture desktop video (frames). First step is to simply make a screenshot of desktop. Code is :
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <X11/Xlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.         Display *display;
  9.         int screen;
  10.         Window root;
  11.         display = XOpenDisplay(0);
  12.         screen = DefaultScreen(display);
  13.         root = RootWindow(display, screen);
  14.         XImage *img = XGetImage(display,root,0,0,400,400,XAllPlanes(),ZPixmap);
  15.  
  16.         if (img != NULL)
  17.         {
  18.            //save image here
  19.         }
  20.         return 0;
  21. }
  22.  
But, how to save img as bitmap file ? Because target library is JNI - it must not use third-party libraries. (as i understood).
Please, help.
Thank you.
Oct 29 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.