mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge branch 'add-transpose' into fast-box-blur
This commit is contained in:
commit
316ac5ad57
|
@ -127,6 +127,44 @@ ImagingRotate90(Imaging imOut, Imaging imIn)
|
|||
}
|
||||
|
||||
|
||||
Imaging
|
||||
ImagingTranspose(Imaging imOut, Imaging imIn)
|
||||
{
|
||||
ImagingSectionCookie cookie;
|
||||
int x, y, xx, yy, xxsize, yysize;
|
||||
int size = 64;
|
||||
|
||||
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0)
|
||||
return (Imaging) ImagingError_ModeError();
|
||||
if (imIn->xsize != imOut->ysize || imIn->ysize != imOut->xsize)
|
||||
return (Imaging) ImagingError_Mismatch();
|
||||
|
||||
#define TRANSPOSE(image) \
|
||||
for (y = 0; y < imIn->ysize; y += size) { \
|
||||
for (x = 0; x < imIn->xsize; x += size) { \
|
||||
yysize = size < (imIn->ysize - y) ? size : (imIn->ysize - y); \
|
||||
xxsize = size < (imIn->xsize - x) ? size : (imIn->xsize - x); \
|
||||
for (yy = 0; yy < yysize; yy++) { \
|
||||
for (xx = 0; xx < xxsize; xx++) { \
|
||||
imOut->image[x + xx][y + yy] = imIn->image[y + yy][x + xx]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
ImagingCopyInfo(imOut, imIn);
|
||||
|
||||
ImagingSectionEnter(&cookie);
|
||||
if (imIn->image8)
|
||||
TRANSPOSE(image8)
|
||||
else
|
||||
TRANSPOSE(image32)
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
return imOut;
|
||||
}
|
||||
|
||||
|
||||
Imaging
|
||||
ImagingRotate180(Imaging imOut, Imaging imIn)
|
||||
{
|
||||
|
|
|
@ -292,6 +292,7 @@ extern Imaging ImagingRotate90(Imaging imOut, Imaging imIn);
|
|||
extern Imaging ImagingRotate180(Imaging imOut, Imaging imIn);
|
||||
extern Imaging ImagingRotate270(Imaging imOut, Imaging imIn);
|
||||
extern Imaging ImagingStretch(Imaging imOut, Imaging imIn, int filter);
|
||||
extern Imaging ImagingTranspose(Imaging imOut, Imaging imIn);
|
||||
extern Imaging ImagingTransformPerspective(
|
||||
Imaging imOut, Imaging imIn, int x0, int y0, int x1, int y1,
|
||||
double a[8], int filter, int fill);
|
||||
|
|
Loading…
Reference in New Issue
Block a user