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: Mon, 7 Jun 2004 22:25:03 +0100
On 7 Jun 2004, at 19:26, John Stiles wrote:
I need to draw an NSString into a block of my own memory so I can do
effects on it. I just want one grayscale channel. I thought this would
be easy but I am stumped! :|
Here's what I've tried to do.
1:
...
- Make an NSBitmapImageRep with the parameters I want (grayscale 1byte
per pixel)
...
2:
...
- Make another NSBitmapImageRep with the parameters I want (1 byte per
pixel, grayscale)
...
That's the problem right there. You can't make an NSImage draw into a
NSBitmapImageRep you provide. You can only get an NSBitmapImageRep out
of an NSImage, using the almost but not entirely appropriately named
-initWithFocusedViewRect: method.
That will give you an NSBitmapImageRep with the parameters *it* wants
;-)
If you need other parameters, the only way to get this is add some
image-processing. (You might be tempted to think that a CoreGraphics
bitmap context is the answer, but last time I checked most of the
parameter combinations are unsupported).
Cheers,
Marcel
_______________________________________________
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.