change arguments order and names to match other functions

This commit is contained in:
homm 2014-10-25 17:16:14 +04:00
parent c802abe219
commit 274f0a14ba
3 changed files with 18 additions and 18 deletions

View File

@ -872,7 +872,7 @@ _gaussian_blur(ImagingObject* self, PyObject* args)
if (!imOut) if (!imOut)
return NULL; return NULL;
if ( ! ImagingGaussianBlur(imIn, imOut, radius, passes)) if ( ! ImagingGaussianBlur(imOut, imIn, radius, passes))
return NULL; return NULL;
return PyImagingNew(imOut); return PyImagingNew(imOut);
@ -1797,7 +1797,7 @@ _unsharp_mask(ImagingObject* self, PyObject* args)
if (!imOut) if (!imOut)
return NULL; return NULL;
if (!ImagingUnsharpMask(imIn, imOut, radius, percent, threshold)) if ( ! ImagingUnsharpMask(imOut, imIn, radius, percent, threshold))
return NULL; return NULL;
return PyImagingNew(imOut); return PyImagingNew(imOut);

View File

@ -263,7 +263,7 @@ extern Imaging ImagingFilter(
FLOAT32 offset, FLOAT32 divisor); FLOAT32 offset, FLOAT32 divisor);
extern Imaging ImagingFlipLeftRight(Imaging imOut, Imaging imIn); extern Imaging ImagingFlipLeftRight(Imaging imOut, Imaging imIn);
extern Imaging ImagingFlipTopBottom(Imaging imOut, Imaging imIn); extern Imaging ImagingFlipTopBottom(Imaging imOut, Imaging imIn);
extern Imaging ImagingGaussianBlur(Imaging im, Imaging imOut, float radius, extern Imaging ImagingGaussianBlur(Imaging imOut, Imaging imIn, float radius,
int passes); int passes);
extern Imaging ImagingGetBand(Imaging im, int band); extern Imaging ImagingGetBand(Imaging im, int band);
extern int ImagingGetBBox(Imaging im, int bbox[4]); extern int ImagingGetBBox(Imaging im, int bbox[4]);
@ -309,7 +309,7 @@ extern Imaging ImagingTransform(
ImagingTransformFilter filter, void* filter_data, ImagingTransformFilter filter, void* filter_data,
int fill); int fill);
extern Imaging ImagingUnsharpMask( extern Imaging ImagingUnsharpMask(
Imaging im, Imaging imOut, float radius, int percent, int threshold); Imaging imOut, Imaging im, float radius, int percent, int threshold);
extern Imaging ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n); extern Imaging ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n);
extern Imaging ImagingCopy2(Imaging imOut, Imaging imIn); extern Imaging ImagingCopy2(Imaging imOut, Imaging imIn);

View File

@ -19,7 +19,7 @@ static inline UINT8 clip(double in)
return (UINT8) (in + 0.5); return (UINT8) (in + 0.5);
} }
Imaging ImagingGaussianBlur(Imaging im, Imaging imOut, float radius, Imaging ImagingGaussianBlur(Imaging imOut, Imaging imIn, float radius,
int passes) int passes)
{ {
float sigma2, L, l, a; float sigma2, L, l, a;
@ -34,12 +34,12 @@ Imaging ImagingGaussianBlur(Imaging im, Imaging imOut, float radius,
a = (2 * l + 1) * (l * (l + 1) - 3 * sigma2); a = (2 * l + 1) * (l * (l + 1) - 3 * sigma2);
a /= 6 * (sigma2 - (l + 1) * (l + 1)); a /= 6 * (sigma2 - (l + 1) * (l + 1));
return ImagingBoxBlur(imOut, im, l + a, passes); return ImagingBoxBlur(imOut, imIn, l + a, passes);
} }
Imaging Imaging
ImagingUnsharpMask(Imaging im, Imaging imOut, float radius, int percent, ImagingUnsharpMask(Imaging imOut, Imaging imIn, float radius, int percent,
int threshold) int threshold)
{ {
ImagingSectionCookie cookie; ImagingSectionCookie cookie;
@ -61,22 +61,22 @@ ImagingUnsharpMask(Imaging im, Imaging imOut, float radius, int percent,
INT32 newPixel = 0; INT32 newPixel = 0;
if (strcmp(im->mode, "RGB") == 0) { if (strcmp(imIn->mode, "RGB") == 0) {
channels = 3; channels = 3;
} else if (strcmp(im->mode, "RGBA") == 0) { } else if (strcmp(imIn->mode, "RGBA") == 0) {
channels = 3; channels = 3;
} else if (strcmp(im->mode, "RGBX") == 0) { } else if (strcmp(imIn->mode, "RGBX") == 0) {
channels = 3; channels = 3;
} else if (strcmp(im->mode, "CMYK") == 0) { } else if (strcmp(imIn->mode, "CMYK") == 0) {
channels = 4; channels = 4;
} else if (strcmp(im->mode, "L") == 0) { } else if (strcmp(imIn->mode, "L") == 0) {
channels = 1; channels = 1;
} else } else
return ImagingError_ModeError(); return ImagingError_ModeError();
/* first, do a gaussian blur on the image, putting results in imOut /* first, do a gaussian blur on the image, putting results in imOut
temporarily */ temporarily */
result = ImagingGaussianBlur(im, imOut, radius, 3); result = ImagingGaussianBlur(imOut, imIn, radius, 3);
if (!result) if (!result)
return NULL; return NULL;
@ -87,19 +87,19 @@ ImagingUnsharpMask(Imaging im, Imaging imOut, float radius, int percent,
ImagingSectionEnter(&cookie); ImagingSectionEnter(&cookie);
if (strcmp(im->mode, "RGBX") == 0 || strcmp(im->mode, "RGBA") == 0) { if (strcmp(imIn->mode, "RGBX") == 0 || strcmp(imIn->mode, "RGBA") == 0) {
hasAlpha = 1; hasAlpha = 1;
} }
for (y = 0; y < im->ysize; y++) { for (y = 0; y < imIn->ysize; y++) {
if (channels == 1) { if (channels == 1) {
lineIn8 = im->image8[y]; lineIn8 = imIn->image8[y];
lineOut8 = imOut->image8[y]; lineOut8 = imOut->image8[y];
} else { } else {
lineIn = im->image32[y]; lineIn = imIn->image32[y];
lineOut = imOut->image32[y]; lineOut = imOut->image32[y];
} }
for (x = 0; x < im->xsize; x++) { for (x = 0; x < imIn->xsize; x++) {
newPixel = 0; newPixel = 0;
/* compare in/out pixels, apply sharpening */ /* compare in/out pixels, apply sharpening */
if (channels == 1) { if (channels == 1) {