I have an NSImageView subclass that draws a bitmap image and then
uses an NSBezierCurve to make a crosshair over the image. It is a
quantitative application and I don't want interpolation to be
performed on the bitmap data - I want the pixels in the actual data
to be displayed regardless of zooming (typically this will look
blocky but it's what the app requires). I got this no problem by
adding the following lines in my -drawRect: method:
NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
[currentContext ];
All works as expected and I get the non-interpolated pixels displayed
on my screen. The problem arises when I try to do a copy/paste. The
copied image is definitely interpolated (which is not what I want).
It seems like the above directive is ignored.
I am using something like this in my copy method:
NSData *pdf = [self dataWithPDFInsideRect:[self bounds]];
[pboard setData:pdf forType:NSPDFPboardType];
It seems like when dataWithPDFInsideRect: is called the drawRect
method is called one time with currentContext =
NSPSAndPDFGraphicsContext instead of the usual
NSWindowGraphicsContext used when drawing to the screen. For some
reason setting image interpolation to NSImageInterpolationNone does
not work in this case.
The last posts I saw on related problems were in 2003 and no
solutions were offered. If anyone has suggestions on how to get PDF
data for such a view without interpolation I'd be extremely grateful.
Rick
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (Cocoa-dev (AT) lists (DOT) apple.com)
Help/Unsubscribe/Update your Subscription:
%40developershed.com
This email sent to bsdarchive (AT) developershed (DOT) com