• 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
NSImage representation resolution problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage representation resolution problems


  • Subject: NSImage representation resolution problems
  • From: Nick Forge <email@hidden>
  • Date: Tue, 8 Jan 2008 23:27:08 +1100

I have an app where I am implementing cropping and some basic editing of some images in a custom NSView subclass.

Each image is stored in an NSImage, and it goes through the following process:

- The image is initialised using [[NSImage alloc] initWithContentsOfFile:filePath].

- The image is drawn onto the NSView subclass by using drawInRect:fromRect:operation:fraction in the drawRect: method of the NSView.

This all works fine, except that if my NSView is small when the image is first drawn, it is "stuck" at that size, and if the window (and the thus the NSView) is enlarged, the NSImage is re-drawn by interpolating the first rendering of the image in my NSView, not the original image data itself.

I have noticed that if I debug this process, the NSImage's size ivar says that the image is (0,0) in size, until I draw it. Then it remains at (107,200) or whatever the initial rendering is, forever.

Ideally, I'd like the NSImage to cache an interpolation of the image every time the NSView is resized, so that the entire image doesn't have to be re-calculated every time something on top of it changes. This isn't crucial, but that'd be the ideal behaviour.

Any ideas how to get the NSView to render the image from the original full-res version, and not the initially rendered version?


Thanks in advance, Nick Forge _______________________________________________

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


  • Prev by Date: Re: read stderr with AuthorizationExecuteWithPrivileges
  • Next by Date: Re: Core Data Migration Exception
  • Previous by thread: Re: Core Image generate histogram?
  • Next by thread: Re: NSImage representation resolution problems
  • Index(es):
    • Date
    • Thread