Category : C Source Code
Archive   : EGA-C.ZIP
Filename : GPAMTGD.C

 
Output of file : GPAMTGD.C contained in archive : EGA-C.ZIP
gpamtgd(image,width,height,length)
unsigned char far *image;
unsigned int width,height,length;
{
extern unsigned int gdvw_x1,gdvw_x2,gdvw_x3;
extern unsigned int gdvw_y1,gdvw_y2,gdvw_y3;
extern unsigned int Dither4[4][4];

unsigned char xscale[640];
unsigned char yscale[350];
unsigned char row[640];

int w,h,x,y,c;

int xi,xc,xs,yi,yc,ys;

gpcolor(0);
gpmove(gdvw_x1,gdvw_y1);
gpbox(gdvw_x2,gdvw_y2);

/* The dimension to our idea image is width x height. Determine the largest
possible real image dimension for the current viewport. */

if (((long)gdvw_y3 * (long)width * 4L) / (height * 3) <= gdvw_x3)
{
w = ((long)gdvw_y3 * (long)width * 4L) / (height * 3);
h = gdvw_y3;
}
else
{
w = gdvw_x3;
h = ((long)height * (long)gdvw_x3 * 3L) / (width * 4);
};

/* Generate X and Y scale tables */

gpslope(xscale,width,w);
gpslope(yscale,height,h);

y = 0;
for (ys = 0; ys < height; ys++)
{
if ((yc = yscale[ys]) != 0)
{
while (yc--)
{
x = 0;
xi = ys * length;
for (xs = 0; xs < width; xs++, xi++)
{
if ((xc = xscale[xs]) != 0)
{
while (xc--)
{
c = image[xi];
row[x++] = c / 16 + ( c % 16 > Dither4[y % 4][x % 4]) + 8;
/* row[x++] = c / 13 + 8; */
}
}
}
gpmove(gdvw_x1,gdvw_y1+y);
gpwtrow(row,w);
y++;
}
}

}

}


  3 Responses to “Category : C Source Code
Archive   : EGA-C.ZIP
Filename : GPAMTGD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/