[comp.sys.mac.programmer] When Drawing PICT resources ...

hanoirx@ucscb.ucsc.edu (Hanoi Rocks) (08/12/90)

	Is there a way to draw a PICT resource to the current window so
that it is transparent?

Thanks in Advanced ...

	hanoirx@ucscb.ucsc.edu
	MacNET:	KIMSTJOHN
	AppleLink:	d5014

jackiw@cs.swarthmore.edu (Nick Jackiw) (08/13/90)

hanoirx@ucscb.ucsc.edu (Hanoi Rocks) writes:
> 
> 	Is there a way to draw a PICT resource to the current window so
> that it is transparent?
> 

There are many different sorts of transparency, when you consider the
transfer options available in old and Color quickdraw combined. Without
going into which you need, the basic answer is no; there is no way to
force DrawPicture to use different transfer modes than those with which
the picture was recorded (short of writing your own pic-statement
interpreters, bottlenecks, that sort of stuff).

The easiest way I know to do this is to create an offscreen grafPort, with
bounds as wide as the PicFrame.  Draw your picture there.  Then, use
CopyBits to copy it from the offscreen port to the current window with
srcOr as your transfer mode (or one of the Color quickdraw modes, if you're
working with color pictures).  This is not very difficult, but has the
(possible) disadvantage of taking up a fair amount of memory temporarily.
If your pictures are big in dimension and colored at a large pixel-depth,
and your application is already tight on memory, you might want to
request extra memory with the Multifinder temporary memory allocation
calls.  You'll only need it until you've done the CopyBits.



-- 
+-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+
|  nicholas jackiw  | jackiw%campus.swarthmore.edu@swarthmr.bitnet           |
+-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+
"Ah...I've got this CHRONIC pain."                             _True Believer_