[comp.sys.mac.programmer] How does one get the quickdraw global gray in an MDEF?

monching@cs.mcgill.ca (Patrick WONG) (01/08/91)

I am using Think Pascal.  Plus I'm writing a MDEF. If I wanted to set
the PenPat to gray. How would I get access to the quickdraw global gray?

Thanks,

pat

-- 
patrick wong                   | McGill University           
monching@quiche.cs.mcgill.ca   | School of Computer Science
                               | Montreal, Quebec            

arne@ikaros.uio.no (Arne B. Huseby) (01/10/91)

In article <1991Jan8.123124.12815@cs.mcgill.ca> monching@cs.mcgill.ca 
(Patrick WONG) writes:
> I am using Think Pascal.  Plus I'm writing a MDEF. If I wanted to set
> the PenPat to gray. How would I get access to the quickdraw global gray?
> 
> Thanks,
> 
> pat

The easiest trick to get around this problem entirely is simply to create 
a local version of the QD-global. This can be done as follows:

var
  MyGray : array[1..2] of longint;
....
MyGray[1]:=$55AA55AA;
MyGray[2]:=$55AA55AA;
...

To use this data in the program you must typecast it to type "pattern" 
e.g. like this:

PenPat(pattern(MyGray));

By changing the data other patterns may be used as well, of cource. If you 
don't want to figure it out yourself, the HEX code for a specific pattern 
can be found in 'PAT '-resources. Use ResEdit and "Open general".

 Enjoy, Arne!

-----------------------------------------
Arne B. Huseby                 
Department of Mathematics
University of Oslo
P.o. Box 1053 Blindern
N-0316 OSLO 3
NORWAY                            arne@ikaros.uio.no
-----------------------------------------

Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (01/18/91)

>I am using Think Pascal.  Plus I'm writing a MDEF. If I wanted to set
>the PenPat to gray. How would I get access to the quickdraw global gray?
>
BH> Either get to the QuickDraw globals by offsetting from A5 or 
BH> using GetIndPattern from the system pattern list... 

If you just want Grey, it's probably just as easy to create it on the fly with
StuffHex.
 
--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org