Re: IKImageView Question
Re: IKImageView Question
- Subject: Re: IKImageView Question
- From: Scott Anguish <email@hidden>
- Date: Wed, 26 May 2010 00:29:05 -0400
Another solution for conversion is using -CGImage on NSBitmapImageRep.
On May 24, 2010, at 5:53 PM, Brian Postow wrote:
>
> On May 24, 2010, at 5:36 PM, <email@hidden> <email@hidden> wrote:
>
>> I've been trying a few tests with IKImageView to view an EPS file with zooming capabilities. Some code that Apple provides works well... however I'm getting a warning -> "warning: 'IKImageView' may not respond to '-setImage:'". Instead of using the NSURL (which doesn't seem to work with EPS images in my tests), I'm using NSImage. The IKImageView documentation states:
>>
>> -------------------
>> You can provide an images for the view in any of these formats:
>>
>> File reference (NSURL, CFURLRef, or a path)
>> CGImageSourceRef
>> Data (NSData or CFDataRef)
>> Image (NSImage, CGImageRef, or CIImage)
>> -------------------
>>
>> Just curious why I'm getting this warning since I'm using a NSImage? My next thought was to convert the NSImage to a CGImageRef, but that looks pretty in-depth. I thought if I converted it, maybe I could use:
>>
>
> Yeah, If you look further down in the documentation, you'll see that there IS no setImage: NSImage. I've been through this with Apple. Officially, this is a bug IN THE DOCUMENTATION. Any setImage: NSImage method that exists is undocumented and may be taken away.
>
> I use this:
>
> CGImageRef nsImageToCGImage(NSImage* image)
> {
> NSData * imgData = [image TIFFRepresentation];
> CGImageRef imgRef = 0;
> if(imgData)
> {
> CGImageSourceRef imageSource =
> CGImageSourceCreateWithData((CFDataRef)imgData, NULL);
>
> imgRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
> }
>
> return imgRef;
> }
>
>
>
> Brian Postow
> Senior Software Engineer
> Acordex Imaging Systems
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden