CS-460/560
Spring, 1998
R. Eckert
BITMAPPED CHARACTERS--AN ILLUSTRATION
The following illustrates how a 'T' could be displayed using the bitmapped technique:
1. Define the bitmap for the letter. The following is one possibility for a 'T'-
int t[7][7] = { {0,0,0,0,0,0,0}, {0,1,1,1,1,1,0}, {0,0,0,1,0,0,0},
{0,0,0,1,0,0,0}, {0,0,0,1,0,0,0}, {0,0,0,1,0,0,0},
{0,0,0,0,0,0,0}}; /* bitmap for the letter T */
[In general, we could have a file that contains similar bitmap descriptions
of each character in the character set that is to be displayed.]
2. Define the function that will display the bitmap letter[][] at pixel
coordinates (x,y)--
disp_letter (int x, int y, int letter[7][7])
{
int i,j;
for (i=0; i<7; i++)
for (j=0; j<7; j++)
if (letter[i][j] == 1)
setpixel(x+j,y+i,3); /* plot the letter from its bitmap */
}
[Here we are assuming that we have a pixel-setting function, setpixel(x,y)]
3. Call the function, passing it the desired letter's bitmap--
disp_letter (50,100,t); /* draw a 'T' at (50,100) */
In a Win32 application, the disp_letter() function would be called from the WndProc().