256色汉字显示程序,第1张

256色汉字显示程序,第2张

/*
cc256.c-256彩色汉字显示程序
*/
# include " dos . h "
# include " stdio . h "
# include " conio . h "
void open lib(void);
void CC256(int,int,int,char * Str);
void ErrMsg();
void init SCR();
void rst SCR();
void PutPoint(int x,int y,int Color);
void Quit();
int main(void)
{
char * str = "感谢您使用本书";
open lib();
init SCR();
CC256(70,80,2,Str);
getch();
Quit();
返回0;
}
void InitScr()
{
union REGS In;
in . x . ax = 0x 13;/*进入13H模式*/
int86(0x10,&In,& In);
}
void rst SCR()
{
union REGS In;
in . x . ax = 0x 03;/*退出13H模式*/
int86(0x10,&In,& In);
}
void Open lib(void)/* Open 24点Microsoft yahe font */
{
if((FP = fopen(" C:\ \ UCDOS \ \ CLI b24 s "," Rb ")。
}
void CC256(int x,int y,int Wid,char * Str)
{
unsigned Zcode,Bcode/*区号,位码*/
int i,j,k,Rec,Color
长Len
char Buf[72];
while (*Str) /* until字符串显示*/
{
if((* Str & 0x 80)&(*(Str+1)& 0x 80))/*是汉字*/
{[ /*区号*/
bcode =(*(Str+1)-0xa 1)& 0x07f;/*位码*/
Rec = Zcode * 94+Bcode;/*记录号*/
Len = Rec * 72L;/* position */
fseek(fp,Len,SEEK_SET)在字体中;
fread (Buf,1,72,FP);/* 72字节*/
for(I = 0;i < 24i++)
for(j = 0;j < 3;j++)
for(k = 0;k < 8;k++)
if(Buf[I * 3+j]> >(7-k)& 1)
{
Color = y+j * 8+k-46;
PutPoint(x+i,y+j*8+k,Color);
}
x = x+24+Wid;
Str+= 2;
}
}
return;
}
/*直接写视频缓冲*/
void put point (int x,int y,int color)/* dot function */
{
char far * p;
p =(char far *)(0x0a 0000000 l);
*(x+y * 320+p)= Color;
}
void Quit()
{
rst SCR();
fcloseall();
}
void ErrMsg()
{
printf("打开库文件错误!");
getch();
Quit();
}

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 256色汉字显示程序

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情