[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: QuickDraw II programming problem
In article <C14B3I.4C3@CAM.ORG> vandry@CAM.ORG (Phillip Vandry) writes:
>I'm trying to get something to display dimmed the way it's done in the menus
>with a disables item. When I realised my SetPenMask wasn't working, I made a
>very simple construct that was bound to work.
>
>This simple construct is a SetPenMask -IMMEDIATELY- followed by a DrawString.
>And the string doesn't end up dimmed. The SetPenMask points to 8 bytes of
>repeating 010101010101010101010...... and the string displays as if the mask
>was 1111111111..... The foreground pattern is black and the background is
>white. The font is Shaston 8, plain and everything else is "normal"
Aha! The pen pattern and pen mask affect how everything *except* text gets
drawn. Rectangles, ovals, round rectangles, lines, whatever.
For text, the colors come from SetForeColor and SetBackColor (not from the
pen pattern), and there is no mask for drawing text.
So you have to draw the text and then fill a white rectangle over it, with
a checkerboard pattern.
Here is how the system does it (dimmed menu item, dimmed list item, etc):
DrawString
SetPenMask to $55 $AA $55 $AA $55 $AA $55 $AA
EraseRect (with a rect big enough to cover the text)
SetPenMask back to a solid pattern (eight $FFs)
You can restore the pen mask with GetPenMask/SetPenMask, or Get/SetPenState,
or PenNormal if that makes sense in your context (that is, if you're drawing
in a port that you own, not something like the Menu Manager port), then you
can use PenNormal).
Generally the patterned rectangle gets drawn quickly enough that you don't
notice the non-dimmed text while it's drawing.
--
David A. Lyons, Apple Computer, Inc. | DAL Systems
Apple II System Software Engineer | P.O. Box 875
Internet:dlyons@apple.com | Cupertino, CA 95015-0875
My opinions are my own, not Apple's.