• 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 15:12:36 -0700 (PDT)

This is definitely a leap in the right direction.
Thank you! Here's my code thus far:



HLock( (Handle)tempPict );

NSData		*theData = [NSData dataWithBytes:*tempPict
length:GetHandleSize( (Handle)tempPict )];

HUnlock( (Handle)tempPict );


NSPICTImageRep	*pictImage = [NSPICTImageRep
imageRepWithData:theData];


NSFileWrapper		*fileWrapper = [[[NSFileWrapper alloc]
initRegularFileWithContents:theData] autorelease];

NSTextAttachment	*textAttachment = [[[NSTextAttachment
alloc] initWithFileWrapper:fileWrapper] autorelease];

[[textView textStorage]
appendAttributedString:[NSAttributedString
attributedStringWithAttachment:textAttachment]];



Still doesn't work though. It would seem that
"theData" is raw PICT data, so it needs to get
transformed by NSPICTImageRep (which it does). The
issue then, is that the correct data needs to be
pulled from the NSPICTImageRep. This is where I'm
stuck, and spinning my wheels. I need to pass an
NSData object containing the correct image data into
fileWrapper object.




--- Douglas Davidson <email@hidden> wrote:

>
> On Jun 27, 2005, at 1:51 PM, Ian was here wrote:
>
> > NSFileWrapper        *fileWrapper =
> [[[NSFileWrapper alloc]
> > initWithSerializedRepresentation:theData]
> > autorelease];
> >
> >
>
> You should be using initRegularFileWithContents:
> here.  The
> "serialized representation" is a special serialized
> representation of
> an arbitrary file wrapper, potentially including an
> entire directory
> structure.  What you have is the contents of a
> single file.
>
> Douglas Davidson
>
>




____________________________________________________
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>
References: 
 >Re: Convert PICT to NSImage (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Multiple singletons
  • Next by Date: Re: Convert PICT to NSImage
  • Previous by thread: Re: Convert PICT to NSImage
  • Next by thread: Re: Convert PICT to NSImage
  • Index(es):
    • Date
    • Thread