• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert PICT to NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Convert PICT to NSImage
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: How to find the manual (or at least the header)
  • Next by Date: Re: How do I create a NSArray of NSString constants?
  • Previous by thread: Re: Convert PICT to NSImage
  • Next by thread: Re: Convert PICT to NSImage
  • Index(es):
    • Date
    • Thread