Introduction to C language lattice model Programming
Author: Zhang guiquan
I love you !" . In the win-TC programming environment, I used the Chinese character dot matrix generation tool to directly generate a 64-dot matrix array of bytes, and then performed operations on it. The code is simple. The original code is as follows:
# Include <conio. h>
# Include <graphics. h>
# Define closegr closegraph
/* Initialize the runtime environment and register the driver to implement the independent running of the Program (separated from the relationship with win-TC */
Void initgr (void ){
Int GD = detect, GM = 0;
Registerbgidriver (egavga_driver );
Initgraph (& GD, & GM ,"");
}
/* Method for drawing */
Void drawmat (char * mat, int matsize, int X, int y, int color ){
Int I, j, k, n;
N = (matsize-1)/8 + 1;
For (j = 0; j <matsize; j ++)
For (I = 0; I <n; I ++)
For (k = 0; k <8; k ++)
If (MAT [J * n + I] & (0x80> K ))
Putpixel (x + I * 8 + k, Y + J, color );
}
Char wo64h [] = {
/* The following is the 64-dot-matrix 文 cloud font of 'my', 512 bytes */
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0x03, 0xc0, 0 x, 0x00,
0x00,0x00,0x01, 0xff, 0x1f, 0xf8, 0x00,0x00,
0 x, 0x00, 0x3f, 0x00, 0xf8, 0 x, 0 x, 0x00,
0x00, 0xff, 0xe0, 0 x, 0x70, 0 x, 0x80, 0x00,
0 x, 0 x, 0 x, 0x60, 0x07, 0xf0, 0x00,
0 x, 0 x, 0 x, 0x20, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0x20, 0x10, 0 x, 0x00,
0x0c, 0 x, 0 x, 0 x, 0x20, 0x20, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 X,
0 x, 0 x, 0 x, 0 x, 0 x, 0x60, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0x60, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x80,
0 x, 0 x, 0 x, 0 x, 0x40, 0x20, 0x00, 0xc0,
0 x, 0 x, 0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x, 0 x, 0x00, 0x1f, 0xc0,
0 x, 0 x, 0 x, 0 x, 0x40, 0 x, 0x30, 0x70,
0 x, 0 x, 0 x, 0 x, 0x80, 0 x, 0x60, 0x18,
0x0c, 0x00,0x00, 0x1f, 0x00,0x00,0x40, 0x0c,
0x07,0x00,0x00, 0x1e, 0x00,0x00,0x00,0x04,
0x03, 0xfe, 0x00, 0x1c, 0x00,0x00,0x00,0x04,
0x03, 0xfc, 0 x, 0x10, 0 x, 0 x, 0 X,
0x80, 0 x, 0x20, 0 x, 0 x, 0 x, 0x04,
0 x, 0 x, 0x40, 0 x, 0 x, 0 x, 0x04,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x04,
0x0, 0 x, 0 x, 0 x, 80, 0 x, 0 x, 0 x, 0 x, 0 x, 08,
0x0, 0 x, 0 x, 0 x, 80, 0 x, 0 x, 0 x, 0 x, 0 x, 08,
0 x, 0 x, 0x80, 0 x, 0x20, 0 x, 0x08,
0 x, 0 x, 0x80, 0 x, 0x70, 0 x, 0x10,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x10,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x20,
0 x, 0 x, 0x60, 0 x, 0 x, 0 x, 0x20,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x40,
0x01,0x80, 0x01, 0x8f, 0xe0, 0x01,0x80, 0x80,
0x00, 0xff, 0xff, 0x03,0x00,0x00, 0xff, 0x00,
0x00, 0x1f, 0xf8, 0x00,0x00,0x00,0x00,0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
};
Char ai64h [] = {
/* The following is the 64-dot-matrix 文 cloud font of 'love', 512 bytes */
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0x00, 0xf0, 0x00,
0x00,0x00,0x00,0x00,0x01, 0xff, 0xfe, 0x00,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, 0 x, 0x10,
0 x, 0x07, 0xe0, 0x01, 0xf8, 0 x, 0x30,
0x07, 0xff, 0xfc, 0x00,0x00, 0x0f, 0xff, 0xe0,
0x00, 0x7e, 0x00,0x00,0x00,0x00, 0x3f, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
};
Char ni64h [] = {
/* The following is the 64-dot-matrix 文 cloud font of 'you', 512 bytes */
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x00, 0x1c, 0 x, 0x80, 0 x, 0 x, 0x00,
0x00,0x00, 0xff, 0x87, 0xf8, 0x00,0x00,0x00,
0x00,0x01,0x00, 0x7c, 0x1e, 0x00,0x00,0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0x30, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0x80, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0x80, 0 x, 0x00,
0 x, 0 x, 0 x, 0x60, 0x01, 0xff, 0xff, 0x80,
0 x, 0 x, 0 x, 0 x, 0x01, 0xff, 0xff, 0xf0,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x18,
0 x, 0 x, 0 x, 0x80, 0 x, 0 x, 0x00, 0x0c,
0 x, 0 x, 0 x, 0x80, 0 x, 0 x, 0 x, 0x04,
0 x, 0 x, 0 x, 0x80, 0 x, 0 x, 0 x, 0x04,
0 x, 0x20, 0 x, 0 x, 0 x, 0 x, 0x06,
0 x, 0x20, 0 x, 0 x, 0 x, 0 x, 0x06,
0 x, 0x20, 0 x, 0 x, 0 x, 0 x, 0x06,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x04,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x04,
0 x, 0x80, 0x0c, 0 x, 0 x, 0 x, 0 x, 0x04,
0 x, 0 x, 0 x, 0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 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0x00, 0x0f, 0xf0, 0x00,0x00,0x00,0x00,0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x01, 0xc0, 0 x, 0 x, 0 x, 0 x, 0x00,
0x00, 0x0f, 0xf8, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x18, 0x0c, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x20, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x60, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0x00, 0xc0, 0 x, 0x80, 0 x, 0 x, 0 x, 0x00,
0x00, 0xc0, 0 x, 0x80, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x60, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x20, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x18, 0x0c, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x07, 0xf0, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0x01, 0xc0, 0 x, 0 x, 0 x, 0 x, 0x00,
};
Int main (void ){
Int I, J;
Initgr ();
Drawmat (wo64h, 64,200,100, red );
Drawmat (ai64h, 64,250,150, yellow );
Drawmat (ni64h, 64,300,200, Cyan );
Drawmat (plaint64h, 64,350,250, green );
Getch ();
Closegr ();
Return 0;
}
It's easy. Try it by yourself.