FROM : Adam R. Maxwell
DATE : Wed Mar 12 21:58:12 2008
On Wednesday, March 12, 2008, at 01:26PM, "Trygve Inda" <<email_removed>> 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
DATE : Wed Mar 12 21:58:12 2008
On Wednesday, March 12, 2008, at 01:26PM, "Trygve Inda" <<email_removed>> 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
| Related mails | Author | Date |
|---|---|---|
| Trygve Inda | Mar 12, 17:09 | |
| Jens Alfke | Mar 12, 17:23 | |
| Trygve Inda | Mar 12, 18:03 | |
| Trygve Inda | Mar 12, 18:11 | |
| Trygve Inda | Mar 12, 20:01 | |
| Jens Alfke | Mar 12, 20:57 | |
| Trygve Inda | Mar 12, 21:20 | |
| Adam R. Maxwell | Mar 12, 21:58 | |
| Jens Alfke | Mar 12, 23:19 | |
| Trygve Inda | Mar 14, 01:44 | |
| Jens Alfke | Mar 14, 02:01 | |
| Adam R. Maxwell | Mar 14, 02:03 |






Cocoa mail archive

