C语言图形编程代码(国外英文资料)
C语言图形编程代码(国外英文资料)
The C language graphics programming code that you wrote before
The graphical programming code that you wrote before has been shown in DOS under 256BMP images, in Chinese, in Chinese characters
It's not good to write, and I'll give you the communication and learning, TC3.0 and TC2.0, which will be run under real DOS
VGA256. C file
/ *... * /
# include< Stdio. H>
# include< The BIOS. H>
800 / * # define maxx here determines the resolution of 800 * 800, convenient drawing * /
# define maxy. 600
Unsigned char far * video_buffer = (unsigned char far *) 0xA0000000L
Char color = 2;
Void vga256 ()
{
The union REGS, r;
R.X.B x103 x = 0; / * this is modified to fit your graphics card drive 800 * 600, which is the Intel 810 integrated graphics drive * /
R.X.A x4f02 x = 0;
Int86 (0x10, & r);
}
Void fy (int xx)
{/ * paging * /
The union REGS, r;
R.X.A x4f05 x = 0;
R.X.B x = 0;
R.X.D x = xx;
Int86 (0x10, & r);
}
Void fast (int x, int y)
{/ * write code * /
The static long I = 0;
Int xx = 0;
Static int t = 0;
If (x< maxx) {
I = y;
I * = maxx;
I + = x;
Xx = i> & gt; 16.
I & = 0 XFFFF;
If (t! = xx).
(video_buffer + I) = color;
T = xx;
}
}
Hz. C file
/ *... * /
# include< Stdio. H>
Char bit [8] = {128,64,32,16,8, 4, 2, 1}
Void openhz (char hz0, char hz1, char * bitdata) {/ *
The FILE * st.
Long fpos;
Fpos = 32L * ((unsigned char) hz0-161).
If ((st = fopen (" hzk16 ", "rb")) = = NULL) / * open hzk16 library file, the file can be found in UCDOS * /
{
Printf (" open File error! \ n ");
The exit (0);
}
Fseek (st, fpos, SEEK_SET);
Fread (bitdata, 32, 1, st);
The fclose (st);
}
Void writehz (char hz0, char hz1, int x, int y) / * display Chinese character * /
{
The register int I, j;
Unsigned vpos;
Char bitdata [32].
Openhz (hz0 hz1, bitdata);
For (I = 0;)
For (j = 0)
{如果(bitdata 2 *我一点[j])
快(x + j,我+ y);
如果(bitdata[2 * i + 1]位[j])
快(x + 8 + j,我+ y);
}
}
int printfhz(char * str,int x,int y)/ *显示汉字串* /
{
int num,xx;
num = strlen(str);
xx = x;
(我= 0;i
{
writehz(s