/* GEM-View 3.00 PROCESSING Modul: Bild horizontal halbieren (verzerren) (c) 22.10.1993 by Dieter Fiebelkorn Grner Weg 29a D-45768 Marl (GERMANY) */ #include #include "image.h" #include "moduls.h" unsigned char hhalf2(unsigned short); Image* gvw_main(PROC_Structure *procS, int verbose) { Image *image; Image *oimage; char *data; char *src, *dst; long width, height; long x, y; image = procS->image; if (image == NULL) { procS->events.alert(1, "[3][ | No image for process! | ][ Abort ]"); return(NULL); } data = image->data; if (data == NULL) { procS->events.alert(1, "[3][ | No data in image! | ][ Abort ]"); return(NULL); } oimage = procS->images.newGEMImage(image->title, (image->unalignwidth+1) >> 1, image->height, image->depth); if (oimage == NULL) { procS->events.alert(1, "[3][ | Not enough for new image! | ][ Abort ]"); return(NULL); } src = data; dst = oimage->data; for (x = (long)image->rgb.used - 1; x >= 0; x--) { oimage->rgb.red [x] = image->rgb.red [x]; oimage->rgb.green[x] = image->rgb.green[x]; oimage->rgb.blue [x] = image->rgb.blue [x]; } oimage->rgb.used = image->rgb.used; width = (long)image->width >> 4; height = (long)image->height * image->depth; for (y = height; y > 0; y--) { for (x = width; x > 0; x--) *dst++ = hhalf2(*((unsigned short*)src)++); if (width & 0x01) dst++; } return(oimage); }