[comp.sys.mac.programmer] Pixmaps In Pict's

allenb@cs.uoregon.edu (Allen F. Brookes) (11/21/90)

How do I put a pixmap into a PICT image?  It seems from the documentation
that all I need to do is do a copybits and the pixmap will be recorded into 
the PICT.  This doesn't seem to work however.

Allen

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (11/21/90)

You have to create a place to copy your pixmap to. If you are using 
32big Quickdraw then make use of the Graphic World calls to build 
yourself an off-screen pixmap. Otherwise, you can do it by hand or use 
the other routines Apple has provided in DTS sample code (15 and 16). 
Copy your image to the offscreen buffer then between the Open/Close 
Picture calls _Copybits that back to the screen ( you can also, just 
_copybits the screen image - current grafport - to itself ie: make the 
source and destination pixmaps the same thing).


--  

   	Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
   	via The Black Cat's Shack's FidoNet<->Usenet Gateway
	    blkcat.fidonet.org   and   Fidonet 1:109/401

topix@gpu.utcs.utoronto.ca (R. Munroe) (11/21/90)

In article <1990Nov20.190300.25020@cs.uoregon.edu> allenb@cs.uoregon.edu (Allen F. Brookes) writes:
>How do I put a pixmap into a PICT image?  It seems from the documentation
>that all I need to do is do a copybits and the pixmap will be recorded into 
>the PICT.  This doesn't seem to work however.
>
>Allen

The question is a tad vague.  I am assuming that you creating a PICT file.
If that is the case, make sure that you set the high bit of your rowBytes.
This tags the image as a pixmap as opposed to a bitmap.

Bob Munroe
topix@utcs.utoronto.ca

oster@well.sf.ca.us (David Phillip Oster) (11/24/90)

To get a pixmap into a PICT you just do a CopyBits between
OpenPicture() ClosePicture() calls. The secret is, the current port for
all this must be a color grafport. The easiest way to get a color grafport
is just add the appropriate resource to your program (assuming you
create your windows with GetNewWindow() or GetNewDialog()).
a sample 'wctb' resource looks like this:
resource 'wctb' (129) {
	0x0,
	0,
	{	/* array ColorSpec: 0 elements */
	}
};
or in RMaker
Type wctb=GNRL
	, 129
.H
00 00 00 00 00 00

use dctb for dialogs. Watch out for the following: GetNewWindow and
GetNewDialog do nothing with palettes, while GetNewCWindow grabs the
palette automatically. As always, do a ClipRect(&thePort->portRect);
before recording a picture, since the default clip will overflow to the
emptyRect on playback. And watch out got clipping in general when you use
this technique.
-- 
-- David Phillip Oster - At least the government doesn't make death worse.
-- oster@well.sf.ca.us = {backbone}!well!oster