From 1f8c2527baaff6357f31761b6340d2016920781f Mon Sep 17 00:00:00 2001 From: homm Date: Thu, 2 Jun 2016 11:44:10 +0300 Subject: [PATCH] internal rotating functions not used anymore --- PIL/Image.py | 1 - _imaging.c | 52 ------------------------------------------- libImaging/Geometry.c | 31 -------------------------- libImaging/Imaging.h | 2 -- 4 files changed, 86 deletions(-) diff --git a/PIL/Image.py b/PIL/Image.py index 4abfab20b..5e79e4bd8 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1582,7 +1582,6 @@ class Image(object): if angle == 270 and expand: return self.transpose(ROTATE_270) - angle = - math.radians(angle) matrix = [ round(math.cos(angle), 15), round(math.sin(angle), 15), 0.0, diff --git a/_imaging.c b/_imaging.c index 5c4781165..8b87a8108 100644 --- a/_imaging.c +++ b/_imaging.c @@ -1565,57 +1565,6 @@ _resize(ImagingObject* self, PyObject* args) return PyImagingNew(imOut); } -static PyObject* -_rotate(ImagingObject* self, PyObject* args) -{ - Imaging imOut; - Imaging imIn; - - double theta; - int filter = IMAGING_TRANSFORM_NEAREST; - int expand; - if (!PyArg_ParseTuple(args, "d|i|i", &theta, &filter, &expand)) - return NULL; - - imIn = self->image; - - theta = fmod(theta, 360.0); - if (theta < 0.0) - theta += 360; - - if (filter && imIn->type != IMAGING_TYPE_SPECIAL) { - /* Rotate with resampling filter */ - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); - (void) ImagingRotate(imOut, imIn, theta, filter); - - } else if ((theta == 90.0 || theta == 270.0) - && (expand || imIn->xsize == imIn->ysize)) { - /* Use fast version */ - imOut = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize); - if (imOut) { - if (theta == 90.0) - (void) ImagingRotate90(imOut, imIn); - else - (void) ImagingRotate270(imOut, imIn); - } - - } else { - imOut = ImagingNew(imIn->mode, imIn->xsize, imIn->ysize); - if (imOut) { - if (theta == 0.0) - /* No rotation: simply copy the input image */ - (void) ImagingCopy2(imOut, imIn); - else if (theta == 180.0) - /* Use fast version */ - (void) ImagingRotate180(imOut, imIn); - else - /* Use ordinary version */ - (void) ImagingRotate(imOut, imIn, theta, 0); - } - } - - return PyImagingNew(imOut); -} #define IS_RGB(mode)\ (!strcmp(mode, "RGB") || !strcmp(mode, "RGBA") || !strcmp(mode, "RGBX")) @@ -3050,7 +2999,6 @@ static struct PyMethodDef methods[] = { // There were two methods for image resize before. // Starting from Pillow 2.7.0 stretch is depreciated. {"stretch", (PyCFunction)_resize, 1}, - {"rotate", (PyCFunction)_rotate, 1}, {"transpose", (PyCFunction)_transpose, 1}, {"transform2", (PyCFunction)_transform2, 1}, diff --git a/libImaging/Geometry.c b/libImaging/Geometry.c index c4fea5c54..793cb9519 100644 --- a/libImaging/Geometry.c +++ b/libImaging/Geometry.c @@ -939,34 +939,3 @@ ImagingTransformQuad(Imaging imOut, Imaging imIn, filter, NULL, fill); } - -/* -------------------------------------------------------------------- */ -/* Convenience functions */ - -Imaging -ImagingRotate(Imaging imOut, Imaging imIn, double theta, int filterid) -{ - int xsize, ysize; - double sintheta, costheta; - double a[6]; - - /* Setup an affine transform to rotate around the image center */ - theta = -theta * M_PI / 180.0; - sintheta = sin(theta); - costheta = cos(theta); - - xsize = imOut->xsize; - ysize = imOut->ysize; - - a[0] = -costheta * xsize/2 - sintheta * ysize/2 + xsize/2; - a[1] = costheta; - a[2] = sintheta; - a[3] = sintheta * xsize/2 - costheta * ysize/2 + ysize/2; - a[4] = -sintheta; - a[5] = costheta; - - return ImagingTransformAffine( - imOut, imIn, - 0, 0, imOut->xsize, imOut->ysize, - a, filterid, 1); -} diff --git a/libImaging/Imaging.h b/libImaging/Imaging.h index 42135e110..ebcafd548 100644 --- a/libImaging/Imaging.h +++ b/libImaging/Imaging.h @@ -286,8 +286,6 @@ extern Imaging ImagingPointTransform( Imaging imIn, double scale, double offset); extern Imaging ImagingPutBand(Imaging im, Imaging imIn, int band); extern Imaging ImagingRankFilter(Imaging im, int size, int rank); -extern Imaging ImagingRotate( - Imaging imOut, Imaging imIn, double theta, int filter); extern Imaging ImagingRotate90(Imaging imOut, Imaging imIn); extern Imaging ImagingRotate180(Imaging imOut, Imaging imIn); extern Imaging ImagingRotate270(Imaging imOut, Imaging imIn);