⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hz.c

📁 BC3.1编译,小交换机计费系统.使用Dos做出如此好的界面,少有.
💻 C
📖 第 1 页 / 共 2 页
字号:
	   *       DATE      : 20/09/94                                *
	   *************************************************************/

/* ============================= char_16 ================================ */
void char_16(UC asc_code, UI pox, UI poy, UC color)
{
UI pox0,poy0;
UC loop, loop0;
UC inner_pos;
UC dot_byte[2];
UC str_dot[16],str_dot0[16];

	memcpy(str_dot0, Rom_char_lib+(asc_code<<4), 16);

	set_dot_mode(color);

	for ( loop0=0; loop0 < 4; loop0++)
	{
	  if ( hz_str_type == 2)
		   str_enlarge ( str_dot, str_dot0, loop0);
	  else
		   memcpy ( str_dot, str_dot0, 16);

	  pox0 = pox + (loop0/2)* 8;
	  poy0 = poy + (loop0%2)*16;
	  inner_pos = pox0 - ( (pox0 >> 3) << 3);
	  for (loop=0; loop<16; loop++)
	  {
		  dot_byte[0] = str_dot[loop] >> inner_pos;
		  dot_byte[1] = str_dot[loop] << (8-inner_pos);

		  if  (win_prn_flag)
		  {
               if  ((pox0-left*8) >= winleft &&
					(pox0-left*8) <= (WIN_RIGHT-8))
				   pixels(pox0-left*8, poy0+loop, dot_byte, 2);
			   else break;
		  }
		  else
			  pixels(pox0, poy0+loop, dot_byte, 2);

	  }
	  if ( hz_str_type == 1)
		   break;
	}
	reset_dot_mode();
}

/* ============================= hz16_disp =============================== */
void hz16_disp(UI x, UI y, UC *hz_str, UC color)
{
UC han1, han2, i;

	i = 0;
	while ( (han1=hz_str[i]) != 0)
	{
		if ( han1<0xa0 )
		{
			char_16(han1, x, y+1, color);
			x += 8;
			i++;
		}
		else
		{
			han2 = hz_str[++i];
			if (han2<160)
				return;
			hz_16((han1-160), (han2-160), x, y, color);
			x += 16;
			i++;
		}
	}
}

/* ============================= hz16_fill =============================== */
void hz16_fill(UI x, UI y, UC *hz_str, UC fill_len, UC color)
{
UC han1, han2, i;

	i = 0;
	while ( i<fill_len && (han1=hz_str[i])!=0)
	{
		if ( han1<160 )
		{
			char_16(han1, x, y+1, color);
			x += 8;
			i++;
		}
		else
		{
			if (i>=fill_len)
				return;
			han2 = hz_str[++i];
			if (han2<160)
				return;
			hz_16((han1-160), (han2-160), x, y, color);
			x += 16;
			i++;
		}
	}
}


/* ============================= topic_disp ============================== */
void topic_disp(UI x, UI y, UC *hz_str, UC hz_color, UC char_color)
{
UC han1,han2,i;

	i=0;
	while ( (han1=hz_str[i]) != 0)
	{
		if (han1<160)
		{
			char_16(han1, x, y+1, char_color);
			x += 8;
			i++;
		}
		else
		{
			han2=hz_str[++i];
			if (han2<160) return;
			hz_16((han1-160),(han2-160),x,y,hz_color);
			x += 16;
			i++;
		}
	}
}

	  /***************************************************************
	   *       disp_str dislay a hz or str on the definited position.*
	   *       void disp_str(UI x,UI y,UC *hz_str,UC bk_color...)    *
	   *       CALLS     : hz_16(...),char_16(...)                   *
	   *       CALLED BY :                                           *
	   *       AUTHOR    :                                           *
	   *       DATE      :                                           *
	   *       MODIFY    : LI CHENG                                  *
	   *       DATE      : 20/09/94                                  *
	   ***************************************************************/
/* ============================== disp_str ============================== */
void disp_str(UI x, UI y, UC *hz_str, UC bk_color, UC char_color)
{
UC han1,han2;
int i;
struct fillsettingstype old_setting;

	i = strlen(hz_str);
	if (i==0 || i>=181) return;
	if (win_prn_flag && i<=left) return;
	getfillsettings(&old_setting);
	setfillstyle(SOLID_FILL, bk_color);
	if ( win_prn_flag)
	   bar(x,y,x+(min(i,right)-left)*8-1,y+15);
	else
	   bar(x, y, x+(i<<3)-1, y+15);

	i=0;
	hz_str_type = 1;
	while ( (han1=hz_str[i]) != 0 )
	{
		if ( han1 < 0x80 )
		{
			 if (win_prn_flag && i<(left-1) )
				 ;
			 else
				char_16(han1, x, y+1, char_color);
			 x += 8*hz_str_type;
			 hz_str_type = 1;
		}

		else if ( han1==0x80 )
				  hz_str_type = 2;
		else
		{
			 han2 = hz_str[++i];

			 if ( hz_str_type==2)
				  if ( han2==0x80 )
					   han2 = hz_str[++i];
				  else return;

			 if ( han2 < 0xa0 )
//				  return;
				  continue;
			 if (win_prn_flag && i<(left-3) )
				 ;
			 else
				 hz_16((han1-160),(han2-160),x,y,char_color);
			 x += 16*hz_str_type;
			 hz_str_type = 1;
		}
		if (win_prn_flag && i>right)
			break;
		i++;
	}
	setfillstyle(old_setting.pattern,old_setting.color);
}

