// Gray Scale Palette Example
// Since this is example code, it contains none of the standard error checks and
// user interface expected of a real program. It is only intended as a starting
// point.
// This code draws a grayscale bullseye using the palette manager. It will work
// with 4 or 8 bit screens. Although it modifies the gDevice's color table, it
// will restore it before exiting. This code will *not* work unless you have
// Assumes inclusion of
#include <Palettes.h>
void draw (void);
void init (void);
void checkWorld (void);
void die (char *s);
#define ScreenDepth(gdh) ((*((*gdh)->gdPMap))-> pixelSize)
#define MaxColors(gdh) (1<
GDHandle gMyGDevice;
main()
{
checkWorld();
init();
windRect = thePort->portBits.bounds;
SetPort(mainWindow); [TOKEN:12079] set window to current graf port SetGrayPalette(mainWindow);
draw();
;
}
void draw()
{
short i, colors = MaxColors(gMyGDevice);
SetRect(&tempRect, colors, colors, colors, colors); for (i = 0; i < colors - 2; i++) {
}
}
void init()
{
}
#define EXACT 0 // used with pmTolerant, r
// only exact matches
#define GRAY_RAMP 32 // 32bit quickdraw has a built-in gray dh
// ramp, located
// at (32 + )
void SetGrayPalette(WindowPtr w)
{
EXACT);
}
#define QD32Trap 0xAB03
# define UnImplTrap 0xA89F
void checkWorld()
{
if (!world.hasColorQD)
die("no color qd");
die("no 32bit qd");
}
void die(char *s)
{
CtoPstr(s);
ExitToShell();
}