home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
DVPG30FS.ZIP
/
OLD-CODE.C
< prev
next >
Wrap
Text File
|
1993-11-28
|
6KB
|
144 lines
return;
image_x_offset = image(image_x_dim >> 1);
/* now the actual image width in pixels when displayed
* this must be corrected in the cases of a S/W zoom to ensure that there is no remainder in # of picture elements drawn -> hence mod fn */
image_x_dim = (x_size - picture_x_offset) * zoom_inc_factor / shrink ;
if (image_x_dim >= x_max) /* case of picture > screen */
image_x_dim = x_max - x_max % zoom_inc_factor;
else{
image_x_dim = (x_size - picture_x_offset) / shrink * zoom_inc_factor;
if (image_x_dim > x_max) image_x_dim = x_max - x_max % zoom_inc_factor;
}
image_y_dim = (y_size - picture_y_offset) * zoom_inc_factor / shrink ;
if (image_y_dim >= y_max)
image_y_dim = y_max - y_max % zoom_inc_factor;
else{
image_y_dim = (y_size - picture_y_offset) / shrink * zoom_inc_factor;
if (image_y_dim > y_max) image_y_dim = y_max - y_max % zoom_inc_factor;
}
/* these are the offsets of the image into the viewing window (if image < screen size)
* - the only case not handled is having the image larger than the screen
*/
image_x_offset = (x_max - image_x_dim) >> 1;
image_y_offset = (y_max - image_y_dim) >> 1;
/* now the maximum pixel values for the lower right corner of the image */
image_x_max = image_x_dim + image_x_offset;
image_y_max = image_y_dim + image_y_offset;
/* now do the image specific info
* ie what row do we start showing the image at? picture_y_offset, picture_x_offset
* what is the maximum row? the size ? picture_max_y, picture_max_x, picture_x_dim, picture_y_dim
*/
if (picture_y_dim * zoom_inc_factor / shrink < y_max){ /* picture is now < screen in this dimension */
i = y_max * shrink / zoom_inc_factor - picture_x_dim; /* new maximum width */
if (i < 0) i = 0;
picture_y_offset = i >> 1; /* reset size to get full image around the center of the screen */
}
if (picture_x_dim * zoom_inc_factor / shrink < x_max){ /* picture is now < screen in this dimension */
i = x_max * shrink / zoom_inc_factor - picture_x_dim; /* new maximum width */
if (i < 0) i = 0;
picture_x_offset = i >> 1;
}
picture_x_dim = image_x_dim * shrink / zoom_inc_factor; /* limit image to size of the screen */
if (picture_x_dim > (x_size - picture_x_offset))
picture_x_dim = (x_size - picture_x_offset) * shrink / zoom_inc_factor;
picture_y_dim = image_y_dim * shrink / zoom_inc_factor;
if (picture_y_dim > (y_size - picture_y_offset))
picture_y_dim = (y_size - picture_y_offset) * shrink / zoom_inc_factor;
picture_max_x = picture_x_dim + picture_x_offset;
picture_max_y = picture_y_dim + picture_y_offset;
image_y_offset = 0;
image_y_dim = mod_limit(y_max);
picture_y_dim = image_y_dim * shrink / zoom_inc_factor;
if (picture_y_dim > picture_y_size){
picture_y_dim = mod_limit(picture_y_size);
image_y_dim = picture_y_dim * zoom_inc_factor / shrink;
image_y_offset = (y_max - image_y_dim) >> 1;
}
15 bit tinting routine (old)
data = peek(video_mem_seg, (unsigned int) offset);
red = (unsigned int) (data & 0x1f) << 3; /* convert from 5 bits to 8 */
red += (signed char) tint_table[0][red];
green = (unsigned int) (data & 0x3e0) >> 2;
green += (signed char) tint_table[1][green];
blue = (unsigned int) (data & 0x7c00) >> 7;
blue += (signed char) tint_table[2][blue];
if (red < 256 && green < 256 && blue < 256 && red >= 0 && green >= 0 && blue >= 0){
poke(video_mem_seg, offset, (red >> 3) + ((green << 2) & 0x3e0) + ((blue << 7) & 0x7c00));
}
{ register JSAMPROW elemptr;
register DCTELEM *localblkptr = block;
register JSAMPLE *range_limit = cinfo->sample_range_limit +
CENTERJSAMPLE;
#if DCTSIZE != 8
register int elemc;
#endif
register int elemr;
for (elemr = 0; elemr < DCTSIZE; elemr++) {
elemptr = srowptr[elemr] + (bi * DCTSIZE);
#if DCTSIZE == 8 /* unroll the inner loop */
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr++ = range_limit[*localblkptr++];
*elemptr = range_limit[*localblkptr++];
#else
for (elemc = DCTSIZE; elemc > 0; elemc--) {
*elemptr++ = range_limit[*localblkptr++];
}
#endif
}
range_limit = cinfo->sample_range_limit + GETJSAMPLE(inptr0[col*2]);
red = range_limit[cb]; /* blue */
green = range_limit[cg];
blue = range_limit[cr]; /* red */
if (tint_loaded) tint_graphics();
* int_ptr++ = (red >> 3) + ((green << 2) & 0x3e0) + ((blue << 7) & 0xfc00);
range_limit = cinfo->sample_range_limit + GETJSAMPLE(inptr0[col*2+1]);
red = range_limit[cb]; /* blue */
green = range_limit[cg];
blue = range_limit[cr]; /* red */
if (tint_loaded) tint_graphics();
* int_ptr++ = (red >> 3) + ((green << 2) & 0x3e0) + ((blue << 7) & 0xfc00);
/* row #2 */
range_limit = cinfo->sample_range_limit + GETJSAMPLE(inptr00[col*2]);
red = range_limit[cb]; /* blue */
green = range_limit[cg];
blue = range_limit[cr]; /* red */
if (tint_loaded) tint_graphics();
* int_ptr2++ = (red >> 3) + ((green << 2) & 0x3e0) + ((blue << 7) & 0xfc00);
range_limit = cinfo->sample_range_limit + GETJSAMPLE(inptr00[col*2+1]);
red = range_limit[cb]; /* blue */
green = range_limit[cg];
blue = range_limit[cr]; /* red */
if (tint_loaded) tint_graphics();
* int_ptr2++ = (red >> 3) + ((green << 2) & 0x3e0) + ((blue << 7) & 0xfc00);