Advertisement
GEnGEr42

x11 pixture edit and copy

Nov 7th, 2018
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. function xy ( window w )      // wich is the aplication window
  2.   XWindowAttributes x_window_attrs;
  3.   CHECK(XGetWindowAttributes(display_, w, &x_window_attrs));
  4.  
  5.  const Window frame = XCreateSimpleWindow(
  6.       display_,
  7.       root_,
  8.       x_window_attrs.x,
  9.       x_window_attrs.y,
  10.       x_window_attrs.width,
  11.       x_window_attrs.height,
  12.       BORDER_WIDTH,
  13.       BORDER_COLOR,
  14.       BG_COLOR);
  15.  
  16.  
  17.   XSelectInput(
  18.       display_,
  19.       frame,
  20.       Somemask);
  21.  
  22. // here is my helpless try to copy images from one frame to another
  23. // 1. i loop over the size of the image
  24. // 2. i generate a XImage / Pixmap  ( non of wich im shure of works just found them in tutorials)
  25. // 3. do stuff pixel_line by pixel_line
  26. // 4. trying to reprint it to the window
  27.  
  28.  
  29. for (pixel_row=0; pixel_row <  x_window_attrs.height;  pixel_row++){
  30.   XImage *img = XGetImage(display_, w, 0, pixel_row, x_window_attrs.width, 1, AllPlanes, XYPixmap);
  31.   Pixmap p = XCreatePixmap(display_, XDefaultRootWindow(display_), x_window_attrs.width, 1, x_window_attrs.depth);
  32.  
  33.   // do stuff with pixel by pixel line
  34.  
  35.   XGCValues gcvalues;
  36.   GC gc = XCreateGC(display_, p, 0, &gcvalues);
  37.   XCopyArea(display_, p, w, gc, 0, pixel_row, x_window_attrs.width, 1, 0, 0);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement