Re: Rasterizing an NSString to a bitmap
Re: Rasterizing an NSString to a bitmap
- Subject: Re: Rasterizing an NSString to a bitmap
- From: Steve Sims <email@hidden>
- Date: Thu, 10 Jun 2004 16:33:30 -0400
Hi John,
Now I've fallen slightly behind reading this list in the last few days,
but I read with interest all of the ensuing messages that came along.
Well, I say read, but skimmed is more truthful.
Your approach of creating an NSImage, adding a bitmap image rep,
locking focus, and drawing the string seems to me to be the right thing
to do. Grabbing the tiff representation also seems like a sensible
thing to try. There's just a couple of suggestions that I have that
might be worth pondering.
Firstly given that your problem is that the image rep doesn't contain
your data then as has been said it seems to indicate some kind of
caching problem. Have you tried using setCacheMode:NSImageCacheNever
on your NSImage object before doing the focus lock? My thinking here
is that NSImage may well be caching the raw display PDF text drawing
commands and never committing the image to the bitmap.
I'm assuming that you also spotted NSBitmapImageRep's bitmapData to
grab a pointer to the bitmap data.
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.
Steve
p.s. standard disclaimers apply, and also whilst I have used NSImage
myself in the past I was mostly concerned with the compositing stuff,
not getting access to raw bitmap data.
On 7 Jun 2004, at 14: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.
<snip>
_______________________________________________
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.