Re: BitMap data format and autorelease
Re: BitMap data format and autorelease
- Subject: Re: BitMap data format and autorelease
- From: Trygve Inda <email@hidden>
- Date: Wed, 12 Mar 2008 21:22:51 +0000
- Thread-topic: BitMap data format and autorelease
Jens said:
> As I said, call -lockFocus on the imagerep. Then issue drawing
> commands (just as though you were in a view's -drawRect: method). Then
> calll -unlockFocus.
NSImageRep does not seem to allow lockFocus
With Adam's method... Is there any reason I might want an NSImage?
> [NSGraphicsContext saveGraphicsState];
> [NSGraphicsContext setCurrentContext:[NSGraphicsContext
> graphicsContextWithBitmapImageRep:imageRep]];
>
> // draw here
>
> [NSGraphicsContext restoreGraphicsState];
>
> which avoids creating an NSImage.
Also note that this is all happening in a background thread, though I
realize drawing may well need to be dispatched to the main thread.
This seems to suggest it is a good approach:
http://www.cocoabuilder.com/archive/message/cocoa/2007/11/15/193191
Thanks,
Trygve
_______________________________________________
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