On 9/14/04 9:16 AM, Kevin Meaney wrote:
> I have had to modify CBeginContext::Begin() to get my quartz drawing to
> work correctly.
>
> At the beginning of the method I have modified at as below:
>
> #if 0
> if (fPort && !QDIsPortBuffered(fPort))
> #else
> if (fPort)
> #endif
>
> I have a window that returns it is buffered but the quartz drawing
> doesn't work unless the check for is not buffered is removed.
For doing Quartz drawing in a window, I think you generally should use CreateCGContextForPort.
> I have had a search on developer.apple.com for documentation related to
> buffered windows and CGContextRef's without anything to suggest that we
> should only do QDBeginCGContext for non buffered windows or printing/
> offscreen gworlds etc.
See the comments for QDBeginContext() in <QuickDraw.h>. It was added as a hack specifically to allow Quartz drawing such as DrawThemeTextBox to work during QuickDraw printing. CBeginContext_AC checks for a non-buffered port because that really is the only time it is needed.
> Is this a problem with MacApp.
I think CBeginContext_AC should not be changed, because the change would cause it to make a new context every time MacApp draws text in a window, and that could affect performance. It really is meant only for printing and similar tasks such as creating pictures and drawing to offscreens. It is not for general use.
It would be nice if MacApp had more support for Quartz drawing. Ideally, there would be a CGContextRef in TWindow, and a TView method to get the current CGContextRef. My recommendation, since you are doing a lot of Quartz drawing, is to implement a TQuartzWindow so you can have a CGContextRef associated with the port. That way you won't have to create a new CGContextRef every time you need to draw.
You may still need to use CBeginContext_AC but only for printing.
HTH,
Tom
--
Tom Becker "Within C++, there is a much smaller and
Object-Oriented Propeller Head cleaner language struggling to get out."
<email@hidden> -- Bjarne Stroustrup
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macapp-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden