UnsharpMaskSpec.java
4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.scene7.is.util.Factory
* com.scene7.is.util.Writable
* com.scene7.is.util.serializers.Serializer
* org.jetbrains.annotations.NotNull
*/
package com.scene7.is.ps.provider;
import com.scene7.is.ps.provider.UnsharpMaskSpecSerializer;
import com.scene7.is.util.Factory;
import com.scene7.is.util.Writable;
import com.scene7.is.util.serializers.Serializer;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.jetbrains.annotations.NotNull;
public class UnsharpMaskSpec
implements Writable,
Serializable {
public final double amount;
public final double radius;
public final double threshold;
public final boolean lightnessOnly;
@NotNull
private static final Serializer<UnsharpMaskSpec> SERIALIZER = UnsharpMaskSpecSerializer.create();
@NotNull
public static Serializer<UnsharpMaskSpec> serializer() {
return SERIALIZER;
}
@NotNull
public static Builder builder() {
return new Builder();
}
public String toString() {
return "" + this.amount + "," + this.radius + ',' + this.threshold + ',' + this.lightnessOnly;
}
public void write(DataOutputStream out) throws IOException {
SERIALIZER.store((Object)this, (DataOutput)out);
}
@NotNull
public static UnsharpMaskSpec read(DataInputStream in) throws IOException {
return (UnsharpMaskSpec)SERIALIZER.load((DataInput)in);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
UnsharpMaskSpec that = (UnsharpMaskSpec)obj;
if (Double.compare(that.amount, this.amount) != 0) {
return false;
}
if (this.lightnessOnly != that.lightnessOnly) {
return false;
}
if (Double.compare(that.radius, this.radius) != 0) {
return false;
}
return Double.compare(that.threshold, this.threshold) == 0;
}
public int hashCode() {
long temp = this.amount != 0.0 ? Double.doubleToLongBits(this.amount) : 0;
int result = (int)(temp ^ temp >>> 32);
temp = this.radius != 0.0 ? Double.doubleToLongBits(this.radius) : 0;
result = 31 * result + (int)(temp ^ temp >>> 32);
temp = this.threshold != 0.0 ? Double.doubleToLongBits(this.threshold) : 0;
result = 31 * result + (int)(temp ^ temp >>> 32);
result = 31 * result + (this.lightnessOnly ? 1 : 0);
return result;
}
private UnsharpMaskSpec(@NotNull Builder builder) {
this.amount = builder.amount;
this.radius = builder.radius;
this.threshold = builder.threshold;
this.lightnessOnly = builder.lightnessOnly;
}
private void readObject(ObjectInputStream in) throws IOException {
throw new AssertionError();
}
private void writeObject(ObjectOutputStream out) throws IOException {
throw new AssertionError();
}
protected Object writeReplace() {
return new Serializable(){
private UnsharpMaskSpec value;
private void writeObject(ObjectOutputStream out) throws IOException {
SERIALIZER.store((Object)UnsharpMaskSpec.this, (DataOutput)out);
}
private void readObject(ObjectInputStream in) throws IOException {
this.value = (UnsharpMaskSpec)SERIALIZER.load((DataInput)in);
}
private Object readResolve() {
assert (this.value != null);
return this.value;
}
};
}
public static class Builder
implements Factory<UnsharpMaskSpec> {
private double amount;
private double radius;
private double threshold;
private boolean lightnessOnly;
public Builder setAmount(double amount) {
this.amount = amount;
return this;
}
public Builder setRadius(double radius) {
this.radius = radius;
return this;
}
public Builder setThreshold(double threshold) {
this.threshold = threshold;
return this;
}
public Builder setLightnessOnly(boolean lightnessOnly) {
this.lightnessOnly = lightnessOnly;
return this;
}
@NotNull
public UnsharpMaskSpec getProduct() {
return new UnsharpMaskSpec(this);
}
}
}