Added: Simple editor - convolution filter presets

This commit is contained in:
Jindra Petřík
2025-05-14 18:58:14 +02:00
parent 9f8a5cdcd0
commit 4da45d5cad
10 changed files with 444 additions and 40 deletions

View File

@@ -1204,7 +1204,7 @@ public class Timeline {
if (filters != null) {
for (FILTER filter : filters) {
img = filter.apply(img, unzoom, (int) deltaXMax, (int) deltaYMax, (int) Math.round(newWidth - 2 * deltaXMax), (int) Math.round(newHeight - 2 * deltaYMax));
img = filter.apply(img, unzoom, 0, 0, newWidth, newHeight);
}
}
if (blendMode > 1) {

View File

@@ -103,12 +103,12 @@ public class CONVOLUTIONFILTER extends FILTER {
@Override
public double getDeltaX() {
return ((matrixX - 1) >> 1) + 1;
return 0;
}
@Override
public double getDeltaY() {
return ((matrixY - 1) >> 1) + 1;
return 0;
}
@Override

View File

@@ -142,8 +142,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp {
float[] kvals = kernel.getKernelData(null);
for (int x = srcX - left; x < srcX + srcWidth + left; x++) {
for (int y = srcY - top; y < srcY + srcHeight + top; y++) {
for (int x = srcX; x < srcX + srcWidth; x++) {
for (int y = srcY; y < srcY + srcHeight; y++) {
float a;
if (preserveAlpha) {
boolean outSide = false;
@@ -157,12 +157,12 @@ public class ConvolveOp implements BufferedImageOp, RasterOp {
fsrcY = srcY;
outSide = true;
}
if (fsrcX >= srcX + srcWidth + 1) {
fsrcX = srcX + srcWidth;
if (fsrcX >= srcX + srcWidth) {
fsrcX = srcX + srcWidth - 1;
outSide = true;
}
if (fsrcY >= srcY + srcHeight + 1) {
fsrcY = srcY + srcHeight;
if (fsrcY >= srcY + srcHeight) {
fsrcY = srcY + srcHeight - 1;
outSide = true;
}
if (outSide) {
@@ -212,16 +212,16 @@ public class ConvolveOp implements BufferedImageOp, RasterOp {
nSrcX = srcX;
outSide = true;
}
if (nSrcX >= srcX + srcWidth + 1) {
nSrcX = srcX + srcWidth;
if (nSrcX >= srcX + srcWidth) {
nSrcX = srcX + srcWidth - 1;
outSide = true;
}
if (nSrcY < srcY) {
nSrcY = srcY;
outSide = true;
}
if (nSrcY >= srcY + srcHeight + 1) {
nSrcY = srcY + srcHeight;
if (nSrcY >= srcY + srcHeight) {
nSrcY = srcY + srcHeight - 1;
outSide = true;
}