ImageDataUtil.gaussianBlur strength

This commit is contained in:
imcasper
2018-11-13 18:25:00 +02:00
committed by Joshua Granick
parent 263e73922e
commit 37b2eb014b

View File

@@ -783,25 +783,27 @@ class ImageDataUtil {
var x: Int; var x: Int;
var y: Int; var y: Int;
if (offset <= 0) { if (strength > 1) {
y = 0; if (offset <= 0) {
while (y < h) { y = 0;
x = 0; while (y < h) {
while (x < w) { x = 0;
translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); while (x < w) {
x += 1; translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength);
x += 1;
}
y += 1;
} }
y += 1; } else {
} y = h-1;
} else { while (y >= 0 ) {
y = h-1; x = w-1;
while (y >= 0 ) { while (x >= 0) {
x = w-1; translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength);
while (x >= 0) { x -= 1;
translatePixel(imgB, sourceImage.rect, image.rect, destPoint, x, y, strength); }
x -= 1; y -= 1;
} }
y -= 1;
} }
} }
@@ -813,8 +815,7 @@ class ImageDataUtil {
if (imagePremultiplied) image.premultiplied = true; if (imagePremultiplied) image.premultiplied = true;
if (sourceImagePremultiplied) sourceImage.premultiplied = true; if (sourceImagePremultiplied) sourceImage.premultiplied = true;
if (imgA == sourceImage.data) return sourceImage; return sourceImage;
return image;
} }