Re: Convert PICT to NSImage
Re: Convert PICT to NSImage
- Subject: Re: Convert PICT to NSImage
- From: Ian was here <email@hidden>
- Date: Mon, 27 Jun 2005 13:51:38 -0700 (PDT)
Thank you gentlemen for your help. I got the PICT
data!! Yahooo!! The following code gets the PICT data:
NSData *theData = [NSData dataWithBytes:*Pict
length:GetHandleSize( (Handle)Pict )];
HLock( (Handle)Pict );
NSPICTImageRep *pictImage = [NSPICTImageRep
imageRepWithData:theData];
HUnlock( (Handle)Pict );
One final issue...how to get this image into an
NSTextView? I'm trying the following code:
NSFileWrapper *fileWrapper = [[[NSFileWrapper alloc]
initWithSerializedRepresentation:theData]
autorelease];
NSTextAttachment *textAttachment = [[[NSTextAttachment
alloc] initWithFileWrapper:fileWrapper] autorelease];
[[textView textStorage]
appendAttributedString:[NSAttributedString
attributedStringWithAttachment:textAttachment]];
Unfortunately, this doesn't work. I could save the
image to disk, then load it again into the NSTextView,
but that seems like a waste of time. Ideally, it would
be best to just insert the PICT directly into the
NSTextView.
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden