请输入您要查询的百科知识:

 

词条 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\",i);

exit(1);

}

gfxblk2 = (RasterBlock *)malloc(i);

if (!gfxblk2) {

restext();

printf("ERROR: Allocating memory for gfxblk2: %d

bytes\",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);

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/1/27 20:19:50