c语言高级代码编程图,c语言图形编程代码(C language programming code).doc

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< stdio.h>

#include< bios.h>

#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 (x< Maxx) {

I=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< stdio.h>

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值