Re: BitMap data format and autorelease
Re: BitMap data format and autorelease
- Subject: Re: BitMap data format and autorelease
- From: "Adam R. Maxwell" <email@hidden>
- Date: Wed, 12 Mar 2008 13:58:12 -0700
On Wednesday, March 12, 2008, at 01:26PM, "Trygve Inda" <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden