setImageInterpolation:NSImageInterpolationNone ignored when dataWithPDFInsideRect: called
setImageInterpolation:NSImageInterpolationNone ignored when dataWithPDFInsideRect: called
- Subject: setImageInterpolation:NSImageInterpolationNone ignored when dataWithPDFInsideRect: called
- From: Rick Hoge <email@hidden>
- Date: Sun, 1 Jan 2006 21:41:43 -0500
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 setImageInterpolation:NSImageInterpolationNone];
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden