Re: Business as usual: Flipped context causing grief
Re: Business as usual: Flipped context causing grief
- Subject: Re: Business as usual: Flipped context causing grief
- From: Aki Inoue <email@hidden>
- Date: Mon, 12 Dec 2011 17:19:41 -0800
Graham,
+[NSGraphicsContext graphicsContextWithBitmapImageRep:] is a cover method of a more general, +[NSGraphicsContext graphicsContextWithGraphicsPort:flipped:].
You can create a CGBitmapContextRef out of the bitmap rep & pass to the latter method.
Aki
On 2011/12/12, at 17:07, Graham Cox wrote:
>
> On 13/12/2011, at 12:00 PM, Keary Suska wrote:
>
>> IIRC, NSLayoutManager expects that the view it is drawing in is flipped
>
> It expects the CONTEXT it is drawing into is flipped, and in order to do that it asks the CONTEXT the value of -isFlipped.
>
> If the context is associated with a view, the view is queried.
>
> I don't have a view, I have a context. I create the context from a bitmap rep (I'm rendering text, and other things, into an offscreen image). When you do that, it assumes that the context/bitmap is not flipped, and -isFlipped returns NO. There is no way I can see to return YES from isFlipped, or pass setFlipped:YES to the context, or set the flippedness to YES when the context is created.
>
> That is the problem I have.
>
>> (-isFlipped returns YES). If it isn't, it will draw text inverted. Soooo.. I think all you need is to implement isFlipped returning YES.
>
>
> I suppose I could do this by subclassing NSGraphicsContext, but that seems a surprising requirement given the task I'm trying to perform. Surely correctly rendering text into a bitmap rep is something that the design of the graphics system has anticipated?
>
> --Graham
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden