Re: NSCustomImageRep and NSImage setSize
Re: NSCustomImageRep and NSImage setSize
- Subject: Re: NSCustomImageRep and NSImage setSize
- From: Graham Cox <email@hidden>
- Date: Fri, 08 Nov 2013 11:21:07 +0100
On 30 Oct 2013, at 5:14 am, Mathew Eis <email@hidden> wrote:
> I am trying to get an NSCustomImageRep to properly “react” (e.g. redraw) after a NSImage setSize call.
My understanding is that the size property of an image is not directly related to the sizes of the reps within it. Initially, the reps that the image generates itself (for caching, say) are based on the image size, scaled according to the desired resolution of the cache, which is 1x for standard screens, 2x for retina screens. Otherwise the ratio between a rep’s size and the image size defines the resolution of the image, and therefore how it is to be drawn, but there’s no reason that this size change would affect any reps within the image other than the private ones that NSImage maintains for caching.
I assume that NSImage has its own way of identifying which reps are part of its private cache, but any reps that you add using -addRepresentation: are NOT part of its private cache. AFAICS, there’s no way to force NSImage to use an externally added rep as an internal cache. I don’t really see why you’d want to do that anyway, or why you need to redraw your rep if the NSImage size changes - especially if it’s resolution independent. When the NSImage is drawn, its size tells you how to scale your rep to suit, but it doesn’t affect the content of your rep at all.
—Graham
_______________________________________________
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