mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 17:25:49 +03:00
internal rotating functions not used anymore
This commit is contained in:
parent
709078efd1
commit
1f8c2527ba
|
@ -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,
|
||||
|
|
52
_imaging.c
52
_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},
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user