Mailing Lists: Apple Mailing Lists

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

quartz replacement for EraseRect???



Hi,

In my Panther application I display a bitmap (.PNG) in a UserPane.
Depending on the settings in my app I show different bitmaps. The bitmaps
have a transparent background but the bitmaps themselves differ in size
(just the picture part, not the rectangle).

When switching to Tiger I got warnings from the compiler that QuickDraw
functions I used are deprecated.
I struggled through some documentation and made some changes. This is the
result:
Rect rect;
GetControlBounds(pane,&rect);
CGRect cgrect;
cgrect = ConvertRectToCGRect(rect, port);
// clear previous image
//EraseRect(&rect); // old
result = QDBeginCGContext(port, &context);
CGContextClearRect(context, cgrect); // new
// draw the image
CGContextDrawImage(context,cgrect,image);
// flush the gfx --> update
CGContextFlush(context);
// end CG drawing
result = QDEndCGContext(port, &context);

When I run this the picturepart show up nicely however the background is
pitch black!
In the QuickDraw solution I used EraseRect to clear the background (now
commented out) and I replaced it with it's Quartz counter part
CGContextClearRect. With the described result. How can I get back my
window's normal background instead of just black?

Regards,

Hans Loonen

PS in the documentation of EraseRect it says: "Using the patCopy pattern
....". Is there a Quartz equivalent for that?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to 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.