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.

Jerry

…
NSImage* image ;
if ([NSImage 
respondsToSelector:@selector(imageWithSize:flipped:drawingHandler:)]) {
    // OS X 10.8 or later
    image = [NSImage imageWithSize:size
                           flipped:NO
                    drawingHandler:^(NSRect dstRect) {
                        [self drawStyle:style
                                 length:length
                                  color:color] ;
                        return YES ;
                    }] ;
}
else {
    image = [[NSImage alloc] initWithSize:size] ;
    [image lockFocus] ;
    [self drawStyle:style
             length:length
              color:color] ;
    [image unlockFocus] ;
}


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to