Alright, well I've decided to take another approach. I'm XGetImage()ing the root window, then I darken my pixels, then, I go to store the data in a Drawable via XPutImage, but this Drawable isn't retaining the data, it's just white when I XCopyArea() over to what I want shown. Any suggestions/reasons why this is happening?<br>
<br>Code sample:<br><br>static XImage *xi; <br>
<br>void XTintBG(Monitor *m, int x, int y, int w, int h) { <br>
unsigned long new_color; <br> unsigned long r,g,b; <br>
<br> XCopyArea(dpy, root, m->barwin, dc.gc, x, y, w, h, x, y); <br>
xi = XGetImage(dpy, m->barwin, x, y, w, h, AllPlanes, XYPixmap); <br> <br>
for(int pix_y = 0; pix_y < h; pix_y++) { <br> for(int pix_x = 0; pix_x < w; pix_x++) { <br>
new_color = XGetPixel(xi, pix_x, pix_y); <br> r = g = b = 0x00000000; <br>
r = (new_color & 0x00FF0000) >> 16; <br> g = (new_color & 0x0000FF00) >> 8; <br>
b = (new_color & 0x000000FF) >> 0; <br> r -= 32; <br>
g -= 32; <br> b -= 32; <br>
if(r > 255) r = 255; <br> if(r < 0) r = 0; <br>
if(g > 255) g = 255; <br> if(g < 0) g = 0; <br>
if(b > 255) b = 255; <br> if(b < 0) b = 0; <br>
new_color = r << 16; <br> new_color = new_color | (g << 8); <br>
new_color = new_color | (b << 0); <br> XPutPixel(xi, pix_x, pix_y, new_color); <br>
} <br> } <br>
<br> XPutImage(dpy, m->barwin, dc.gc, xi, 0, 0, 0, 0, m->ww, bh); <br>
XCopyArea(dpy, m->barwin, <a href="http://dc.bg">dc.bg</a>, dc.gc, 0, 0, m->ww, bh, 0, 0); <br>
} <br> <br>
int ftime = 1; <br> <br>
void <br>drawbar(Monitor *m) { <br>
int x; <br> unsigned int i, occ = 0, urg = 0; <br>
XftColor *col; <br> Client *c; <br>
<br> if(ftime == 1) { <br>
ftime = 0; <br> XTintBG(m, 0, 0, m->ww, bh); <br>
} <br> <br>
XCopyArea(dpy, <a href="http://dc.bg">dc.bg</a>, dc.drawable, dc.gc, 0, 0, m->ww, bh, 0, 0); <br><br><More functions here but not relative to what I need><br><br>}<br><br><div class="gmail_quote">On Mon, Aug 20, 2012 at 3:17 PM, Adam Jackson <span dir="ltr"><<a href="mailto:ajax@redhat.com" target="_blank">ajax@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 8/20/12 2:08 PM, Lee Fallat wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey,<br>
<br>
I'm trying to darken/lighten the image data in a Drawable/XdbeBackBuffer.<br>
Any ideas on how to get access to the data?...I've done an XGetImage() on<br>
Drawable but that really slows down the application I'm editing...<br>
</blockquote>
<br></div></div>
That is, in fact, how you do it. GetImage is not fast. ShmGetImage is faster, and as fast as you're going to get, if you insist on doing this by pulling all the pixels down to the client and then pushing them back up.<br>
<br>
You may instead wish to use the Render extension, which gives you the usual set of Porter-Duff blend operations, and which runs in the server so you're not copying all that data around.<br>
<br>
- ajax<br>
<br>
</blockquote></div><br>