Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quick-draw PicHandle question



On 9/19/02 9:05 PM, email@hidden didst favor us with:

> But , have any method can convert "GWorld" to "PicHandle"

PicHandle GWorld2PICT( const GWorldPtr inGWorldPtr )
{
PicHandle tPicHandle = nil;

if (inGWorldPtr != nil)
{
PixMapHandle tPixMapHdl;

CGrafPtr origPort;
GDHandle origDev;

GetGWorld( &origPort, &origDev ); // save current graphics port
SetGWorld( inGWorldPtr, nil ); // make this the current port

ForeColor( blackColor ); // this is so copybits
BackColor( whiteColor ); // won't remap the colors

// get handle to offscreen pixel image

tPixMapHdl = GetGWorldPixMap(inGWorldPtr );

if ( LockPixels( tPixMapHdl ) ) //
and lock it
{
ClipRect( &(*tPixMapHdl)->bounds ); // Set the clip rect

tPicHandle = OpenPicture( &(*tPixMapHdl)->bounds );

if ( tPicHandle != nil )
{
// next, use CopyBits to copy the pixmap to itself
CopyBits( (BitMap*) *tPixMapHdl, // coerce to a BitMap
(BitMap*) *tPixMapHdl, // same as source
&(*tPixMapHdl)->bounds, // use PixMap bounds
&(*tPixMapHdl)->bounds, // same as source
srcCopy,nil);
ClosePicture();
}

UnlockPixels( tPixMapHdl ); // unlock the pixel image
}

SetGWorld( origPort, origDev ); // restore previous graphics port
}

return tPicHandle;
}
_______________________________________________
quicktime-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/quicktime-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: quick-draw PicHandle question (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.