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

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


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

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 :-)