• 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: IKImageView Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IKImageView Question


  • Subject: Re: IKImageView Question
  • From: Brian Postow <email@hidden>
  • Date: Mon, 24 May 2010 17:53:32 -0400

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

  • Follow-Ups:
    • Re: IKImageView Question
      • From: Scott Anguish <email@hidden>
    • Re: IKImageView Question
      • From: Scott Anguish <email@hidden>
References: 
 >IKImageView Question (From: <email@hidden>)

  • Prev by Date: Re: NSDoc's Magic File Watcher Ruins Core Data Migration [SOLVED]
  • Next by Date: NSTextField and key event delegates
  • Previous by thread: IKImageView Question
  • Next by thread: Re: IKImageView Question
  • Index(es):
    • Date
    • Thread