Re: Rasterizing an NSString to a bitmap
Re: Rasterizing an NSString to a bitmap
- Subject: Re: Rasterizing an NSString to a bitmap
- From: John Stiles <email@hidden>
- Date: Thu, 10 Jun 2004 08:47:05 -0700
On Jun 9, 2004, at 2:49 PM, Dietmar Planitzer wrote:
>
>
On Jun 9, 2004, at 11:25 PM, John Stiles wrote:
>
>
> Given an NSImage, I am not sure if there is any guarantee that it
>
> will have an NSCachedImageRep.
>
>
NSImage always creates an NSCachedImageRep when you call -lockFocus on
>
it. This is documented somewhere in the NSImage docs.
I couldn't find this. I could find a function called -recache which can
throw an exception that has the word cache in it. But none of this
guarantees the existence of a cache.
>
> I agree that given an NSCachedImageRep, it's not hard to pull the
>
> pixels out. But as you state yourself, it's an implementation detail
>
> and one that Apple is not required to maintain in future OS updates.
>
>
Well, Apple must maintain this implementation detail because otherwise
>
every graphics related Carbon app would instantly stop working. They
>
expect that they can access the pixels of a window / framebuffer by
>
accessing the PixMap of a GrafPort and locking that. In fact, Apple
>
even mentions this technique in its "porting Windows apps to MacOS X"
>
documentation.
You've gotten too tied up in implementation details.
Will windows always have backing stores? Almost certainly yes.
Will we developers be able to get access to that backing store? Sure,
many of us have already been down that road.
Will NSImages always be stored inside offscreen windows? I don't see
how that's a guarantee. I have yet to find any documentation
guaranteeing that an NSImage will have any particular representation,
or any example of code that gets pixels out of an NSImage without using
NSReadPixel or relying on undocumented hacks like fudging the current
NSGraphicsContext.
_______________________________________________
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.