c语言图形编程代码(C language programming code)
c语言图形编程代码(C language programming code)
I have written before the C language programming code graphics
I have written graphical programming code to achieve DOS under the 256BMP picture display, Chinese notes, Chinese characters display
Writing is not good, for everyone to exchange and learning, TC3.0 and TC2.0 compiled through, under the real DOS can run
VGA256.C file
/ *..............................................*/...
#include
#include
#define Maxx 800 / * here determines the resolution of 800*600, convenient screen drawing.
#define maxy 600
Unsigned, char, far, *video_buffer= (unsigned, char, far *) 0xA0000000L;
Char color=2;
Void, vga256 ()
{
Union REGS r;
R.x.bx=0x103; / * here modified to interrupt for your video card driver 800*600, my Intel 810 integrated graphics driver.
R.x.ax=0x4f02;
Int86 (0x10, &r, &r);
}
Void FY (int XX)
{/ * * / paging
Union REGS r;
R.x.ax=0x4f05;
R.x.bx=0;
R.x.dx=xx;
Int86 (0x10, &r, &r);
}
Void fast (int, x, int, y)
Write code {/ * * /
Static long i=0;
Int xx=0;
Static int t=0;
If (xI=y;
I*=maxx;
I+=x;
Xx=i> > 16;
I&=0xffff;
If (T, =xx) FY (XX);
* (video_buffer+i) =color;
T=xx;
}
}
Hz.C file
/ *..............................................*/...
#include
Char bit[8]={128,64,32,16,8,4,2,1};
Void openhz (char hz0, char Hz1, char *bitdata) {/ * * / Open Font
FILE *st;
Long fpos;
Fpos=32L* (((unsigned, char) hz0-161) *94+ ((unsigned, char) hz1-161);
If ((st=fopen ("hzk16", "RB")) ==NULL) / * hzk16 open font file, the file can be found in UCDOS.
{
Printf ("open, File, error, \n");
Exit (0);
}
Fseek (st, fpos, SEEK_SET);
FREAD (bitdata, 32,1, St);
Fclose (st);
}
Void writehz (char hz0, char Hz1, int x, int y) / * * / Chinese characters display
{
Register, int, I, j;
Unsigned vpos;
Char bitdata[32];
Openhz (hz0, Hz1, bitdata);
For (i=0; i<16; i++)
For (j=0; j<8; j++)
{
If (bitdata[2*i]&bit[j])
Fast (x+j, i+y);
If (bitdata[2*i+1]&bit[j])
Fast (x+8+j, i+y);
}
}
Int printfhz (char *str, int x, int y)