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
235
236
237
238
239
|
/* */ package NET.worlds.console;
/* */
/* */ import java.awt.Container;
/* */ import java.awt.Dimension;
/* */ import java.awt.Frame;
/* */ import java.awt.Graphics;
/* */ import java.awt.Panel;
/* */ import java.awt.Point;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ScapePicPanel
/* */ extends Panel
/* */ {
/* */ private static final long serialVersionUID = -1019314311757410999L;
/* */ private static final int QUARTERED = 0;
/* */ private static final int UPPERLEFT = 1;
/* 43 */ private ScapePicImage image = null;
/* */
/* */ private int hWnd;
/* */
/* 47 */ private int drawMode = 0;
/* */
/* */
/* */
/* */ public ScapePicPanel()
/* */ {
/* 53 */ this(null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public ScapePicPanel(ScapePicImage image)
/* */ {
/* 64 */ setImage(image);
/* */ }
/* */
/* */
/* */
/* */ public void setImage(ScapePicImage image)
/* */ {
/* 71 */ this.image = image;
/* */ }
/* */
/* */
/* */
/* */
/* */ public void paint(Graphics g)
/* */ {
/* 79 */ drawBackground();
/* */
/* 81 */ super.paint(g);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void update(Graphics g)
/* */ {
/* 90 */ paint(g);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setQuartered()
/* */ {
/* 102 */ this.drawMode = 0;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setUpperLeft()
/* */ {
/* 113 */ this.drawMode = 1;
/* */ }
/* */
/* */
/* */
/* */
/* */ private void drawBackground()
/* */ {
/* 121 */ assert ((this.drawMode == 1) || (this.drawMode == 0));
/* */
/* 123 */ if (this.image == null) {
/* 124 */ return;
/* */ }
/* 126 */ Dimension size = getSize();
/* */
/* */
/* 129 */ assert (size != null);
/* 130 */ assert ((size.height >= 0) && (size.width >= 0));
/* */
/* */
/* 133 */ if (this.drawMode == 1) {
/* 134 */ for (int j = 0; j < size.height; j += this.image.getHeight()) {
/* 135 */ for (int i = 0; i < size.width; i += this.image.getWidth()) {
/* 136 */ drawScapePicImage(this.image, i, j, 0, 0, this.image.getWidth(),
/* 137 */ this.image.getHeight());
/* */ }
/* */ }
/* */ }
/* */
/* */
/* 143 */ if (this.drawMode == 0) {
/* 144 */ int cx = size.width / 2;
/* 145 */ int cy = size.height / 2;
/* */
/* 147 */ for (int j = 0; j < cy; j += this.image.getHeight()) {
/* 148 */ for (int i = 0; i < cx; i += this.image.getWidth()) {
/* 149 */ int endX = Math.min(cx - i, this.image.getWidth());
/* 150 */ int endY = Math.min(cy - j, this.image.getHeight());
/* 151 */ drawScapePicImage(this.image, i, j, 0, 0, endX, endY);
/* */ }
/* */ }
/* */
/* 155 */ for (int j = 0; j < cy; j += this.image.getHeight()) {
/* 156 */ for (int i = size.width; i > cx; i -= this.image.getWidth()) {
/* 157 */ int startX = Math.max(i - this.image.getWidth(), cx);
/* 158 */ int imageStartX = this.image.getWidth() - (i - startX);
/* 159 */ int endY = Math.min(cy - j, this.image.getHeight());
/* 160 */ drawScapePicImage(this.image, startX, j, imageStartX, 0, i -
/* 161 */ startX, endY);
/* */ }
/* */ }
/* */
/* 165 */ for (int j = size.height; j > cy; j -= this.image.getHeight()) {
/* 166 */ for (int i = 0; i < cx; i += this.image.getWidth()) {
/* 167 */ int endX = Math.min(cx - i, this.image.getWidth());
/* 168 */ int startY = Math.max(j - this.image.getHeight(), cy);
/* 169 */ int imageStartY = this.image.getHeight() - (j - startY);
/* 170 */ drawScapePicImage(this.image, i, startY, 0, imageStartY, endX, j -
/* 171 */ startY);
/* */ }
/* */ }
/* */
/* 175 */ for (int j = size.height; j > cy; j -= this.image.getHeight()) {
/* 176 */ for (int i = size.width; i > cx; i -= this.image.getWidth()) {
/* 177 */ int startX = Math.max(i - this.image.getWidth(), cx);
/* 178 */ int imageStartX = this.image.getWidth() - (i - startX);
/* 179 */ int startY = Math.max(j - this.image.getHeight(), cy);
/* 180 */ int imageStartY = this.image.getHeight() - (j - startY);
/* 181 */ drawScapePicImage(this.image, startX, startY, imageStartX,
/* 182 */ imageStartY, i - startX, j - startY);
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void drawScapePicImage(ScapePicImage image, int xDst, int yDst, int xSrc, int ySrc, int width, int height)
/* */ {
/* 201 */ if (this.hWnd == 0) {
/* 202 */ Point loc = locationInWindow();
/* 203 */ Dimension size = getSize();
/* 204 */ String title = getFrameTitle();
/* 205 */ assert (title != null);
/* 206 */ int hWndParent = Window.findWindow(title);
/* 207 */ assert (hWndParent != 0);
/* 208 */ this.hWnd = Window.findChildWindow(hWndParent, loc.x, loc.y, size.width,
/* 209 */ size.height);
/* 210 */ assert (this.hWnd != 0);
/* */ }
/* 212 */ ScapePicCanvas.bitBlt(this.hWnd, image.getDIB(), xDst, yDst, xSrc, ySrc,
/* 213 */ width, height);
/* */ }
/* */
/* */ private String getFrameTitle()
/* */ {
/* 218 */ for (Container c = getParent(); c != null; c = c.getParent())
/* 219 */ if ((c instanceof Frame))
/* 220 */ return ((Frame)c).getTitle();
/* 221 */ return null;
/* */ }
/* */
/* */ private Point locationInWindow()
/* */ {
/* 226 */ Point offset = getLocation();
/* 227 */ for (Container c = getParent(); c != null; c = c.getParent()) {
/* 228 */ Point move = c.getLocation();
/* 229 */ offset.translate(move.x, move.y);
/* */ }
/* 231 */ return offset;
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\ScapePicPanel.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|