On Oct 20, 2006, at 22:00 UTC, Peter Mitchell wrote:

> I'm stuck on this one. I thought I had looked at an example where  
> this was possible but I either can't find it or I'm imagining it.

Are you thinking of the old DragPics example, perhaps?

> I have a canvas that I set the backdrop to a picture.
> I create a picture with transparent set that is the same size as the  
> canvas.
> Then I draw the picture into the canvas.
> 
> This works and I can draw in the picture which I re-draw to the  
> canvas and the backdrop picture shows through.

I guess it would -- but note that this works only because you're using
one-bit transparency.  If you used a masked picture instead, this
wouldn't work too well, because you'd be drawing the semitransparent
parts multiple times (causing them to get more solid each time).

> But when I try to "erase" in the picture it does nothing.

What do you mean by erase, and what do you expect it to do?

> If transparent is set I can not set the pixels to white so I can't get
> the effect of erasing and leaving the backdrop image untouched.

Hmm, I'm quite sure you CAN set pixels to white in a transparent
picture; of course this makes them transparent.  If you then draw this
picture someplace, those pixels will not get drawn.  This will of
course not cause the backdrop to magically reappear -- you've simply
refrained from drawing over the old drawing of the picture in those
places.

If by "erase" you mean cause the backdrop to reappear, then of course
you have to draw the backdrop in those places.  (Or refresh the canvas,
but that's not a very good idea.)

It sounds to me like you're doing animation over a backdrop, in which
case your technique of just overdrawing any previous content with a
transparent picture is not appropriate.  On a double-buffered system
like OS X, whenever the content changes, you should:

 1. Draw the backdrop
 2. Draw the foreground

On a non-double-buffered system like Windows, you should:

 1. Make a "buffer" picture the same size of your canvas
 2. Draw the backdrop into your buffer
 3. Draw the foreground into your buffer
 4. Draw the buffer into the canvas

Note that the buffer is not transparent at all, so overdrawing with
that is just fine.

HTH,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to