?? moveimg.c
字號:
/*-----------------------------------------------------------
函數 _MoveImage : 在顯示存儲器中移動屏幕映象塊。
-----------------------------------------------------------*/
#include <hanenv.h>
void _Cdecl _MoveImage(col1,line1,width,high,col2,line2)
int col1; /* 屏幕圖象塊左上角列坐標(以字節為單位) */
int line1; /* 屏幕圖象塊左上角行坐標(以象素為單位) */
int width; /* 屏幕圖象塊寬度(以字節為單位) */
int high; /* 屏幕圖象塊高度(以象素為單位) */
int col2; /* 屏幕圖象塊新位置列坐標(以字節為單位) */
int line2; /* 屏幕圖象塊新位置行坐標(以象素為單位) */
{
register int i,j;
unsigned char tmpreg;
unsigned char far *sour;
unsigned char far *dest;
/*-- 設置顯示寄存器操作標志 -----------*/
_VideoBusy = YES;
/*-- 確定源屏幕塊和目標屏幕塊的首地址 -*/
sour = MK_FP(0xa000,(line1+_ScreenTop)*_ScreenWidth+col1);
dest = MK_FP(0xa000,(line2+_ScreenTop)*_ScreenWidth+col2);
/*-- 修改方式寄存器內容為寫方式1 ------*/
outportb(0x3ce,0x05);
tmpreg = inportb(0x3cf);
tmpreg |= 0x01;
outportb(0x3cf,tmpreg);
/*-- 如果源塊在目標塊之后,正向拷貝 ----*/
if(sour >= dest)
{
for(i=0;i<high;i++)
{
for(j=0;j<width;j++)
*(dest+j)=*(sour+j);
dest += _ScreenWidth;
sour += _ScreenWidth;
}
}
/*-- 如果源塊在目標塊之前,反向拷貝 ----*/
else
{
sour += (high-1)*_ScreenWidth+width-1;
dest += (high-1)*_ScreenWidth+width-1;
for(i=high-1;i>=0;i--)
{
for(j=0;j<width;j++)
*(dest-j)=*(sour-j);
dest -= _ScreenWidth;
sour -= _ScreenWidth;
}
}
/*-- 恢復方式寄存器內容為寫方式0 ------*/
tmpreg &= 0xfc;
outportb(0x3ce,0x05);
outportb(0x3cf,tmpreg);
_VideoBusy = NO;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -