/* Sample line-drawing program to demonstrate Wu antialiasing. Also draws * non-antialiased lines for comparison. * Tested with Borland C++ in C compilation mode and the small model. */ #include #include void SetPalette(struct WuColor *); extern void DrawWuLine(int, int, int, int, int, int, unsigned int); extern void DrawLine(int, int, int, int, int); extern void SetMode(void); extern int ScreenWidthInPixels; /* screen dimension globals */ extern int ScreenHeightInPixels; #define NUM_WU_COLORS 2 /* # of colors we'll do antialiased drawing with */ struct WuColor { /* describes one color used for antialiasing */ int BaseColor; /* # of start of palette intensity block in DAC */ int NumLevels; /* # of intensity levels */ int IntensityBits; /* IntensityBits == log2 NumLevels */ int MaxRed; /* red component of color at full intensity */ int MaxGreen; /* green component of color at full intensity */ int MaxBlue; /* blue component of color at full intensity */ }; enum {WU_BLUE=0, WU_WHITE=1}; /* drawing colors */ struct WuColor WuColors[NUM_WU_COLORS] = /* blue and white */ {{192, 32, 5, 0, 0, 0x3F}, {224, 32, 5, 0x3F, 0x3F, 0x3F}}; void main() { int CurrentColor, i; union REGS regset; /* Draw Wu-antialiased lines in all directions */ SetMode(); SetPalette(WuColors); for (i=5; i