In the code below, the TIFF gets saved correctly (transparent but for the red square), but when I query the pixel at (40,40) which should be in the middle of the red square, I get a black pixel (r==g==b==a==0.0):
        offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
                        pixelsWide:canvasSizeH
                        pixelsHigh:canvasSizeV
                        bitsPerSample:8
                        samplesPerPixel:4
                        hasAlpha:YES
                        isPlanar:NO
                        colorSpaceName:NSCalibratedRGBColorSpace
                        bitmapFormat:0
                        bytesPerRow:0
                        bitsPerPixel:0];
        [NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]];
        [[NSGraphicsContext currentContext] setShouldAntialias:NO];
        [[NSColor colorWithCalibratedRed:0.5 green:0 blue:0 alpha:1.0] set];
        [NSBezierPath fillRect:NSMakeRect(10, 10, 100, 100)];
        NSData* TiffData = [offscreenRep TIFFRepresentation];
        [TiffData writeToFile:@"/Users/dave/Desktop/temp.tiff" atomically:YES];
        NSColor *pixelColor = [offscreenRep colorAtX:40 y:40];
        float r,g,b,a;
        [pixelColor getRed:&r green:&g blue:&b alpha:&a];

Thanks,
Dave    
============================
Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf
============================



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to