[comp.sys.mac.programmer] Help! offscreen DrawPicture messes colors up.

rla20@duts.ccc.amdahl.com (Roger Allen) (03/07/91)

This should be an easy one for some net-guru out there...

Here is what I am doing:

I am displaying a color picture in a window and also keep a copy of
the picture in an offscreen PixMap.  Everything about this situation
seems hunky-dory, updates via copybits works great, scrolling works,
etc.

I am implementing Copy/Paste and having problems with DrawPicture (I
think).  If the user selects a rectangle to copy, I do the following:
   1. Set the port to the offscreen PixMap.
   2. Set the clip rect to the selection rectangle.
   3. Open a Picture.
   4. CopyBits the selection rect from the PixMap to the PixMap.
   5. Close the Picture & put it in the scrap.
The above works fine.  Please read on.

Here is my problem:

If I paste the picture to the window (via SetPort & DrawPicture)
the colors are good.  BUT, if I paste to the offscreen PixMap (via
SetPort & DrawPicture), the next update to the window (a CopyBits
from PixMap to window) shows that the pasted rects colors are all
messed.

So, my question is: why would DrawPicture work for the window but not
the offscreen PixMap, when the picture was made from the PixMap?

Any help at all would be great, please E-mail me and I will summarize
the responses.

Thanks in advance,

Roger

--
> Roger Allen                    |  :~) "I always lie"                   <
> Amdahl Computer Development    |                                       <
> rla20@duts.ccc.amdahl.com      |  ;~( "I'm lying now"                  <

smoke@well.sf.ca.us (Nicholas Jackiw) (03/11/91)

This may not be the problem, but if your port's forecolor & backcolor
aren't black and white at the time of the CopyBits (as they may not be
if your picture-drawing routine's changed them), CopyBits will "colorize"
your picture for you.  The taste that it shows when colorizing is one
understood best by its author...   Try throwing in a ForeColor(blackColor)
and BackColor(whiteColor) immediately before your copyBits, and see if
that changes anything.

-- 
                              --- * ---
Nicholas Jackiw                Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu
Key Curriculum Press, Inc.     Applelink: D3970    | (415) 548-2304
                              --- * ---