Switching off antialiasing...
Switching off antialiasing...
- Subject: Switching off antialiasing...
- From: Stefan Jung <email@hidden>
- Date: Thu, 19 Jul 2001 10:30:48 +0200
...is very easy for the on screen display. But what is the trick to
do this with an image?
I tried a lot with lockig focus and so on...no chance. The TIFF I
want to save is always antialiased, regardless it is set or not.
My code:
-(void)saveAsTIFF:sender
{
NSImage *specImage;
NSSavePanel *sp;
int result;
NSGraphicsContext *graphicsContext;
specImage = [[NSImage alloc] initWithSize:[self bounds].size];
[specImage lockFocus];
graphicsContext = [NSGraphicsContext currentContext];
[graphicsContext setShouldAntialias:NO];
[specImage initWith
Data:[self dataWithPDFInsideRect:[self bounds]]];
[specImage unlockFocus];
sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"TIFF"];
result = [sp runModalForDirectory:NSHomeDirectory() file:[[self
window] title]];
if (result == NSOKButton) {
if (![[specImage TIFFRepresentation] writeToFile:[sp
filename] atomically:YES])
NSBeep();
}
}
Again, the view on screen is aliased, the saved TIFF is
antialiased. Any idea to circumvent this?
Stefan Jung