Added: Simple editor - filters (read only yet)

This commit is contained in:
Jindra Petřík
2025-05-10 00:43:58 +02:00
parent 52ff9c56b3
commit b726c5ed08
13 changed files with 917 additions and 21 deletions
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.util.Objects;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -253,4 +254,72 @@ public class BEVELFILTER extends FILTER {
}
return result;
}
@Override
public int hashCode() {
int hash = 7;
hash = 47 * hash + Objects.hashCode(this.shadowColor);
hash = 47 * hash + Objects.hashCode(this.highlightColor);
hash = 47 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 47 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 47 * hash + (int) (Double.doubleToLongBits(this.angle) ^ (Double.doubleToLongBits(this.angle) >>> 32));
hash = 47 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32));
hash = 47 * hash + Float.floatToIntBits(this.strength);
hash = 47 * hash + (this.innerShadow ? 1 : 0);
hash = 47 * hash + (this.knockout ? 1 : 0);
hash = 47 * hash + (this.compositeSource ? 1 : 0);
hash = 47 * hash + (this.onTop ? 1 : 0);
hash = 47 * hash + this.passes;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final BEVELFILTER other = (BEVELFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (Double.doubleToLongBits(this.angle) != Double.doubleToLongBits(other.angle)) {
return false;
}
if (Double.doubleToLongBits(this.distance) != Double.doubleToLongBits(other.distance)) {
return false;
}
if (Float.floatToIntBits(this.strength) != Float.floatToIntBits(other.strength)) {
return false;
}
if (this.innerShadow != other.innerShadow) {
return false;
}
if (this.knockout != other.knockout) {
return false;
}
if (this.compositeSource != other.compositeSource) {
return false;
}
if (this.onTop != other.onTop) {
return false;
}
if (this.passes != other.passes) {
return false;
}
if (!Objects.equals(this.shadowColor, other.shadowColor)) {
return false;
}
return Objects.equals(this.highlightColor, other.highlightColor);
}
}
@@ -82,4 +82,40 @@ public class BLURFILTER extends FILTER {
public String toSvg(Document document, Element filtersElement, SVGExporter exporter, String in) {
return blurSvg(blurX, blurY, passes, document, filtersElement, exporter, in);
}
@Override
public int hashCode() {
int hash = 3;
hash = 37 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 37 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 37 * hash + this.passes;
hash = 37 * hash + this.reserved;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final BLURFILTER other = (BLURFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (this.passes != other.passes) {
return false;
}
return this.reserved == other.reserved;
}
}
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFArray;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -96,4 +97,27 @@ public class COLORMATRIXFILTER extends FILTER {
return result;
}
@Override
public int hashCode() {
int hash = 7;
hash = 67 * hash + Arrays.hashCode(this.matrix);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final COLORMATRIXFILTER other = (COLORMATRIXFILTER) obj;
return Arrays.equals(this.matrix, other.matrix);
}
}
@@ -23,7 +23,9 @@ import com.jpexs.decompiler.flash.types.annotations.Reserved;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -138,4 +140,60 @@ public class CONVOLUTIONFILTER extends FILTER {
return result;
}
@Override
public int hashCode() {
int hash = 3;
hash = 53 * hash + this.matrixX;
hash = 53 * hash + this.matrixY;
hash = 53 * hash + Float.floatToIntBits(this.divisor);
hash = 53 * hash + Float.floatToIntBits(this.bias);
hash = 53 * hash + Arrays.hashCode(this.matrix);
hash = 53 * hash + Objects.hashCode(this.defaultColor);
hash = 53 * hash + this.reserved;
hash = 53 * hash + (this.clamp ? 1 : 0);
hash = 53 * hash + (this.preserveAlpha ? 1 : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CONVOLUTIONFILTER other = (CONVOLUTIONFILTER) obj;
if (this.matrixX != other.matrixX) {
return false;
}
if (this.matrixY != other.matrixY) {
return false;
}
if (Float.floatToIntBits(this.divisor) != Float.floatToIntBits(other.divisor)) {
return false;
}
if (Float.floatToIntBits(this.bias) != Float.floatToIntBits(other.bias)) {
return false;
}
if (this.reserved != other.reserved) {
return false;
}
if (this.clamp != other.clamp) {
return false;
}
if (this.preserveAlpha != other.preserveAlpha) {
return false;
}
if (!Arrays.equals(this.matrix, other.matrix)) {
return false;
}
return Objects.equals(this.defaultColor, other.defaultColor);
}
}
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.util.Objects;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -114,4 +115,64 @@ public class DROPSHADOWFILTER extends FILTER {
public String toSvg(Document document, Element filtersElement, SVGExporter exporter, String in) {
return dropShadowSvg(distance, angle, dropShadowColor, innerShadow, knockout, compositeSource, blurX, blurY, strength, passes, document, filtersElement, exporter, in);
}
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + Objects.hashCode(this.dropShadowColor);
hash = 97 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 97 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 97 * hash + (int) (Double.doubleToLongBits(this.angle) ^ (Double.doubleToLongBits(this.angle) >>> 32));
hash = 97 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32));
hash = 97 * hash + Float.floatToIntBits(this.strength);
hash = 97 * hash + (this.innerShadow ? 1 : 0);
hash = 97 * hash + (this.knockout ? 1 : 0);
hash = 97 * hash + (this.compositeSource ? 1 : 0);
hash = 97 * hash + this.passes;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DROPSHADOWFILTER other = (DROPSHADOWFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (Double.doubleToLongBits(this.angle) != Double.doubleToLongBits(other.angle)) {
return false;
}
if (Double.doubleToLongBits(this.distance) != Double.doubleToLongBits(other.distance)) {
return false;
}
if (Float.floatToIntBits(this.strength) != Float.floatToIntBits(other.strength)) {
return false;
}
if (this.innerShadow != other.innerShadow) {
return false;
}
if (this.knockout != other.knockout) {
return false;
}
if (this.compositeSource != other.compositeSource) {
return false;
}
if (this.passes != other.passes) {
return false;
}
return Objects.equals(this.dropShadowColor, other.dropShadowColor);
}
}
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.util.Objects;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -196,4 +197,56 @@ public class GLOWFILTER extends FILTER {
return feCompositeResult;
}
}
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + Objects.hashCode(this.glowColor);
hash = 89 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 89 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 89 * hash + Float.floatToIntBits(this.strength);
hash = 89 * hash + (this.innerGlow ? 1 : 0);
hash = 89 * hash + (this.knockout ? 1 : 0);
hash = 89 * hash + (this.compositeSource ? 1 : 0);
hash = 89 * hash + this.passes;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final GLOWFILTER other = (GLOWFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (Float.floatToIntBits(this.strength) != Float.floatToIntBits(other.strength)) {
return false;
}
if (this.innerGlow != other.innerGlow) {
return false;
}
if (this.knockout != other.knockout) {
return false;
}
if (this.compositeSource != other.compositeSource) {
return false;
}
if (this.passes != other.passes) {
return false;
}
return Objects.equals(this.glowColor, other.glowColor);
}
}
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -155,4 +156,72 @@ public class GRADIENTBEVELFILTER extends FILTER {
public String toSvg(Document document, Element filtersElement, SVGExporter exporter, String in) {
return null; //NOT SUPPORTED
}
@Override
public int hashCode() {
int hash = 7;
hash = 37 * hash + Arrays.deepHashCode(this.gradientColors);
hash = 37 * hash + Arrays.hashCode(this.gradientRatio);
hash = 37 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 37 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 37 * hash + (int) (Double.doubleToLongBits(this.angle) ^ (Double.doubleToLongBits(this.angle) >>> 32));
hash = 37 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32));
hash = 37 * hash + Float.floatToIntBits(this.strength);
hash = 37 * hash + (this.innerShadow ? 1 : 0);
hash = 37 * hash + (this.knockout ? 1 : 0);
hash = 37 * hash + (this.compositeSource ? 1 : 0);
hash = 37 * hash + (this.onTop ? 1 : 0);
hash = 37 * hash + this.passes;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final GRADIENTBEVELFILTER other = (GRADIENTBEVELFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (Double.doubleToLongBits(this.angle) != Double.doubleToLongBits(other.angle)) {
return false;
}
if (Double.doubleToLongBits(this.distance) != Double.doubleToLongBits(other.distance)) {
return false;
}
if (Float.floatToIntBits(this.strength) != Float.floatToIntBits(other.strength)) {
return false;
}
if (this.innerShadow != other.innerShadow) {
return false;
}
if (this.knockout != other.knockout) {
return false;
}
if (this.compositeSource != other.compositeSource) {
return false;
}
if (this.onTop != other.onTop) {
return false;
}
if (this.passes != other.passes) {
return false;
}
if (!Arrays.deepEquals(this.gradientColors, other.gradientColors)) {
return false;
}
return Arrays.equals(this.gradientRatio, other.gradientRatio);
}
}
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -155,4 +156,72 @@ public class GRADIENTGLOWFILTER extends FILTER {
public String toSvg(Document document, Element filtersElement, SVGExporter exporter, String in) {
return null; //NOT SUPPORTED
}
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + Arrays.deepHashCode(this.gradientColors);
hash = 67 * hash + Arrays.hashCode(this.gradientRatio);
hash = 67 * hash + (int) (Double.doubleToLongBits(this.blurX) ^ (Double.doubleToLongBits(this.blurX) >>> 32));
hash = 67 * hash + (int) (Double.doubleToLongBits(this.blurY) ^ (Double.doubleToLongBits(this.blurY) >>> 32));
hash = 67 * hash + (int) (Double.doubleToLongBits(this.angle) ^ (Double.doubleToLongBits(this.angle) >>> 32));
hash = 67 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32));
hash = 67 * hash + Float.floatToIntBits(this.strength);
hash = 67 * hash + (this.innerShadow ? 1 : 0);
hash = 67 * hash + (this.knockout ? 1 : 0);
hash = 67 * hash + (this.compositeSource ? 1 : 0);
hash = 67 * hash + (this.onTop ? 1 : 0);
hash = 67 * hash + this.passes;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final GRADIENTGLOWFILTER other = (GRADIENTGLOWFILTER) obj;
if (Double.doubleToLongBits(this.blurX) != Double.doubleToLongBits(other.blurX)) {
return false;
}
if (Double.doubleToLongBits(this.blurY) != Double.doubleToLongBits(other.blurY)) {
return false;
}
if (Double.doubleToLongBits(this.angle) != Double.doubleToLongBits(other.angle)) {
return false;
}
if (Double.doubleToLongBits(this.distance) != Double.doubleToLongBits(other.distance)) {
return false;
}
if (Float.floatToIntBits(this.strength) != Float.floatToIntBits(other.strength)) {
return false;
}
if (this.innerShadow != other.innerShadow) {
return false;
}
if (this.knockout != other.knockout) {
return false;
}
if (this.compositeSource != other.compositeSource) {
return false;
}
if (this.onTop != other.onTop) {
return false;
}
if (this.passes != other.passes) {
return false;
}
if (!Arrays.deepEquals(this.gradientColors, other.gradientColors)) {
return false;
}
return Arrays.equals(this.gradientRatio, other.gradientRatio);
}
}