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 16:32:18 -0700 (PDT)
OK, this link looks interesting, thank you. BTW,
appending 512 bytes at the head of the PICT file
didn't do the trick.
--- String Larson <email@hidden> wrote:
>
>
http://www.cocoabuilder.com/archive/message/2005/1/14/125754
>
>
> Might also need:
>
> NSTextView setImportsGraphics:true don't recall for
> sure tho.
>
>
>
> On Jun 27, 2005, at 5:45 PM, Ian was here wrote:
>
> > OK, added/modified the following lines of code (In
> > their respective order, of course):
> >
> >
> > NSMutableData *pictData = [[[NSMutableData
> alloc]
> > initWithLength:(long)512] autorelease];
> >
> > [pictData appendData:theData];
> >
> >
> > NSFileWrapper *fileWrapper =
> [[[NSFileWrapper alloc]
> > initRegularFileWithContents:pictData]
> autorelease];
> >
> > [fileWrapper setPreferredFilename:@".pict"];
> >
> >
> >
> > Setting a prefered name has cleared up a minor
> issue
> > where it was throwing an exception. Still doesn't
> show
> > an image in the text view, though. Most likely the
> > pictData is still not in the correct format.
> Hmm...
> >
> >
> >
> >
> > --- Douglas Davidson <email@hidden> wrote:
> >
> >
> >>
> >> On Jun 27, 2005, at 3:17 PM, Douglas Davidson
> wrote:
> >>
> >>
> >>>> 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.
> >>>>
> >>>>
> >>>>
> >>>
> >>> One thing to keep in mind is that there are two
> >>>
> >> PICT formats, an in-
> >>
> >>> memory format and an on-disk format. The
> on-disk
> >>>
> >> format has 512
> >>
> >>> bytes of 0 (if I remember correctly) prepended
> to
> >>>
> >> it. The data for
> >>
> >>> NSFileWrapper presumably would use the on-disk
> >>>
> >> format.
> >>
> >>>
> >>>
> >>
> >> You will probably also want to set a
> >> preferredFilename for the file
> >> wrapper, to make sure that the extension is
> .pict.
> >>
> >> 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
> >
>
>
____________________________________________________
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