-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrawingArea.java
executable file
·234 lines (212 loc) · 4.88 KB
/
DrawingArea.java
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
public class DrawingArea extends NodeSub {
public static void initDrawingArea(int i, int j, int ai[])
{
pixels = ai;
width = j;
height = i;
setDrawingArea(i, 0, j, 0);
}
public static void defaultDrawingAreaSize()
{
topX = 0;
topY = 0;
bottomX = width;
bottomY = height;
centerX = bottomX - 1;
centerY = bottomX / 2;
}
public static void setDrawingArea(int i, int j, int k, int l)
{
if(j < 0)
j = 0;
if(l < 0)
l = 0;
if(k > width)
k = width;
if(i > height)
i = height;
topX = j;
topY = l;
bottomX = k;
bottomY = i;
centerX = bottomX - 1;
centerY = bottomX / 2;
anInt1387 = bottomY / 2;
}
public static void setAllPixelsToZero()
{
int i = width * height;
for(int j = 0; j < i; j++)
pixels[j] = 0;
}
public static void method335(int i, int j, int k, int l, int i1, int k1)
{
if(k1 < topX)
{
k -= topX - k1;
k1 = topX;
}
if(j < topY)
{
l -= topY - j;
j = topY;
}
if(k1 + k > bottomX)
k = bottomX - k1;
if(j + l > bottomY)
l = bottomY - j;
int l1 = 256 - i1;
int i2 = (i >> 16 & 0xff) * i1;
int j2 = (i >> 8 & 0xff) * i1;
int k2 = (i & 0xff) * i1;
int k3 = width - k;
int l3 = k1 + j * width;
for(int i4 = 0; i4 < l; i4++)
{
for(int j4 = -k; j4 < 0; j4++)
{
int l2 = (pixels[l3] >> 16 & 0xff) * l1;
int i3 = (pixels[l3] >> 8 & 0xff) * l1;
int j3 = (pixels[l3] & 0xff) * l1;
int k4 = ((i2 + l2 >> 8) << 16) + ((j2 + i3 >> 8) << 8) + (k2 + j3 >> 8);
pixels[l3++] = k4;
}
l3 += k3;
}
}
//int i, int y, int x, int color, int width
public static void drawPixels(int i, int j, int k, int l, int i1)
{
if(k < topX)
{
i1 -= topX - k;
k = topX;
}
if(j < topY)
{
i -= topY - j;
j = topY;
}
if(k + i1 > bottomX)
i1 = bottomX - k;
if(j + i > bottomY)
i = bottomY - j;
int k1 = width - i1;
int l1 = k + j * width;
for(int i2 = -i; i2 < 0; i2++)
{
for(int j2 = -i1; j2 < 0; j2++)
pixels[l1++] = l;
l1 += k1;
}
}
public static void fillPixels(int i, int j, int k, int l, int i1)
{
method339(i1, l, j, i);
method339((i1 + k) - 1, l, j, i);
method341(i1, l, k, i);
method341(i1, l, k, (i + j) - 1);
}
public static void method338(int i, int j, int k, int l, int i1, int j1)
{
method340(l, i1, i, k, j1);
method340(l, i1, (i + j) - 1, k, j1);
if(j >= 3)
{
method342(l, j1, k, i + 1, j - 2);
method342(l, (j1 + i1) - 1, k, i + 1, j - 2);
}
}
public static void method339(int i, int j, int k, int l)
{
if(i < topY || i >= bottomY)
return;
if(l < topX)
{
k -= topX - l;
l = topX;
}
if(l + k > bottomX)
k = bottomX - l;
int i1 = l + i * width;
for(int j1 = 0; j1 < k; j1++)
pixels[i1 + j1] = j;
}
private static void method340(int i, int j, int k, int l, int i1)
{
if(k < topY || k >= bottomY)
return;
if(i1 < topX)
{
j -= topX - i1;
i1 = topX;
}
if(i1 + j > bottomX)
j = bottomX - i1;
int j1 = 256 - l;
int k1 = (i >> 16 & 0xff) * l;
int l1 = (i >> 8 & 0xff) * l;
int i2 = (i & 0xff) * l;
int i3 = i1 + k * width;
for(int j3 = 0; j3 < j; j3++)
{
int j2 = (pixels[i3] >> 16 & 0xff) * j1;
int k2 = (pixels[i3] >> 8 & 0xff) * j1;
int l2 = (pixels[i3] & 0xff) * j1;
int k3 = ((k1 + j2 >> 8) << 16) + ((l1 + k2 >> 8) << 8) + (i2 + l2 >> 8);
pixels[i3++] = k3;
}
}
public static void method341(int i, int j, int k, int l)
{
if(l < topX || l >= bottomX)
return;
if(i < topY)
{
k -= topY - i;
i = topY;
}
if(i + k > bottomY)
k = bottomY - i;
int j1 = l + i * width;
for(int k1 = 0; k1 < k; k1++)
pixels[j1 + k1 * width] = j;
}
private static void method342(int i, int j, int k, int l, int i1) {
if(j < topX || j >= bottomX)
return;
if(l < topY) {
i1 -= topY - l;
l = topY;
}
if(l + i1 > bottomY)
i1 = bottomY - l;
int j1 = 256 - k;
int k1 = (i >> 16 & 0xff) * k;
int l1 = (i >> 8 & 0xff) * k;
int i2 = (i & 0xff) * k;
int i3 = j + l * width;
for(int j3 = 0; j3 < i1; j3++) {
int j2 = (pixels[i3] >> 16 & 0xff) * j1;
int k2 = (pixels[i3] >> 8 & 0xff) * j1;
int l2 = (pixels[i3] & 0xff) * j1;
int k3 = ((k1 + j2 >> 8) << 16) + ((l1 + k2 >> 8) << 8) + (i2 + l2 >> 8);
pixels[i3] = k3;
i3 += width;
}
}
DrawingArea() {}
public static int pixels[];
public static int width;
public static int height;
public static int topY;
public static int bottomY;
public static int topX;
public static int bottomX;
public static int centerX;
public static int centerY;
public static int anInt1387;
}