Thread View: alt.sources.patches
1 messages
1 total messages
Started by Cristy
Fri, 20 Nov 1992 16:19
ImageMagick 2.1 - patch 05
Author: Cristy
Date: Fri, 20 Nov 1992 16:19
Date: Fri, 20 Nov 1992 16:19
1278 lines
45224 bytes
45224 bytes
To apply this patch:
cd to the top of the source tree (to the directory containing the
"ImageMagick" directory) and do:
patch -p -s < ThisFile
Patch will work silently unless an error occurs. If you want to watch
patch do its thing, leave out the "-s" argument to patch.
Finally, to rebuild after applying this patch, cd to the "ImageMagick"
directory and type:
make
The entire distribution is available as contrib/ImageMagick.tar.Z on
export.lcs.mit.edu.
Brief notes on what this patch fixes:
o Fixed ANSI warning on image composite code.
o Panning uses a pixmap for faster panning speed.
o Rotate.c now uses a table to force range limits.
o Fixed strcasecmp to work under VMS.
o range table in quantize.c is allocated from the heap instead of
the stack.
o adjusted the sensitivity for automatic dithering. Some JPEG images
were not being dithered.
diff -c -r ImageMagick/Imakefile ImageMagick2.1.5/Imakefile
*** ImageMagick/Imakefile Sun May 31 13:04:19 1992
--- ImageMagick2.1.5/Imakefile Thu Nov 19 16:02:23 1992
***************
*** 35,40 ****
--- 35,41 ----
#TIFF_LIBRARIES= -Ltiff/libtiff -L../tiff/libtiff -ltiff
DEFINES= $(JPEG) $(JPEG_INCLUDES) $(TIFF) $(TIFF_INCLUDES)
+ LOCALDIR = /usr/local/bin
SYS_LIBRARIES= $(XLIB) $(JPEG_LIBRARIES) $(TIFF_LIBRARIES) -lm
MagickObjects= X.o image.o rotate.o quantize.o colors.o signature.o compress.o\
***************
*** 74,80 ****
InstallMyManPage(miff,$(MANSOURCEPATH)5,5)
#define IHaveSubdirs
! #define PassCDebugFlags 'DEFINES=$(DEFINES)' 'SYS_LIBRARIES=$(SYS_LIBRARIES)'
SUBDIRS= utilities xtp
--- 75,82 ----
InstallMyManPage(miff,$(MANSOURCEPATH)5,5)
#define IHaveSubdirs
! #define PassCDebugFlags 'DEFINES=$(DEFINES)' 'SYS_LIBRARIES=$(SYS_LIBRARIES)' \
! 'LOCALDIR=$(LOCALDIR)'
SUBDIRS= utilities xtp
diff -c -r ImageMagick/X.c ImageMagick2.1.5/X.c
*** ImageMagick/X.c Tue Nov 17 10:20:04 1992
--- ImageMagick2.1.5/X.c Tue Nov 17 16:22:17 1992
***************
*** 2392,2408 ****
(char *) NULL,"0");
resource_info->number_colors=atoi(resource_value);
resource_value=XGetResource(resource_database,application_name,"colorspace",
! (char *) NULL,"RGB");
! if (strncasecmp("GRAY",resource_value,3) == 0)
resource_info->colorspace=GRAYColorspace;
else
! if (strncasecmp("YIQ",resource_value,3) == 0)
resource_info->colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",resource_value,3) == 0)
resource_info->colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",resource_value,3) == 0)
resource_info->colorspace=XYZColorspace;
else
resource_info->colorspace=RGBColorspace;
--- 2392,2408 ----
(char *) NULL,"0");
resource_info->number_colors=atoi(resource_value);
resource_value=XGetResource(resource_database,application_name,"colorspace",
! (char *) NULL,"rgb");
! if (strncasecmp("gray",resource_value,3) == 0)
resource_info->colorspace=GRAYColorspace;
else
! if (strncasecmp("yiq",resource_value,3) == 0)
resource_info->colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",resource_value,3) == 0)
resource_info->colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",resource_value,3) == 0)
resource_info->colorspace=XYZColorspace;
else
resource_info->colorspace=RGBColorspace;
diff -c -r ImageMagick/alien.c ImageMagick2.1.5/alien.c
*** ImageMagick/alien.c Sat Nov 14 01:20:28 1992
--- ImageMagick2.1.5/alien.c Thu Nov 19 14:47:48 1992
***************
*** 1891,1898 ****
x_resolution=XResolution;
y_resolution=YResolution;
if (alien_info->density != (char *) NULL)
! (void) XParseGeometry(alien_info->density,&x,&y,&x_resolution,
! &y_resolution);
(void) sprintf(clip_geometry,"%ux%u+%u-%u\0",
((upper_x-lower_x)*x_resolution+(XResolution >> 1))/XResolution,
((upper_y-lower_y)*y_resolution+(YResolution >> 1))/YResolution,
--- 1891,1910 ----
x_resolution=XResolution;
y_resolution=YResolution;
if (alien_info->density != (char *) NULL)
! {
! int
! flags;
!
! /*
! User specified density.
! */
! flags=XParseGeometry(alien_info->density,&x,&y,&x_resolution,
! &y_resolution);
! if ((flags & WidthValue) == 0)
! x_resolution=XResolution;
! if ((flags & HeightValue) == 0)
! y_resolution=x_resolution;
! }
(void) sprintf(clip_geometry,"%ux%u+%u-%u\0",
((upper_x-lower_x)*x_resolution+(XResolution >> 1))/XResolution,
((upper_y-lower_y)*y_resolution+(YResolution >> 1))/YResolution,
diff -c -r ImageMagick/animate.c ImageMagick2.1.5/animate.c
*** ImageMagick/animate.c Sat Nov 14 01:20:24 1992
--- ImageMagick2.1.5/animate.c Tue Nov 17 16:22:12 1992
***************
*** 1683,1701 ****
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("GRAY",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("RGB",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("YIQ",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--- 1683,1701 ----
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("gray",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("rgb",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("yiq",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
diff -c -r ImageMagick/display.c ImageMagick2.1.5/display.c
*** ImageMagick/display.c Mon Nov 16 12:47:03 1992
--- ImageMagick2.1.5/display.c Fri Nov 20 10:42:54 1992
***************
*** 3005,3010 ****
--- 3005,3011 ----
XSetWindowBackgroundPixmap(display,pan_window.id,pan_window.pixmap);
XClearWindow(display,pan_window.id);
XDrawPanRectangle(display,&image_window,&pan_window);
+ (void) XMakePixmap(display,&image_window);
*state|=PanIconMappedState;
break;
}
***************
*** 5021,5039 ****
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("GRAY",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("RGB",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("YIQ",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--- 5022,5040 ----
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("gray",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("rgb",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("yiq",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
diff -c -r ImageMagick/display.h ImageMagick2.1.5/display.h
*** ImageMagick/display.h Fri Nov 13 13:27:13 1992
--- ImageMagick2.1.5/display.h Tue Nov 17 15:19:44 1992
***************
*** 44,49 ****
--- 44,51 ----
(void) fprintf(stderr,".\n"); \
}
#ifdef vms
+ #define strcasecmp strcmp
+ #define strncasecmp strncmp
#define pclose(file) exit(1)
#define popen(command,mode) exit(1)
#define unlink(file) remove(file)
diff -c -r ImageMagick/image.c ImageMagick2.1.5/image.c
*** ImageMagick/image.c Sat Nov 14 01:20:32 1992
--- ImageMagick2.1.5/image.c Fri Nov 20 09:59:56 1992
***************
*** 833,875 ****
}
else
{
! red=(p->red*MaxRGB+q->red*(MaxRGB-p->index))/MaxRGB;
! green=(p->green*MaxRGB+q->green*(MaxRGB-p->index))/MaxRGB;
! blue=(p->blue*MaxRGB+q->blue*(MaxRGB-p->index))/MaxRGB;
! index=(p->index*MaxRGB+q->index*(MaxRGB-p->index))/MaxRGB;
}
break;
}
case InCompositeOp:
{
! red=(p->red*q->index)/MaxRGB;
! green=(p->green*q->index)/MaxRGB;
! blue=(p->blue*q->index)/MaxRGB;
! index=(p->index*q->index)/MaxRGB;
break;
}
case OutCompositeOp:
{
! red=(p->red*(MaxRGB-q->index))/MaxRGB;
! green=(p->green*(MaxRGB-q->index))/MaxRGB;
! blue=(p->blue*(MaxRGB-q->index))/MaxRGB;
! index=(p->index*(MaxRGB-q->index))/MaxRGB;
break;
}
case AtopCompositeOp:
{
! red=(p->red*q->index+q->red*(MaxRGB-p->index))/MaxRGB;
! green=(p->green*q->index+q->green*(MaxRGB-p->index))/MaxRGB;
! blue=(p->blue*q->index+q->blue*(MaxRGB-p->index))/MaxRGB;
! index=(p->index*q->index+q->index*(MaxRGB-p->index))/MaxRGB;
break;
}
case XorCompositeOp:
{
! red=(p->red*(MaxRGB-q->index)+q->red*(MaxRGB-p->index))/MaxRGB;
! green=(p->green*(MaxRGB-q->index)+q->green*(MaxRGB-p->index))/MaxRGB;
! blue=(p->blue*(MaxRGB-q->index)+q->blue*(MaxRGB-p->index))/MaxRGB;
! index=(p->index*(MaxRGB-q->index)+q->index*(MaxRGB-p->index))/MaxRGB;
break;
}
case PlusCompositeOp:
--- 833,878 ----
}
else
{
! red=(p->red*MaxRGB+q->red*(MaxRGB-p->index))/(int) MaxRGB;
! green=(p->green*MaxRGB+q->green*(MaxRGB-p->index))/(int) MaxRGB;
! blue=(p->blue*MaxRGB+q->blue*(MaxRGB-p->index))/(int) MaxRGB;
! index=(p->index*MaxRGB+q->index*(MaxRGB-p->index))/(int) MaxRGB;
}
break;
}
case InCompositeOp:
{
! red=(p->red*q->index)/(int) MaxRGB;
! green=(p->green*q->index)/(int) MaxRGB;
! blue=(p->blue*q->index)/(int) MaxRGB;
! index=(p->index*q->index)/(int) MaxRGB;
break;
}
case OutCompositeOp:
{
! red=(p->red*(MaxRGB-q->index))/(int) MaxRGB;
! green=(p->green*(MaxRGB-q->index))/(int) MaxRGB;
! blue=(p->blue*(MaxRGB-q->index))/(int) MaxRGB;
! index=(p->index*(MaxRGB-q->index))/(int) MaxRGB;
break;
}
case AtopCompositeOp:
{
! red=(p->red*q->index+q->red*(MaxRGB-p->index))/(int) MaxRGB;
! green=(p->green*q->index+q->green*(MaxRGB-p->index))/(int) MaxRGB;
! blue=(p->blue*q->index+q->blue*(MaxRGB-p->index))/(int) MaxRGB;
! index=(p->index*q->index+q->index*(MaxRGB-p->index))/(int) MaxRGB;
break;
}
case XorCompositeOp:
{
! red=(p->red*(MaxRGB-q->index)+q->red*(MaxRGB-p->index))/(int) MaxRGB;
! green=(p->green*(MaxRGB-q->index)+q->green*(MaxRGB-p->index))/
! (int) MaxRGB;
! blue=(p->blue*(MaxRGB-q->index)+q->blue*(MaxRGB-p->index))/
! (int) MaxRGB;
! index=(p->index*(MaxRGB-q->index)+q->index*(MaxRGB-p->index))/
! (int) MaxRGB;
break;
}
case PlusCompositeOp:
Common subdirectories: ImageMagick/images and ImageMagick2.1.5/images
diff -c -r ImageMagick/montage.c ImageMagick2.1.5/montage.c
*** ImageMagick/montage.c Sat Nov 14 01:20:22 1992
--- ImageMagick2.1.5/montage.c Tue Nov 17 16:22:14 1992
***************
*** 886,904 ****
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("GRAY",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("RGB",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("YIQ",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--- 886,904 ----
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("gray",option,3) == 0)
resource_info.colorspace=GRAYColorspace;
else
! if (strncasecmp("rgb",option,3) == 0)
resource_info.colorspace=RGBColorspace;
else
! if (strncasecmp("yiq",option,3) == 0)
resource_info.colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",option,3) == 0)
resource_info.colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",option,3) == 0)
resource_info.colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
diff -c -r ImageMagick/quantize.c ImageMagick2.1.5/quantize.c
*** ImageMagick/quantize.c Wed Nov 11 14:12:13 1992
--- ImageMagick2.1.5/quantize.c Fri Nov 20 10:00:50 1992
***************
*** 790,796 ****
unsigned char
*range_limit,
! range_table[3*(MaxRGB+1)];
unsigned int
i,
--- 790,796 ----
unsigned char
*range_limit,
! *range_table;
unsigned int
i,
***************
*** 812,820 ****
Allocate the cache & scanline buffers to keep track of quantization error.
*/
cache=(int *) malloc((1 << 18)*sizeof(int));
scanline=(ScaledColorPacket *)
malloc(2*(image->columns+2)*sizeof(ScaledColorPacket));
! if ((cache == (int *) NULL) || (scanline == (ScaledColorPacket *) NULL))
{
Warning("unable to dither image","memory allocation failed");
return(True);
--- 812,822 ----
Allocate the cache & scanline buffers to keep track of quantization error.
*/
cache=(int *) malloc((1 << 18)*sizeof(int));
+ range_table=(unsigned char *) malloc(3*(MaxRGB+1)*sizeof(unsigned char));
scanline=(ScaledColorPacket *)
malloc(2*(image->columns+2)*sizeof(ScaledColorPacket));
! if ((cache == (int *) NULL) || (range_table == (unsigned char *) NULL) ||
! (scanline == (ScaledColorPacket *) NULL))
{
Warning("unable to dither image","memory allocation failed");
return(True);
***************
*** 962,967 ****
--- 964,970 ----
Free up memory.
*/
(void) free((void *) scanline);
+ (void) free((void *) range_table);
(void) free((void *) cache);
(void) free((void *) image->pixels);
image->packets=dithered_image->packets;
***************
*** 1581,1587 ****
RGBTransformImage(image,colorspace);
Classification(image);
if (!optimal)
! dither|=cube.colors > (1 << (cube.depth+2));
Reduction(number_colors);
Assignment(image,dither,optimal);
if (colorspace != RGBColorspace)
--- 1584,1590 ----
RGBTransformImage(image,colorspace);
Classification(image);
if (!optimal)
! dither|=cube.colors > (1 << (cube.depth-1));
Reduction(number_colors);
Assignment(image,dither,optimal);
if (colorspace != RGBColorspace)
***************
*** 1693,1699 ****
Classification(images[i]);
}
if (!optimal)
! dither|=cube.colors > (1 << (cube.depth+2));
Reduction(number_colors);
for (i=0; i < number_images; i++)
{
--- 1696,1702 ----
Classification(images[i]);
}
if (!optimal)
! dither|=cube.colors > (1 << (cube.depth-1));
Reduction(number_colors);
for (i=0; i < number_images; i++)
{
diff -c -r ImageMagick/rotate.c ImageMagick2.1.5/rotate.c
*** ImageMagick/rotate.c Mon Nov 9 14:48:31 1992
--- ImageMagick2.1.5/rotate.c Fri Nov 20 10:00:49 1992
***************
*** 107,113 ****
%
*/
static void ColumnShear(source_image,source_columns,column,y,length,
! displacement,background)
ColorPacket
*source_image;
--- 107,113 ----
%
*/
static void ColumnShear(source_image,source_columns,column,y,length,
! displacement,background,range_limit)
ColorPacket
*source_image;
***************
*** 124,146 ****
ColorPacket
background;
{
ColorPacket
last_pixel;
- double
- fractional_step;
-
enum {UP,DOWN}
direction;
! long int
blue,
green,
- int_fractional_step,
red,
step;
register ColorPacket
*p,
*q;
--- 124,148 ----
ColorPacket
background;
+
+ register unsigned char
+ *range_limit;
{
ColorPacket
last_pixel;
enum {UP,DOWN}
direction;
! int
blue,
green,
red,
step;
+ long int
+ fractional_step;
+
register ColorPacket
*p,
*q;
***************
*** 159,166 ****
direction=UP;
}
step=(int) floor(displacement);
! fractional_step=displacement-(double) step;
! if (fractional_step == 0.0)
{
/*
No fractional displacement-- just copy the pixels.
--- 161,168 ----
direction=UP;
}
step=(int) floor(displacement);
! fractional_step=UpShifted(displacement-(double) step);
! if (fractional_step == 0)
{
/*
No fractional displacement-- just copy the pixels.
***************
*** 214,220 ****
Fractional displacment.
*/
step++;
- int_fractional_step=UpShifted(fractional_step);
last_pixel=background;
switch (direction)
{
--- 216,221 ----
***************
*** 224,290 ****
q=p-step*source_columns;
for (i=0; i < length; i++)
{
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+p->red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+p->green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+p->blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
last_pixel=(*p);
- q+=source_columns;
p+=source_columns;
}
/*
Set old column to background color.
*/
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+background.red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+background.green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+background.blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
q+=source_columns;
for (i=0; i < step-1; i++)
{
--- 225,255 ----
q=p-step*source_columns;
for (i=0; i < length; i++)
{
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+p->red*
! fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+p->green*
! fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+p->blue*
! fractional_step);
last_pixel=(*p);
p+=source_columns;
+ q->red=range_limit[red];
+ q->green=range_limit[green];
+ q->blue=range_limit[blue];
+ q+=source_columns;
}
/*
Set old column to background color.
*/
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+
! background.red*fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+
! background.green*fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+
! background.blue*fractional_step);
! q->red=range_limit[red];
! q->green=range_limit[green];
! q->blue=range_limit[blue];
q+=source_columns;
for (i=0; i < step-1; i++)
{
***************
*** 299,366 ****
q=p+step*source_columns;
for (i=0; i < length; i++)
{
- q-=source_columns;
p-=source_columns;
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+p->red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+p->green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+p->blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
last_pixel=(*p);
}
/*
Set old column to background color.
*/
q-=source_columns;
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+background.red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+background.green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+background.blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
for (i=0; i < step-1; i++)
{
q-=source_columns;
--- 264,295 ----
q=p+step*source_columns;
for (i=0; i < length; i++)
{
p-=source_columns;
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+p->red*
! fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+p->green*
! fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+p->blue*
! fractional_step);
last_pixel=(*p);
+ q-=source_columns;
+ q->red=range_limit[red];
+ q->green=range_limit[green];
+ q->blue=range_limit[blue];
}
/*
Set old column to background color.
*/
+ red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+
+ background.red*fractional_step);
+ green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+
+ background.green*fractional_step);
+ blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+
+ background.blue*fractional_step);
q-=source_columns;
! q->red=range_limit[red];
! q->green=range_limit[green];
! q->blue=range_limit[blue];
for (i=0; i < step-1; i++)
{
q-=source_columns;
***************
*** 601,607 ****
%
*/
static void RowShear(source_image,source_columns,row,x,length,displacement,
! background)
ColorPacket
*source_image;
--- 530,536 ----
%
*/
static void RowShear(source_image,source_columns,row,x,length,displacement,
! background,range_limit)
ColorPacket
*source_image;
***************
*** 616,638 ****
ColorPacket
background;
{
ColorPacket
last_pixel;
- double
- fractional_step;
-
enum {LEFT,RIGHT}
direction;
! long int
blue,
green,
- int_fractional_step,
red,
step;
register ColorPacket
*p,
*q;
--- 545,569 ----
ColorPacket
background;
+
+ register unsigned char
+ *range_limit;
{
ColorPacket
last_pixel;
enum {LEFT,RIGHT}
direction;
! int
blue,
green,
red,
step;
+ long int
+ fractional_step;
+
register ColorPacket
*p,
*q;
***************
*** 651,658 ****
direction=LEFT;
}
step=(int) floor(displacement);
! fractional_step=displacement-(double)step;
! if (fractional_step == 0.0)
{
/*
No fractional displacement-- just copy.
--- 582,589 ----
direction=LEFT;
}
step=(int) floor(displacement);
! fractional_step=UpShifted(displacement-(double) step);
! if (fractional_step == 0)
{
/*
No fractional displacement-- just copy.
***************
*** 710,716 ****
Fractional displacement.
*/
step++;
- int_fractional_step=UpShifted(fractional_step);
last_pixel=background;
switch (direction)
{
--- 641,646 ----
***************
*** 720,786 ****
q=p-step;
for (i=0; i < length; i++)
{
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+p->red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+p->green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+p->blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
last_pixel=(*p);
p++;
q++;
}
/*
Set old row to background color.
*/
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+background.red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+background.green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned ) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+background.blue*int_fractional_step);
! if (blue > MaxRGB)
! q->blue=MaxRGB;
! else
! if (blue < 0)
! q->blue=0;
! else
! q->blue=(unsigned char) blue;
q++;
for (i=0; i < step-1; i++)
{
--- 650,680 ----
q=p-step;
for (i=0; i < length; i++)
{
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+p->red*
! fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+p->green*
! fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+p->blue*
! fractional_step);
last_pixel=(*p);
p++;
+ q->red=range_limit[red];
+ q->green=range_limit[green];
+ q->blue=range_limit[blue];
q++;
}
/*
Set old row to background color.
*/
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+
! background.red*fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+
! background.green*fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+
! background.blue*fractional_step);
! q->red=range_limit[red];
! q->green=range_limit[green];
! q->blue=range_limit[blue];
q++;
for (i=0; i < step-1; i++)
{
***************
*** 796,862 ****
for (i=0; i < length; i++)
{
p--;
! q--;
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+p->red*int_fractional_step);
! if (red > MaxRGB)
! q->red=MaxRGB;
! else
! if (red < 0)
! q->red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+p->green*int_fractional_step);
! if (green > MaxRGB)
! q->green=MaxRGB;
! else
! if (green < 0)
! q->green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+p->blue*int_fractional_step);
! if (blue > MaxRGB)
! blue=MaxRGB;
! else
! if (blue < 0)
! blue=0;
! else
! q->blue=(unsigned char) blue;
last_pixel=(*p);
}
/*
Set old row to background color.
*/
q--;
! red=(long) DownShift(last_pixel.red*
! (UpShift(1)-int_fractional_step)+background.red*int_fractional_step);
! if (red > MaxRGB)
! red=MaxRGB;
! else
! if (red < 0)
! red=0;
! else
! q->red=(unsigned char) red;
! green=(long) DownShift(last_pixel.green*
! (UpShift(1)-int_fractional_step)+background.green*int_fractional_step);
! if (green > MaxRGB)
! green=MaxRGB;
! else
! if (green < 0)
! green=0;
! else
! q->green=(unsigned char) green;
! blue=(long) DownShift(last_pixel.blue*
! (UpShift(1)-int_fractional_step)+background.blue*int_fractional_step);
! if (blue > MaxRGB)
! blue=MaxRGB;
! else
! if (blue < 0)
! blue=0;
! else
! q->blue=(unsigned char) blue;
for (i=0; i < step-1; i++)
{
q--;
--- 690,720 ----
for (i=0; i < length; i++)
{
p--;
! red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+p->red*
! fractional_step);
! green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+p->green*
! fractional_step);
! blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+p->blue*
! fractional_step);
last_pixel=(*p);
+ q--;
+ q->red=range_limit[red];
+ q->green=range_limit[green];
+ q->blue=range_limit[blue];
}
/*
Set old row to background color.
*/
+ red=DownShift(last_pixel.red*(UpShift(1)-fractional_step)+
+ background.red*fractional_step);
+ green=DownShift(last_pixel.green*(UpShift(1)-fractional_step)+
+ background.green*fractional_step);
+ blue=DownShift(last_pixel.blue*(UpShift(1)-fractional_step)+
+ background.blue*fractional_step);
q--;
! q->red=range_limit[red];
! q->green=range_limit[green];
! q->blue=range_limit[blue];
for (i=0; i < step-1; i++)
{
q--;
***************
*** 916,922 ****
int
clip;
{
! #define DegreesToRadians(x) ((x)/180.0*3.14159265359)
ColorPacket
background,
--- 774,780 ----
int
clip;
{
! #define DegreesToRadians(x) ((x)*3.14159265358979323846/180.0)
ColorPacket
background,
***************
*** 1041,1046 ****
--- 899,908 ----
Point
corners[4];
+ unsigned char
+ *range_limit,
+ *range_table;
+
unsigned int
column,
row;
***************
*** 1067,1072 ****
--- 929,951 ----
rotated_pixels+number_columns,number_columns,x_offset,y_offset,
rotations);
/*
+ Initialize range table.
+ */
+ range_table=(unsigned char *) malloc(3*(MaxRGB+1)*sizeof(unsigned char));
+ if (range_table == (unsigned char *) NULL)
+ {
+ DestroyImage(rotated_image);
+ Warning("unable to rotate image","memory allocation failed");
+ return((Image *) NULL);
+ }
+ for (i=0; i <= MaxRGB; i++)
+ {
+ range_table[i]=0;
+ range_table[i+(MaxRGB+1)]=(unsigned char) i;
+ range_table[i+(MaxRGB+1)*2]=MaxRGB;
+ }
+ range_limit=range_table+(MaxRGB+1);
+ /*
Perform a fractional rotation. First, shear the image rows.
*/
row=(number_rows-rotated_image->rows)/2;
***************
*** 1074,1080 ****
{
RowShear(rotated_pixels+number_columns,number_columns,row,x_offset,
rotated_image->columns,x_shear*
! (((double) i)-(rotated_image->rows-1)/2.0),background);
row++;
}
/*
--- 953,959 ----
{
RowShear(rotated_pixels+number_columns,number_columns,row,x_offset,
rotated_image->columns,x_shear*
! (((double) i)-(rotated_image->rows-1)/2.0),background,range_limit);
row++;
}
/*
***************
*** 1085,1091 ****
{
ColumnShear(rotated_pixels+number_columns,number_columns,column,
y_offset,rotated_image->rows,y_shear*(((double) i)-(y_width-1)/2.0),
! background);
column++;
}
/*
--- 964,970 ----
{
ColumnShear(rotated_pixels+number_columns,number_columns,column,
y_offset,rotated_image->rows,y_shear*(((double) i)-(y_width-1)/2.0),
! background,range_limit);
column++;
}
/*
***************
*** 1094,1100 ****
for (i=0; i < number_rows; i++)
RowShear(rotated_pixels+number_columns,number_columns,(unsigned int) i,
(number_columns-y_width)/2,y_width,x_shear*
! (((double) i)-(number_rows-1)/2.0),background);
/*
Calculate the rotated image size.
*/
--- 973,980 ----
for (i=0; i < number_rows; i++)
RowShear(rotated_pixels+number_columns,number_columns,(unsigned int) i,
(number_columns-y_width)/2,y_width,x_shear*
! (((double) i)-(number_rows-1)/2.0),background,range_limit);
! (void) free((void *) range_table);
/*
Calculate the rotated image size.
*/
Common subdirectories: ImageMagick/scenes and ImageMagick2.1.5/scenes
Common subdirectories: ImageMagick/utilities and ImageMagick2.1.5/utilities
Common subdirectories: ImageMagick/xtp and ImageMagick2.1.5/xtp
diff -c -r ImageMagick/utilities/convert.c ImageMagick2.1.5/utilities/convert.c
*** ImageMagick/utilities/convert.c Mon Nov 16 17:57:34 1992
--- ImageMagick2.1.5/utilities/convert.c Tue Nov 17 16:22:19 1992
***************
*** 295,313 ****
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("GRAY",option,3) == 0)
colorspace=GRAYColorspace;
else
! if (strncasecmp("RGB",option,3) == 0)
colorspace=RGBColorspace;
else
! if (strncasecmp("YIQ",option,3) == 0)
colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",option,3) == 0)
colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",option,3) == 0)
colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--- 295,313 ----
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("gray",option,3) == 0)
colorspace=GRAYColorspace;
else
! if (strncasecmp("rgb",option,3) == 0)
colorspace=RGBColorspace;
else
! if (strncasecmp("yiq",option,3) == 0)
colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",option,3) == 0)
colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",option,3) == 0)
colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
diff -c -r ImageMagick/utilities/mogrify.c ImageMagick2.1.5/utilities/mogrify.c
*** ImageMagick/utilities/mogrify.c Sat Nov 14 01:20:33 1992
--- ImageMagick2.1.5/utilities/mogrify.c Tue Nov 17 16:22:21 1992
***************
*** 338,356 ****
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("GRAY",option,3) == 0)
colorspace=GRAYColorspace;
else
! if (strncasecmp("RGB",option,3) == 0)
colorspace=RGBColorspace;
else
! if (strncasecmp("YIQ",option,3) == 0)
colorspace=YIQColorspace;
else
! if (strncasecmp("YUV",option,3) == 0)
colorspace=YUVColorspace;
else
! if (strncasecmp("XYZ",option,3) == 0)
colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--- 338,356 ----
if (i == argc)
Error("missing type on -colorspace",(char *) NULL);
option=argv[i];
! if (strncasecmp("gray",option,3) == 0)
colorspace=GRAYColorspace;
else
! if (strncasecmp("rgb",option,3) == 0)
colorspace=RGBColorspace;
else
! if (strncasecmp("yiq",option,3) == 0)
colorspace=YIQColorspace;
else
! if (strncasecmp("yuv",option,3) == 0)
colorspace=YUVColorspace;
else
! if (strncasecmp("xyz",option,3) == 0)
colorspace=XYZColorspace;
else
Error("invalid colorspace type on -colorspace",
--
cristy@dupont.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads