IppMat3x2.java
6.62 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
* Decompiled with CFR 0_118.
*/
package com.scene7.is.ipp.messages;
import com.scene7.is.ipp.messages.Ipp;
import com.scene7.is.ipp.messages.IppDouble;
import com.scene7.is.ipp.messages.IppInt;
import com.scene7.is.ipp.messages.Offset;
import java.awt.geom.AffineTransform;
import java.io.IOException;
import java.io.Writer;
public class IppMat3x2 {
private double a_;
private double b_;
private double c_;
private double d_;
private double tx_;
private double ty_;
public IppMat3x2(double a, double b, double c, double d, double tx, double ty) {
this.a_ = a;
this.b_ = b;
this.c_ = c;
this.d_ = d;
this.tx_ = tx;
this.ty_ = ty;
}
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[");
buffer.append("a: ").append(String.valueOf(this.a_)).append(" ");
buffer.append("b: ").append(String.valueOf(this.b_)).append(" ");
buffer.append("c: ").append(String.valueOf(this.c_)).append(" ");
buffer.append("d: ").append(String.valueOf(this.d_)).append(" ");
buffer.append("tx: ").append(String.valueOf(this.tx_)).append(" ");
buffer.append("ty: ").append(String.valueOf(this.ty_)).append(" ");
buffer.append("]");
return buffer.toString();
}
public boolean equals(Object o) {
if (!(o instanceof IppMat3x2)) {
return false;
}
IppMat3x2 e = (IppMat3x2)o;
if (this.a_ != e.a_) {
return false;
}
if (this.b_ != e.b_) {
return false;
}
if (this.c_ != e.c_) {
return false;
}
if (this.d_ != e.d_) {
return false;
}
if (this.tx_ != e.tx_) {
return false;
}
if (this.ty_ != e.ty_) {
return false;
}
return true;
}
public static IppMat3x2 Unstuff(byte[] arr, Offset arrayPos) {
Ipp.Assert((arrayPos.val & 7) == 0, "IppMat3x2 align");
double a = IppDouble.Unstuff(arr, arrayPos);
double b = IppDouble.Unstuff(arr, arrayPos);
double c = IppDouble.Unstuff(arr, arrayPos);
double d = IppDouble.Unstuff(arr, arrayPos);
double tx = IppDouble.Unstuff(arr, arrayPos);
double ty = IppDouble.Unstuff(arr, arrayPos);
return new IppMat3x2(a, b, c, d, tx, ty);
}
public static IppMat3x2[] UnstuffArray(byte[] arr, Offset arrayPos) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppMat3x2 alignemt");
int count = IppInt.Unstuff(arr, arrayPos);
int size = IppInt.Unstuff(arr, arrayPos);
Ipp.Assert(count == 0 || size >= 48, "IppMat3x2 count");
Offset roff = new Offset(IppInt.Unstuff(arr, arrayPos));
Offset loff = new Offset(roff.val);
IppMat3x2[] result = new IppMat3x2[count];
for (int i = 0; i < count; ++i) {
loff.val = roff.val;
result[i] = IppMat3x2.Unstuff(arr, loff);
roff.val += size;
}
return result;
}
public static IppMat3x2[] UnstuffFixedArray(byte[] arr, Offset arrayPos, int count) {
IppMat3x2[] result = new IppMat3x2[count];
for (int i = 0; i < count; ++i) {
result[i] = IppMat3x2.Unstuff(arr, arrayPos);
}
return result;
}
public static void Stuff(byte[] arr, Offset arrayPos, Offset varPos, IppMat3x2 val) {
Ipp.Assert((arrayPos.val & 7) == 0, "IppMat3x2 align");
if (val != null) {
IppDouble.Stuff(arr, arrayPos, varPos, val.a());
IppDouble.Stuff(arr, arrayPos, varPos, val.b());
IppDouble.Stuff(arr, arrayPos, varPos, val.c());
IppDouble.Stuff(arr, arrayPos, varPos, val.d());
IppDouble.Stuff(arr, arrayPos, varPos, val.tx());
IppDouble.Stuff(arr, arrayPos, varPos, val.ty());
} else {
Ipp.StuffNullBytes(arr, arrayPos, 48);
}
}
public static void StuffArray(byte[] arr, Offset arrayPos, Offset varPos, IppMat3x2[] val) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppMat3x2 stuffarray align");
int len = val != null ? val.length : 0;
IppInt.Stuff(arr, arrayPos, varPos, len);
IppInt.Stuff(arr, arrayPos, varPos, 48);
Ipp.StuffOffset(arr, arrayPos, varPos, len > 0 ? 8 : 1);
Offset varvarPos = new Offset(varPos.val + 48 * len);
for (int i = 0; i < len; ++i) {
IppMat3x2.Stuff(arr, varPos, varvarPos, val[i]);
}
varPos.val = varvarPos.val;
}
public static void StuffFixedArray(byte[] arr, Offset arrayPos, Offset varPos, int count, IppMat3x2[] val) {
Ipp.Assert(val.length == count, "IppMat3x2 count");
for (int i = 0; i < count; ++i) {
IppMat3x2.Stuff(arr, arrayPos, varPos, val[i]);
}
}
public static void Print(Writer tf, String label, IppMat3x2 it) throws IOException {
String ll = label + "IppMat3x2: ";
if (it == null) {
tf.write(ll + "NULL!!\n");
return;
}
tf.write(ll + "\n");
IppDouble.Print(tf, ll + "a: ", it.a());
IppDouble.Print(tf, ll + "b: ", it.b());
IppDouble.Print(tf, ll + "c: ", it.c());
IppDouble.Print(tf, ll + "d: ", it.d());
IppDouble.Print(tf, ll + "tx: ", it.tx());
IppDouble.Print(tf, ll + "ty: ", it.ty());
}
public static void PrintArray(Writer tf, String label, IppMat3x2[] it) throws IOException {
String ll = label + "IppMat3x2 Array, length: ";
tf.write(ll);
if (it == null) {
tf.write("NULL!!!\n");
return;
}
tf.write("" + it.length + "\n");
for (int i = 0; i < it.length; ++i) {
ll = label + "IppMat3x2[" + String.valueOf(i) + "]: ";
IppMat3x2.Print(tf, ll, it[i]);
}
}
public double a() {
return this.a_;
}
public double b() {
return this.b_;
}
public double c() {
return this.c_;
}
public double d() {
return this.d_;
}
public double tx() {
return this.tx_;
}
public double ty() {
return this.ty_;
}
public IppMat3x2(AffineTransform x) {
double[] flat = new double[6];
x.getMatrix(flat);
this.a_ = flat[0];
this.b_ = flat[1];
this.c_ = flat[2];
this.d_ = flat[3];
this.tx_ = flat[4];
this.ty_ = flat[5];
}
public AffineTransform xform() {
double[] flat = new double[]{this.a_, this.b_, this.c_, this.d_, this.tx_, this.ty_};
AffineTransform x = new AffineTransform(flat);
return x;
}
}