[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
How to draw image with transparency over another image ?
From: Vladimir ####@####.#### Date: 30 Nov 2007 07:58:48 +0000 Message-Id: <ce55079f0711292358i7de6267amd91e8e0f7432a41@mail.gmail.com> Hi, I write nano-x based daemon, that should display battery indicator on main screen. Battery indicator is a series of PNG images with transparency. Main screen (root window) has a picture as background. And the question is - how to draw the PNG image over the window ? I mean that if the battery state is changed that I should draw another image on the same position, but of course the background will not repaint by itself. Is there any easy way to do so ? Or I should save the image behind the battery indicator to some offscreen pixmap and after each change of its state I should restore the background and then draw the battery image ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] How to draw image with transparency over another image ?
From: "Greg Haerr" ####@####.#### Date: 30 Nov 2007 17:13:24 +0000 Message-Id: <12bf01c83374$52c4a0e0$0300a8c0@RDP> : And the question is - how to draw the PNG image over the window ? : I mean that if the battery state is changed that I should draw another : image on the same position, but of course the background will not : repaint by itself. There's a function GrClearWindow, which could force the root window to redisplay the picture... but I'm not sure that's a good idea here, since the implementation of this function would like cause the entire picture to be re-displayed, clipped to your small battery display area, which would waste tons of CPU time. If your battery area was in fact a window, with no background or border, then unmapping the window would have the same effect. If the battery were a background image on that window, it might be drawn with transparency and the whole thing handled by unmap/map of the battery window... ? I'm not sure whether we correctly handle transparency with background pixmaps... : Or I should save the image behind the battery indicator to some : offscreen pixmap and after each change of its state I should restore : the background and then draw the battery image ? That's probably a pretty good idea. I'm not sure how to handle the problem of when the root window image changes though. You'd likely have to select for root window UPDATE events. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |