mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
rename Antialias and stretch to resample
This commit is contained in:
parent
1a097d2e02
commit
bc0f896a47
|
@ -18,7 +18,7 @@ Changelog (Pillow)
|
|||
- Use PyQt4 if it has already been imported, otherwise prefer PyQt5. #1003
|
||||
[AurelienBallier]
|
||||
|
||||
- Speedup stretch implementation up to 2.5 times. #977
|
||||
- Speedup resample implementation up to 2.5 times. #977
|
||||
[homm]
|
||||
|
||||
- Speed up rotation by using cache aware loops, added transpose to rotations. #994
|
||||
|
|
|
@ -1531,7 +1531,7 @@ _resize(ImagingObject* self, PyObject* args)
|
|||
a, filter, 1);
|
||||
}
|
||||
else {
|
||||
imOut = ImagingStretch(imIn, xsize, ysize, filter);
|
||||
imOut = ImagingResample(imIn, xsize, ysize, filter);
|
||||
}
|
||||
|
||||
return PyImagingNew(imOut);
|
||||
|
|
|
@ -290,7 +290,7 @@ extern Imaging ImagingRotate(
|
|||
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 imIn, int xsize, int ysize, int filter);
|
||||
extern Imaging ImagingResample(Imaging imIn, int xsize, int ysize, int filter);
|
||||
extern Imaging ImagingTranspose(Imaging imOut, Imaging imIn);
|
||||
extern Imaging ImagingTransposeToNew(Imaging imIn);
|
||||
extern Imaging ImagingTransformPerspective(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* The Python Imaging Library
|
||||
* $Id$
|
||||
*
|
||||
* pilopen antialiasing support
|
||||
* Pillow image resamling support
|
||||
*
|
||||
* history:
|
||||
* 2002-03-09 fl Created (for PIL 1.1.3)
|
||||
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
/* resampling filters (from antialias.py) */
|
||||
|
||||
struct filter {
|
||||
float (*filter)(float x);
|
||||
float support;
|
||||
|
@ -42,15 +40,6 @@ static inline float antialias_filter(float x)
|
|||
|
||||
static struct filter ANTIALIAS = { antialias_filter, 3.0 };
|
||||
|
||||
static inline float nearest_filter(float x)
|
||||
{
|
||||
if (-0.5 <= x && x < 0.5)
|
||||
return 1.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static struct filter NEAREST = { nearest_filter, 0.5 };
|
||||
|
||||
static inline float bilinear_filter(float x)
|
||||
{
|
||||
if (x < 0.0)
|
||||
|
@ -106,7 +95,7 @@ static float inline i2f(int v) { return (float) v; }
|
|||
|
||||
|
||||
Imaging
|
||||
ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
|
||||
ImagingResampleHorizontal(Imaging imIn, int xsize, int filter)
|
||||
{
|
||||
ImagingSectionCookie cookie;
|
||||
Imaging imOut;
|
||||
|
@ -119,9 +108,6 @@ ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
|
|||
|
||||
/* check filter */
|
||||
switch (filter) {
|
||||
case IMAGING_TRANSFORM_NEAREST:
|
||||
filterp = &NEAREST;
|
||||
break;
|
||||
case IMAGING_TRANSFORM_ANTIALIAS:
|
||||
filterp = &ANTIALIAS;
|
||||
break;
|
||||
|
@ -152,7 +138,7 @@ ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
|
|||
/* maximum number of coofs */
|
||||
kmax = (int) ceil(support) * 2 + 1;
|
||||
|
||||
/* coefficient buffer (with rounding safety margin) */
|
||||
/* coefficient buffer */
|
||||
kk = malloc(xsize * kmax * sizeof(float));
|
||||
if ( ! kk)
|
||||
return (Imaging) ImagingError_MemoryError();
|
||||
|
@ -294,7 +280,7 @@ ImagingStretchHorizontal(Imaging imIn, int xsize, int filter)
|
|||
|
||||
|
||||
Imaging
|
||||
ImagingStretch(Imaging imIn, int xsize, int ysize, int filter)
|
||||
ImagingResample(Imaging imIn, int xsize, int ysize, int filter)
|
||||
{
|
||||
Imaging imTemp1, imTemp2, imTemp3;
|
||||
Imaging imOut;
|
||||
|
@ -306,7 +292,7 @@ ImagingStretch(Imaging imIn, int xsize, int ysize, int filter)
|
|||
return (Imaging) ImagingError_ModeError();
|
||||
|
||||
/* two-pass resize, first pass */
|
||||
imTemp1 = ImagingStretchHorizontal(imIn, xsize, filter);
|
||||
imTemp1 = ImagingResampleHorizontal(imIn, xsize, filter);
|
||||
if ( ! imTemp1)
|
||||
return NULL;
|
||||
|
||||
|
@ -317,7 +303,7 @@ ImagingStretch(Imaging imIn, int xsize, int ysize, int filter)
|
|||
return NULL;
|
||||
|
||||
/* second pass */
|
||||
imTemp3 = ImagingStretchHorizontal(imTemp2, ysize, filter);
|
||||
imTemp3 = ImagingResampleHorizontal(imTemp2, ysize, filter);
|
||||
ImagingDelete(imTemp2);
|
||||
if ( ! imTemp3)
|
||||
return NULL;
|
2
setup.py
2
setup.py
|
@ -26,7 +26,7 @@ _IMAGING = (
|
|||
"decode", "encode", "map", "display", "outline", "path")
|
||||
|
||||
_LIB_IMAGING = (
|
||||
"Access", "AlphaComposite", "Antialias", "Bands", "BitDecode", "Blend",
|
||||
"Access", "AlphaComposite", "Resample", "Bands", "BitDecode", "Blend",
|
||||
"Chops", "Convert", "ConvertYCbCr", "Copy", "Crc32", "Crop", "Dib", "Draw",
|
||||
"Effects", "EpsEncode", "File", "Fill", "Filter", "FliDecode",
|
||||
"Geometry", "GetBBox", "GifDecode", "GifEncode", "HexDecode",
|
||||
|
|
Loading…
Reference in New Issue
Block a user