On Wednesday, March 12, 2008, at 01:26PM, "Trygve Inda" <[EMAIL PROTECTED]> 
wrote:
>> 
>Is there a benefit to calling:
>
>image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
>[image addRepresentation:imageRep];
>
>Then using:
>
>[image lockFocusOnRepresentation:imageRep];
>
>[image unlockFocus];
>
>This would give me an NSImage which uses my bitmap. Any pros/cons here?

I'd use something like this (typed in Mail):

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext 
graphicsContextWithBitmapImageRep:imageRep]];

// draw here

[NSGraphicsContext restoreGraphicsState];

which avoids creating an NSImage.

-- 
adam
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to