How to edit Drawable/XdbeBackBuffer data?...
ircsurfer33 at gmail.com
Tue Aug 21 15:56:44 PDT 2012
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?
void XTintBG(Monitor *m, int x, int y, int w, int h)
XCopyArea(dpy, root, m->barwin, dc.gc, x, y, w, h, x,
xi = XGetImage(dpy, m->barwin, x, y, w, h, AllPlanes,
for(int pix_y = 0; pix_y < h; pix_y++)
for(int pix_x = 0; pix_x < w; pix_x++)
new_color = XGetPixel(xi, pix_x,
r = g = b =
r = (new_color & 0x00FF0000) >>
g = (new_color & 0x0000FF00) >>
b = (new_color & 0x000000FF) >>
if(r > 255) r =
if(r < 0) r =
if(g > 255) g =
if(g < 0) g =
if(b > 255) b =
if(b < 0) b =
new_color = r <<
new_color = new_color | (g <<
new_color = new_color | (b <<
XPutPixel(xi, pix_x, pix_y,
XPutImage(dpy, m->barwin, dc.gc, xi, 0, 0, 0, 0, m->ww,
XCopyArea(dpy, m->barwin, dc.bg, dc.gc, 0, 0, m->ww, bh, 0,
int ftime =
unsigned int i, occ = 0, urg =
if(ftime == 1)
XTintBG(m, 0, 0, m->ww,
XCopyArea(dpy, dc.bg, dc.drawable, dc.gc, 0, 0, m->ww, bh, 0, 0);
<More functions here but not relative to what I need>
On Mon, Aug 20, 2012 at 3:17 PM, Adam Jackson <ajax at redhat.com> wrote:
> On 8/20/12 2:08 PM, Lee Fallat wrote:
>> I'm trying to darken/lighten the image data in a Drawable/XdbeBackBuffer.
>> Any ideas on how to get access to the data?...I've done an XGetImage() on
>> Drawable but that really slows down the application I'm editing...
> 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.
> 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.
> - ajax
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the xorg