Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TXNDrawXXXTextBox and CGBitmapContext problems...



I'm using TXNDrawCFCstringTextBox to do nice static text drawing using CGContexts (specified using kTXNUseCGContextRefMask in the options parm) and this works well if the CGContext comes from a window. Xavier, when helping me with a problem I had been having earlier, suggested that he thought that if I was using a CGContext then I'd have to pass in CGCoordinates but it turned out that this was not the case - specifying the CGContext but using QD coordinates for the input rect works.

Now, the problem I've run into is that sometime I use a CGContext created with CGBitmapContextCreate and it seems that, somewhere under the hood, TXNDrawCFCstringTextBox is grabbing the current port to use to translate the QD coordinates I pass in into CGCoordinates. As you might imagine, if the current port does not have the same bounds as my CGBitmapContext, then the text appears in the wrong position in y. Is this a known bug, or is there a workaround I'm not aware of?

As an example, if I'm trying to draw text into a 100 pixel tall CGBitmap at a QuickDraw y of, say 50 but the active window in my app is 125 pixels tall, then the text gets drawn into the bitmap at (125 - 50) = 75 CG which, back in my bitmap, is equal to 25 QD y. This all stems from the fact that TXNDrawCFCstringTextBox wants a QD rect regardless if I'm using a CGContext and always tries to convert to CG coordinates using the height of the current port. Or at least that is what it seems like is happening to me.

Any ideas? Should I file this as a bug?

Thanks,
-Matt
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.