On May 31, 2010, at 5:40 PM, Robert Lorentz wrote:

> CGContextRef context = CGBitmapContextCreate(rawData, width, height, 
> bitsPerComponent, bytesPerRow, colorSpace, kCGBitmapFloatComponents);
> 
> CGColorSpaceRelease(colorSpace);
> 
> // draw the CIImage to the 'context'... this is probably the line that's wrong
> [image drawInRect:NSMakeRect(0, 0, width, height) fromRect:[self bounds] 
> operation:NSCompositeSourceIn fraction 1.0];

You created a context, but you never told AppKit to draw into it, so it’s just 
drawing into whatever the current context is at that moment.

You’ll need to do something like this:
        NSGraphicsContext *nsContext = [NSGraphicsContext 
graphicsContextWithGraphicsPort: context flipped: NO];
        NSGraphicsContext saveGraphicsState];
        [NSGraphicsContext setCurrentContext: nsContext];
        [image drawInRect: ……..];
        [NSGraphicsContext restoreGraphicsState];

I’ve never actually tried doing this, so I’m not certain the above code will 
work, but it looks as though it should.

—Jens_______________________________________________

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