Re: Rasterizing an NSString to a bitmap
Re: Rasterizing an NSString to a bitmap
- Subject: Re: Rasterizing an NSString to a bitmap
- From: Marcel Weiher <email@hidden>
- Date: Thu, 10 Jun 2004 20:42:59 +0100
[image lockFocus];
[myObject draw];
bitmap = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:myRect]
autorelease];
[image unlockFocus];
That's the canonical method of getting a bitmap of a rendered graphic
in Cocoa, as far as I am aware, and is independent of NSImage
implementation details. Another method is to get the
TIFFRepresentation, and then re-reading that, but that involves an
extra encoding/decoding step.
Nice, but the problem begin when you modify the NSBitmapImageRep by
accessing directly the pixels
and then try to make a new image from the modified pixels...
Ahh, that is to be expected. -initWithFocusedViewRect: does not give
you access to the backing store, instead it makes a copy. So this is
not for incremental drawing onto the backing store, it is for
retrieving the result when it is done.
Cheers,
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.