make transpose part of public api

This commit is contained in:
homm 2014-11-07 03:37:12 +03:00
parent d41bc4fbfc
commit 32079b1dcc
2 changed files with 8 additions and 3 deletions

View File

@ -150,6 +150,7 @@ FLIP_TOP_BOTTOM = 1
ROTATE_90 = 2
ROTATE_180 = 3
ROTATE_270 = 4
TRANSPOSE = 5
# transforms
AFFINE = 0
@ -1921,13 +1922,13 @@ class Image:
:param method: One of :py:attr:`PIL.Image.FLIP_LEFT_RIGHT`,
:py:attr:`PIL.Image.FLIP_TOP_BOTTOM`, :py:attr:`PIL.Image.ROTATE_90`,
:py:attr:`PIL.Image.ROTATE_180`, or :py:attr:`PIL.Image.ROTATE_270`.
:py:attr:`PIL.Image.ROTATE_180`, :py:attr:`PIL.Image.ROTATE_270` or
:py:attr:`PIL.Image.TRANSPOSE`.
:returns: Returns a flipped or rotated copy of this image.
"""
self.load()
im = self.im.transpose(method)
return self._new(im)
return self._new(self.im.transpose(method))
def effect_spread(self, distance):
"""

View File

@ -1750,6 +1750,7 @@ _transpose(ImagingObject* self, PyObject* args)
break;
case 2: /* rotate 90 */
case 4: /* rotate 270 */
case 5: /* transpose */
imOut = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize);
break;
default:
@ -1774,6 +1775,9 @@ _transpose(ImagingObject* self, PyObject* args)
case 4:
(void) ImagingRotate270(imOut, imIn);
break;
case 5:
(void) ImagingTranspose(imOut, imIn);
break;
}
return PyImagingNew(imOut);