www.pudn.com > cwin.rar > BAR.C
/*-----------------------------------------------------------
函数 _Bar : 在屏幕上指定位置显示一个矩形块
-----------------------------------------------------------*/
#pragma inline
#include
/*---------- 内部函数 ror : 对字节进行循环移位 ------------*/
static char _Cdecl ror(byte,n)
char byte; /* 要进行循环移位的字节 */
int n; /* 循环移位的位数 */
{
asm mov cx,n;
asm mov al,byte;
asm rol al,cl;
asm mov byte,al;
return byte;
}
/*------ 函数 _Bar : 在屏幕上指定位置显示一个矩形块 -------*/
void _Cdecl _Bar(x,y,w,h,color,pattern)
int x,y; /* 矩形块左上角坐标,均以象素为单位 */
int w,h; /* 矩形块宽和高,均以象素为单位 */
int color; /* 矩形块颜色 */
unsigned long pattern; /* 填充模式 */
{
register unsigned i;
unsigned char hp1 = pattern>>24;
unsigned char hp2 = ror(hp1,(int)(pattern & 0xff));
unsigned char vp = (pattern >> 16) & 0xff;
unsigned char cp = (pattern >> 8 ) & 0xff;
for(i=0;i> i % 8))
{
if(cp & (0x80 >> i%8))
_H_Line(x,y+i,w,color,hp2);
else
_H_Line(x,y+i,w,color,hp1);
}
}