Re: Any way to draw a PixMapHandle into an NSView??
Re: Any way to draw a PixMapHandle into an NSView??
- Subject: Re: Any way to draw a PixMapHandle into an NSView??
- From: Jeff LaMarche <email@hidden>
- Date: Tue, 4 Jun 2002 22:59:24 -0700
On Tuesday, June 4, 2002, at 06:54 PM, Roger O'Brien wrote:
>
Hi there. Does anybody know by any chance if it is possible to draw a PixMapHandle
>
into an NSView? Thanks in advance...
>
_______________________________________________
Okay, you'll have to forgive me, it's been a while since I worked with Classic
/ Carbon, but if my memory serves, you should just be able to do something
like:
Assuming that 'pic' is a PixMapHandle;
NSImage *myImage = [[NSImage alloc] initWith
Data:[NSData dataWithBytes:
*pic length:GetHandleSize((Handle)pic)]];
You could then use any of a number of mechanisms for getting this image into
your view, either subclassing NSView or by simply using an NSImageView.
I don't remember the relationship between PixMapHandles and PicHandles. I
seem to recall that Pictures are a partially opaque data structure and that
PixMapHandles were simply the pixel data contained in a PicHandle. Since NSImage
'knows' the PICT format, I think initWithData would work with either a PicHandle
or a PixMapHandle. I know it works with a PicHandle because the code above
is actual working code (well, it got edited a tiny bit) from one of my programs,
but pic is a PicHandle, not a PixMapHandle in my program.
Hope this helps.
- Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.