Re: Rasterizing an NSString to a bitmap
Re: Rasterizing an NSString to a bitmap
- Subject: Re: Rasterizing an NSString to a bitmap
- From: p3consulting <email@hidden>
- Date: Fri, 11 Jun 2004 09:17:38 +0200
>
Finallly it also may be an idea to ask your NSImage object for the
>
NSBitmapImageRep it's using, even if you've given it one yourself, and
>
then ask that for the bitmap data.
>
>
That's where the problem starts: NSImage use a NSCachedImageRep when
you lockFocus on it not a NSBitmapImageRep (NSImageCacheNever doesn't
change anything: it looks like just an advice not a requirement) AND
NSCachedImageRep is NOT a subclass of NSBitmapImageRep but a subclass
of NSImageRep, so you don't have access to all the accessors you have
in NSBitmapImageRep (bytesPerRow, bitsPerPixel, bytesPerPlane,
isPlanar, bitmapData, etc...).
So we can get the bytes with initWithFocusedViewRect but we loose
control on the format of the bitmap (we will get 32 bits RGBA and we
have to convert afterwards)...
For the specific problem of getting a gray scale image, converting from
RGBA to gray scale is trivial and very fast with Altivec, you may event
convert in place, it will take more memory but it will be easier to
compose with others images in a further step...
Pascal Pochet
email@hidden
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.