/* ============================= disp_20dot ============================== */
void disp_20d(UI x, UI y, UC *hz_str, UC bk_color, UC char_color)
{
UC han1,han2;
UI i;
struct fillsettingstype old_setting;

	i = strlen(hz_str);
	if (i==0 || i>=80) return;

	getfillsettings(&old_setting);
	setfillstyle(SOLID_FILL,bk_color);
	bar(x-1, y-2, x+(i<<3), y+17);

	i=0;
	while ( (han1=hz_str[i]) != 0)
	{
		if (han1<160)
		{
			char_16(han1, x, y+1, char_color);
			x += 8;
			i++;
		}
		else
		{
			han2=hz_str[++i];
			if (han2<160) return;
			hz_16((han1-160), (han2-160), x, y, char_color);
			x += 16;
			i++;
		}
	}
	setfillstyle(old_setting.pattern,old_setting.color);
}

/* ========================== support view port ========================== */
/* ------------------------------- hz1_16 -------------------------------- */
void hz1_16(UC qh,UC wz,UI pox,UI poy,UC color)
{
UC i,k;
UC dot_byte;
UC hz_dot[32];
static UC bit_map[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};

	if (qh==0||wz==0) return;
	if (qh>87||wz>94) return;
	if ( qh>9 ) qh -= 6;

	EMB_read(hz_dot, EMB_HZ_handle, (--qh)*94*32L+(--wz)*32L, 32);

	for (i=0;i<32;i++)
	{
		dot_byte = hz_dot[i];
		for (k=0;k<8;k++)
		{
			if ((dot_byte & bit_map[k]) != 0)
				putpixel(pox,poy,color);
			pox++;
		}
		if ( i&0x01 )
		{
			poy++;
			pox -= 16;
		}
	}
}

/* ============================= char_16 ================================ */
void char1_16(UC asc_code, UI pox, UI poy, UC color)
{
UC i,k,dot_byte;
UC far *dot_here;
static UC bit_map[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};

	if (asc_code>127) return;
	dot_here = Rom_char_lib+(asc_code<<4);
	for (i=0;i<16;i++)
	{
		dot_byte = *(dot_here++);
		for (k=0;k<8;k++)
		{
			if ((dot_byte & bit_map[k]) != 0)
				putpixel(pox,poy,color);
			pox++;
		}
		poy++;
		pox-=8;
	}
}

/* ============================= hz16_disp =============================== */
void hz16_disp1(UI x,UI y,UC hz_str[80],UC color)
{
UC han1,han2,i;

	i=0;
	while ( (han1=hz_str[i]) != 0)
	{
		if (han1<160)
		{
			char1_16(han1, x, y+1, color);
			x += 8;
			i++;
		}
		else
		{
			han2=hz_str[++i];
			if (han2<160) return;
			hz1_16((han1-160),(han2-160),x,y,color);
			x += 16;
			i++;
		}
	}
}

	   /*************************************************************
	   *       char_16 dsplay report and output printer             *
	   *       UC char_16(UC asc_code, UI pox, UI poy,UC color)     *
	   *       CALLS      : none                                    *
	   *       CALLED BY  :                                         *
	   *       AUTHOR     :                                         *
	   *       DATE       :                                         *
	   *       MODIFY     : LI CHENG                                *
	   *       DATE       : 11/10/94				    			*
	   *	   DESCRIPTION: what is str? its index least than 0xb0  *
	   *************************************************************/
/* ============================= topic_disp ============================== */
void topic_disp1(UI x,UI y,UC hz_str[80],UC hz_color,UC char_color)
{
UC han1,han2,i;

	i=0;
	while ( (han1=hz_str[i]) != 0)
	{
		if (han1<160)
		{
			char1_16(han1, x, y+1, char_color);
			x += 8;
			i++;
		}
		else
		{
			han2=hz_str[++i];
			if (han2<160) return;
			if (han1<0xb0)
				hz1_16((han1-160),(han2-160),x,y,char_color);
			else
				hz1_16((han1-160),(han2-160),x,y,hz_color);
			x += 16;
			i++;
		}
	}
}
/* ============================== disp_str ============================== */
void disp_str1(UI x,UI y,UC hz_str[80],UC bk_color,UC char_color)
{
UC han1,han2;
UI i;
struct fillsettingstype old_setting;

	i=0;
	while(i<80 && hz_str[i]!=0) i++;
	if (i==0 || i==80) return;

	getfillsettings(&old_setting);
	setfillstyle(SOLID_FILL,bk_color);
	bar(x,y,x+(i<<3)-1,y+15);

	i=0;
	while ( (han1=hz_str[i]) != 0)
	{
		if (han1<160)
		{
			char1_16(han1, x, y+1, char_color);
			x += 8;
			i++;
		}
		else
		{
			han2=hz_str[++i];
			if (han2<160) return;
			hz1_16((han1-160),(han2-160),x,y,char_color);
			x += 16;
			i++;
		}
	}
	setfillstyle(old_setting.pattern,old_setting.color);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -