Friday, April 15, 2011

The Proper Care and Feeding of NSImage

Paul Kim:

You could try turning off image interpolation in the destination graphics context but this isn’t always possible or desirable. The better solution is just like before: use a custom image rep to do the drawing (select “Drawn (custom image rep)” from the pop-up). Since the drawing occurs at drawing time, instead of image creation time, it knows about the context it is drawing into and therefore can provide your drawing code with a context at the correct resolution. The crisp square on the right speaks for itself.

Fortunately, blocks make it easy to use custom image reps rather than -lockFocus.

Comments RSS · Twitter

Leave a Comment