summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ScapePicPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/ScapePicPanel.java')
-rw-r--r--NET/worlds/console/ScapePicPanel.java239
1 files changed, 239 insertions, 0 deletions
diff --git a/NET/worlds/console/ScapePicPanel.java b/NET/worlds/console/ScapePicPanel.java
new file mode 100644
index 0000000..f376329
--- /dev/null
+++ b/NET/worlds/console/ScapePicPanel.java
@@ -0,0 +1,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
+ */ \ No newline at end of file