Mailing Lists: Apple Mailing Lists

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

Re: Window Backgrounds (again)



David;

Thanks. I think this is the push I need to get into using Quartz instead of Quickdraw.

Unfortunately, swapping in this code gets me back to the state I was at previously, of the various views being drawn with the new background color, but the background of the window outside of those views staying in the previous color. This might be a case of not properly invalidating the entire window area so that it will be redrawn. I will try adding a liberal supply of InvalidateRect calls in the code to see.

By the way, when something forces the window to be redrawn completely, it does draw the entire window with the right color. Just not when I change the backcolor and ask that the screen be redrawn. That code, again using Quickdraw, looks like:
void
TBase::SetBackColor( void )
{
CGrafPtr svPort;
CGrafPtr gPort;

GetPort(&svPort); // save the current port
gPort = GetWindowPort(this->objWindow); // use the window's port
SetPort(gPort);
SetWindowContentColor (objWindow, &this->backColor);
RGBBackColor( &this->backColor );
InvalidateWindow();
SetPort(svPort); // restore the original port
}

Any other suggestions?

On Jul 29, 2004, at 11:35 AM, David McLeod wrote:

QuickDraw and compositing aren't great friends.

Draw your background with CG instead:
{
HIRect bounds;
CGContextRef context;
HIViewGetBounds( ref, &bounds ); // get the rectangle bounds
GetEventParameter( inEvent, kEventParamCGContextRef, typeCGContextRef,
NULL, sizeof( context ), NULL, &context );
CGContextSetRGBFillColor( context, 1, 0, 0, 1 ); // draw the non-privilege area in red
CGContextFillRect( context, bounds );
}



-Jack Brindle, WA4FIB
=======================================================================
MacDobs - helping to shift the paradigm for low-cost amateur astronomy.
_______________________________________________
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.


References: 
 >Window Backgrounds (again) (From: Jack Brindle <email@hidden>)
 >Re: Window Backgrounds (again) (From: David McLeod <email@hidden>)



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.