blkresize

DOS SVGACC圖形開發庫函式
原型: extern void far blkresize (unsigned newxsize, unsigned newysize, RasterBlock far *sourcegfxblk, RasterBlock far *destgfxblk)
輸入: newxsize, newysize - destgfxblk中的結果
sourcegfxblk - 指向源點陣圖的rasterBlock型指針
輸出: 無返回值
destgfxblk - 點陣圖大小
用法: BLKRESIZE提取sourcegfxblk中的點陣圖並按照newxsize和newysize將其放大或縮小。結果點陣圖被存放在destgfxblk中,destgfxblk應根據blkget函式的返回值事先聲明。newxsize、newysize都不可為0。
另查 BLKGET, blkput, BLKROTATE
例子
/*
* Show blkresize
*/
#include <stdlib.h>
#include <math.h>
#include <conio.h>
#include "svgacc.h"
#define randnum(size) (rand() % (int)(size))
void main(void)
{
int vmode, i, j, colr, x1, y1, x2, y2;
RasterBlock *gfxblk1, *gfxblk2;
vmode = videomodeget();
if ( !whichvga() || (whichmem() < 512))
Exit(1);
if ( !res640() )
exit(1);
i=20000;
gfxblk1 = (RasterBlock *)malloc(i);
if (!gfxblk1) {
restext();
printf("ERROR: Allocating memory for gfxblk1: %d
bytes\n",i);
exit(1);
}
gfxblk2 = (RasterBlock *)malloc(i);
if (!gfxblk2) {
restext();
printf("ERROR: Allocating memory for gfxblk2: %d
bytes\n",i);
exit(1);
}
for(i=0;i<=25;i++) {
x1 = randnum(50);
y1 = randnum(50);
x2 = randnum(50);
y2 = randnum(50);
colr = randnum(16);
DRWLINE(1,colr,x1,y1,x2,y2);
}
x1 = 0;
y1 = 0;
x2 = 50;
y2 = 50;
DRWBOX(1,15,x1,y1,x2,y2);
blkget(x1,y1,x2,y2,gfxblk1);
x1 = MAXX / 2;
y1 = maxy / 2;
blkresize(50,50,gfxblk1,gfxblk2);
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
for(i=x2;i<=x2+50;i++) {
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
blkresize(i,i,gfxblk1,gfxblk2);
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
sdelay(3);
}
for(i=x2+50;i>=x2-50;i--) {
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
blkresize(i,i,gfxblk1,gfxblk2);
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
sdelay(3);
}
for(i=x2-50;i<=x2+1;i++) {
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
blkresize(i,i,gfxblk1,gfxblk2);
blkput(2,x1-(gfxblk2->width)/2,y1-(gfxblk2-
>height)/2,gfxblk2);
sdelay(3);
}
getch();
videomodeset(vmode);
exit(0);
}

相關詞條

相關搜尋

熱門詞條

聯絡我們