Re: Replace -lockFocus with Block-Based Drawing Method (was NSCustomImageRep…)
Re: Replace -lockFocus with Block-Based Drawing Method (was NSCustomImageRep…)
- Subject: Re: Replace -lockFocus with Block-Based Drawing Method (was NSCustomImageRep…)
- From: Ken Thomases <email@hidden>
- Date: Wed, 17 Dec 2014 07:59:56 -0600
On Dec 17, 2014, at 6:52 AM, Jerry Krinock <email@hidden> wrote:
> I think I did what the "High Resolution Guidelines for OS X” document suggested for drawing offscreen vector images. See code snip below.
>
> The result looks the same to me. It’s OK with the old code, and OK with the new code.
>
> To help me understand what I’m doing, I would appreciate if someone please elaborate on this quote from the documeent:
>
> “If your app uses -lockFocus: … either you’ll get a low resolution NSImage object that looks incorrect when drawn, or you’ll get a 2x image that has more pixels in its bitmap than you are expecting”
>
> • Are these “either” the only two possible results, or is there a third possibility, that it will work properly?
>
> • Regarding "a low resolution NSImage object that looks incorrect when drawn”, does that mean that it looks grossly incorrect, like, say, the image is scaled down and squashed into one quadrant, or does it just mean that it will look fuzzy on a Retina display?
>
> • What does "a 2x image that has more pixels in its bitmap” mean? I thought that a 2x image is expected to have more pixels in its bitmap.
All of this is about living in an environment where your app's windows can be displayed on a high-resolution (a.k.a. high-DPI or Retina) screen and/or move back and forth between such a screen and a standard-resolution screen.
When you draw a single time using -lockFocus, your image can only be appropriate for one or the other. So, it will either be drawn at standard resolution, in which case it will look fuzzy or blocky on a high-resolution screen; or it will be drawn at high resolution, in which case it will waste RAM/VRAM and rendering work if it's only going to be displayed on a standard-resolution screen. It might also be very slightly less sharp than it would otherwise have been. It will be down-sampled to display on the standard-resolution screen, which usually works pretty well (especially at a 2:1 ratio) but does have some effect.
The image will not be grossly incorrect.
Regards,
Ken
_______________________________________________
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