[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

RE: [XaraXtreme-dev] Bitmap Gallery drag/View redraw



I'm pretty certain that you can do this as the non-transparent dragging
also does it and that works fine.  The initial background is copied away
in SetupSolidDrag and DrawSolidDrag also copies what is on the screen.
 
The rendering code is quite tricky to understand as it deliberately
doesn't just blit the old background back to the screen before copying
away a new background and rendering the drag to eliminate the horrible
flicker that you get with that approach.

I expect that you should be able to get it working fairly quickly with a
bit of experimentation.  You could try blitting the various other
bitmaps to the screen instead of the OffscreenDC (e.g. to see what is in
the mask).

Gerry

-----Original Message-----
From: owner-dev@xxxxxxxxxxxxxxxx [mailto:owner-dev@xxxxxxxxxxxxxxxx] On
Behalf Of Alex Bligh
Sent: 28 April 2006 17:47
To: dev@xxxxxxxxxxxxxx
Cc: Alex Bligh
Subject: RE: [XaraXtreme-dev] Bitmap Gallery drag/View redraw

Gerry,

> I though I ported that function pretty accurately but the colour drags
> don't use it so I it hasn't really been tested yet.  The original MFC
> based function is as below.  I suppose I might have got some of the
blit
> modes wrong.  It does the following:
> - Create ScratchDC of the current drag rectangle
> - Copy the current screen contents into ScratchDC

Bzzzt - I think this is likely to be the problem. I don't think you
can do this. For a start the DC is double buffered. Even if double
buffering is turned off on the window, I don't think this will
necessarily
work.

If this technique does work, it's very exciting as I can make the
wxAUI windows transparent rather than Venetian blinds. (well, if that's
the sort of thing you get excited about...)

> - Copy the old drag rectangle parts of the stored background from
BackDC
> into ScratchDC.
> - Create TempDC of the current drag rectangle
> - Ask the DragInfo to render the drag into TempDC
> - Apply the MaskBitmap by doing an AND-blit into TempDC
> - Create OffscreenDC of the current drag rectangle
> - Copy ScratchDC into OffscreenDC
> - Apply MaskBitmap to OffscreenDC (AND-blit)
> - Copy the rendered drag into OffscreenDC (XOR-blit)
> - Copy part of OffscreenDC into stored background (BackDC)
> - Copy OffscreenDC to screen
> - Copy stored background (BackDC) to screen (old drag rectangle)
> - Store away the new background for next time (copy ScratchDC to
BackDC)
>
> The AND and XOR parts are a bit tricky to get your head around but
they
> do make sense.  The wx version calls them something very different so
> the Boolean nature isn't obvious...
>
> The problem is almost certainly something to do with the mask bitmap.
> Most probably colours for the masking need to be set up (there are two
> lines commented out as I wasn't sure what to change them to and wasn't
> concerned with transparent drags at the time).

If the Mask is wrong (I reasoned) you'd see either the background
bitmap, or the dragged bitmap, in the wrong place. Not black.

Oh well, being able to muck around with pseudo transparent windows
without a compositing manager is enough reason to play with it I
guess :-)

Alex