Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setImageInterpolation:NSImageInterpolationNone ignored when dataWithPDFInsideRect: called




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.