=========================================================================== BBS: The Abacus * HST/DS * Potterville MI Date: 03-09-93 (23:05) Number: 49 From: STEVE COX Refer#: NONE To: MATTHEW HILDEBRAND Recvd: NO Subj: SCALE IMAGE Conf: (36) C Language --------------------------------------------------------------------------- Here is a function the I am working on that will take an image previously saved with a 256 color get_image function and display it on the screen at the specified coordinants and at the specified scale .... What happens is that the image will start scaling down for a few decrements of the scale factor then it will completely screw the image up .... later to only draw it real small a few scale decrements down the line. I think I need to due some rounding when I devide the scale factor into the depth and width ..... It is pretty impresive for the few frames it scales though !!!!!! Any suggestions ?????? Steve Cox /*-----------------------------------------------------------------------*/ scale_image(int x1,int y1,int scale,char far *ImgPtr) { int i,t,width,depth,xinc,yinc,xoff=x1,yoff=y1,PixelColor; width = *(unsigned *)ImgPtr; depth = *((unsigned *)ImgPtr+1); ImgPtr+= 4; depth-=scale; width-=scale; yinc=0; for(i=0;i < depth;i++) { xinc=0; if(yinc++ >= depth/scale-1) { yinc=0;ImgPtr+=width+scale; } for(t=0;t < width;t++) { PixelColor=*ImgPtr; if(xinc++ >= width/scale-1 ) { xinc=0;ImgPtr++; } ImgPtr++; putpixel(xoff,yoff,PixelColor); xoff++; } xoff-=width; yoff++; } return; } --- Maximus 2.01wb * Origin: Houston Game Designer (713)-251-0734 (1:106/433.25) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 239/1004 SEEN-BY: 280/1 390/1 396/1 5 15 730/6 2270/1 3603/20