事前乗算されたアルファがよくわかりません。
アルファ チャネルのない NSBitmapImageRep が必要です (特定の bpp は必要ありません)。
私の問題は、このコードでエラーが発生することです。
NSSize imageSize = NSMakeSize(200, 200);
//create a non-alpha RGB image rep with the same dimensions as the image
NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:imageSize.width
pixelsHigh:imageSize.height
bitsPerSample:8
samplesPerPixel:3
hasAlpha:NO
isPlanar:NO
bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
bytesPerRow:(3 * imageSize.width)
bitsPerPixel:24];
//lock focus on the bitmap
NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:context];
//draw the image into the bitmap
[prueba drawAtPoint:NSMakePoint(0, 0) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:24], NSFontAttributeName, nil]];
[NSGraphicsContext restoreGraphicsState];
//get the TIFF data
NSData* tiffData = [bitmap TIFFRepresentation];
//do something with TIFF data
NSError *error = nil;
[tiffData writeToFile:@"/Users/Paul/test.tif" options:NSDataWritingAtomic error:&error];
エラー: CGBitmapContextCreate: サポートされていないパラメーターの組み合わせ: 8 整数ビット/コンポーネント; 24 ビット/ピクセル。3 成分色空間。kCGImageAlphaNone; 640 バイト/行。
この組み合わせがサポートされていないことはわかっていますが、このようなものが必要であり、解決策が見つかりません。