Hello:
I'm playing with the blending/drawing facilities of the GDI+ package, particullary painting image with alpha channels over the DesktopView canvas. I was trying to make a View (a splash indeed) which draws itself like "blended" (an overlay) on the desktop. I've accomplished this, making a fake effect: a bitBlt: of the rect behind the window before it gets opened, and then all the #onPaintRequired: events draws over that copy of the background. If nothing moves behind the view area, the trick works. If a window behind the view moves, this little magic trick got revealed. My questions are: Is it possible to blend the view canvas over the background* of that view? Is it possible to get a copy of the background* of that view when it is already opened? Windows2000/XP supports an alpha mode of it's windows, does Dolphin as it comes out of the box supports that? * With background i mean all windows/views behind that view. Thanks in advance. -- Esteban. |
Esteban A. Maringolo wrote:
> Windows2000/XP supports an alpha mode of it's windows, does > Dolphin as it comes out of the box supports that? No (not that I know of, anyway), but Udo Schneider posted a small extension to allow it some time back. Just 8 loose methods. See: http://udos.swiki.net/3 I use it and it works well for me (Thanks, Udo!). -- chris |
>> Windows2000/XP supports an alpha mode of it's windows, does
>> Dolphin as it comes out of the box supports that? > No (not that I know of, anyway), but Udo Schneider posted a small > extension to > allow it some time back. Just 8 loose methods. See: > http://udos.swiki.net/3 > I use it and it works well for me Yes, i'm using it, and it works fine. Made a splash with a fade in and fade out effect. I'll post a link here, to anybody interested. However, many times when I change some of the window attribute (colorKey or alphaBlend) the effect doesn't appears. But if I set the layered bit before changing the attribute, the change occurs immediately. So i've choosen the second. Looking for this at the MSDN, it says something about. This goodie only uses the SetWindowAttributes api call, without using the UpdateWindowAttributes, which I understand should be used to update the attributes once the window has been created. Note that SetWindowsAttributes invalidates any subsequent call to UpdateWindowAttributes. I don't know if I am using it properly. If not, perhaps a small tweak can make it work in a more appropiate way. > (Thanks, Udo!) Yes, thanks again. About having a transparent window... * colorKey is just a colorMask, of which color gets transparent. Doesn't support alpha channels. * Redefining the onEraseRequired method of my view to fill the clientRectangle with a transparent brush, get the effect, but if some window moves behind it, the background of the window is different of what really is behind it. I'm getting closer... :-) Best regards. -- Esteban. |
Esteban A. Maringolo wrote:
> However, many times when I change some of the window attribute (colorKey > or alphaBlend) the effect doesn't appears. But if I set the layered bit > before changing the attribute, the change occurs immediately. So i've > choosen the second. FWIW, the way I think of it is that #isLayered: sets whether alpha-blending is available at all, and #alphaBlend: sets how much of it is to be used. I've coded it on that basis and it seems to work OK. If I turn on #isLayered: then the Shell re-creates itself (which is understandable), causing a slight flicker on the screen. Once it is turned on, I can set the level of blending to whatever I want with no further loss of smoothness. > About having a transparent window... > * colorKey is just a colorMask, of which color gets transparent. Doesn't > support alpha channels. > * Redefining the onEraseRequired method of my view to fill the > clientRectangle with a transparent brush, get the effect, but if some > window moves behind it, the background of the window is different of what > really is behind it. I'm not sure what you are trying to achieve here. Are you trying to make some parts of your window more transparent than other parts ? Or maybe to have a semi-transparent "hole" in an otherwise normal window ? If so then perhaps you could get the effect by using two windows that are tied together so that one is always over the other (I don't know how easy or difficult that would be to do), the top window would use colour-keying to create a "hole" through which the bottom window showed, the bottom window would be alpha-blended so that you could then see (partially) through that too. Sounds a lot of bother to me... BTW, I'm using alpha-blending so that monitoring tools don't obscure too much of the screen space. I set it/them to 'always on top' and make them quite strongly transparent. That sort of works OK (from a user-interface point of view), but it isn't really what I want. What I'd like is for the tool to be at the /bottom/ of the window stack, but still to show through everything above it. That way I could interact with the overlying applications, but still check the monitoring status. I don't have even faintest idea of how to achieve that, though :-( -- chris |
> Esteban A. Maringolo wrote:
>> About having a transparent window... >> * colorKey is just a colorMask, of which color gets transparent. Doesn't >> support alpha channels. >> * Redefining the onEraseRequired method of my view to fill the >> clientRectangle with a transparent brush, get the effect, but if some >> window moves behind it, the background of the window is different of what >> really is behind it. > I'm not sure what you are trying to achieve here. Are you trying to make > some > parts of your window more transparent than other parts ? Not really. What I want is a window with alpha channel, which, at this time, doesn't seems to be an easy task :-) If I draw a GdiplusImage with alpha channel (i.e. a PNG-24) over the desktop canvas, it renders fine, with the alpha levels of the image. What I want is a view (a Window) on which I can draw this image, and when i move the window, or some window moves behind it, the change reflects. In this case the image is a picture with a shadow (with alpha). It's just a fancy thing, so i will not spend much more time by now :-) > Or maybe to have a semi-transparent "hole" in an otherwise normal window > ? > [snip] > could then see (partially) through that too. Sounds a lot of bother to > me... Yeap, to me too. > BTW, I'm using alpha-blending so that monitoring tools don't obscure too > much > of the screen space. I set it/them to 'always on top' and make them quite > strongly transparent. That sort of works OK (from a user-interface point > of > view), but it isn't really what I want. What I'd like is for the tool to > be at > the /bottom/ of the window stack, but still to show through everything > above > it. That way I could interact with the overlying applications, but still > check > the monitoring status. I don't have even faintest idea of how to achieve > that, > though :-( The window stack determines the overlapping between windows, so I don't see it as a possible approach, if a window goes to the bottom of the stack, it gets overlapped by the windows above it. What about setting the view to transparent (isTransparent: true)? That would make that all the mouse clicks pass-trough that view to the windows behind it. In that way, you could have a monitoring view (a gauge or something similar), alpha blended at 25%, _over_ your main window, but if the view and all the subviews of this monitor are transparent (to mouse events) they will not interrupt the user interaction with the main window. Of course, i'm just guessing... :-) Best regards, -- Esteban. |
Esteban A. Maringolo wrote:
> What I want is a view (a Window) on which I can draw this image, and when > i move the window, or some window moves behind it, the change reflects. > In this case the image is a picture with a shadow (with alpha). So you end up with a window (no matter how it's implemented) that looks solid but has a partially transparent "hole" in it where your graphics are overlayed on the windows behind ? As I said I think you could do that with two windows using the built-in alpha-blending and colour-keying. But I can't see how to do it otherwise -- which is frustrating because Windows obviously has all the features built-in that you need to implement this directly, but there doesn't seem to be a way of getting at them... > What about setting the view to transparent (isTransparent: true)? > That would make that all the mouse clicks pass-trough that view to the > windows behind it. That's a good idea, thanks. I hadn't realised that #isTransparent made 'layered' windows completely transparent to user input. I've done some messing around with the idea and I think it will work. The immediate problem is that once you have made a layered window transparent, you can't interact with it /at all/ ;-) So I've gone back to the two-window trick -- one normal "master" window and another window "slaved" to it. The slave is forced to match the size and position of the master window, but it is set to be always-on-top, transparent, layered, and alpha-blended. Now all I want is a way to make the slave "mirror" the contents of the master window. I can easily write specific code to display stuff in the slave, but ideally I'd like to be able to mirror an arbitrary window with little modification to that window's code. I'd hoped (naively) that just making the slave's #onPaintRequired: call the master's #onPaintRequired: (but passing its own hdc) would do the trick, but apparently not ;-( Suggestions, anyone ? -- chris |
Free forum by Nabble | Edit this page |