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 10:38:35 -0700 (PDT)
I'm getting PICT data from an apple event. There is an
application called Equation Editor that allows for
creating math equations and formulas. When quitting,
Equation Editor converts the equations into a single
PICT file and sends it as an apple event. My
application gets this PICT data. I confirmed that I'm
getting data, and this works fine with an OS 9 version
of my application. So I know I'm getting a PICT file.
The following code seems to work OK:
[NSData dataWithBytes:Pict length:GetHandleSize(
(Handle)Pict )]
It's the NSPICTImageRep imageRepWithData: that is
failing.
Also, dragging an equation onto my text view from
Equation Editor works fine.
--- String Larson <email@hidden> wrote:
> How are you obtaining 'Pict' ?
> Are you sure that a) there is data and b) the data
> conforms to PICT
> file format ?
>
> You could try
> NSImage *img = [[NSImage alloc]
> initWithContentsOfFIle:@"file"];
> NSArray *reps = [img representations];
>
> to see if there is an NSPICTImageRep being generated
> ?
>
>
>
> On Jun 27, 2005, at 11:34 AM, Ian was here wrote:
>
> > I'm trying to convert a PICT into an NSImage and
> am
> > having no luck at it. The following code fails.
> Has
> > anyone been successful at this? Thanks.
> >
> >
> >
> > HLock( (Handle)Pict );
> >
> > NSPICTImageRep *pictImage = [NSPICTImageRep
> > imageRepWithData:[NSData dataWithBytes:Pict
> > length:GetHandleSize( (Handle)Pict )]];
> >
> > if ( pictImage == nil )
> > {
> > NSLog(@"failed");
> > }
> >
> > HUnlock( (Handle)Pict );
> >
> >
> > [newImage lockFocus];
> > [pictImage drawAtPoint:NSZeroPoint];
> > [newImage unlockFocus];
> >
> >
> >
> >
> >
> ____________________________________________________
> > 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