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 :
#include <iostream>
#include <X11/Xlib.h>
using namespace std;
int main()
{
Display *display;
int screen;
Window root;
display = XOpenDisplay(0);
screen = DefaultScreen(display);
root = RootWindow(display, screen);
XImage *img = XGetImage(display,root,0,0,400,400,XAllPlanes(),ZPixmap);
if (img != NULL)
{
//save image here
}
return 0;
}
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.