home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class Photo extends Applet implements Runnable {
- // $FF: renamed from: d java.awt.Dimension
- Dimension field_0;
- // $FF: renamed from: ii java.awt.Image
- Image field_1;
- Thread thethread;
- final int numpos = 64;
- int pos;
- boolean dir;
- int iheight = -1;
- int iwidth = -1;
-
- public String getAppletInfo() {
- return "Image morpher - by Brian Postma";
- }
-
- public void init() {
- this.field_0 = ((Component)this).size();
- Graphics var2 = ((Component)this).getGraphics();
- this.field_1 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), ((Applet)this).getParameter("Image"));
- }
-
- public void paint(Graphics var1) {
- if (this.iwidth <= 0 || this.iheight <= 0) {
- var1.drawImage(this.field_1, 0, 0, this);
-
- while(this.iwidth == -1 || this.iheight == -1) {
- this.iwidth = this.field_1.getWidth(this);
- this.iheight = this.field_1.getHeight(this);
- }
- }
-
- int var4 = this.iheight / 2;
- int var2 = (int)((double)this.iheight * Math.sin((double)this.pos * 3.1415926535 / (double)64.0F));
- int var3 = var2 / 2;
- if (this.dir) {
- var1.drawImage(this.field_1, 0, var4 - var3, this.iwidth, var4 + var3, 0, this.iheight, this.iwidth, 0, this);
- } else {
- var1.drawImage(this.field_1, 0, (this.iheight - var2) / 2, this.iwidth, var2, this);
- }
-
- var1.setColor(Color.black);
- var1.fillRect(0, var4 - var3 - 6, this.iwidth, 5);
- var1.fillRect(0, var4 + var3, this.iwidth, 5);
- this.pos = (this.pos + 1) % 64;
- if (this.pos == 0) {
- this.dir ^= true;
- }
-
- }
-
- public void run() {
- Thread.currentThread().setPriority(10);
- Graphics var3 = ((Component)this).getGraphics();
- ((Component)this).setBackground(Color.black);
-
- while(true) {
- long var1 = System.currentTimeMillis();
-
- try {
- this.paint(var3);
- var1 += 20L;
- Thread.sleep(Math.max(0L, var1 - System.currentTimeMillis()));
- } catch (InterruptedException var4) {
- return;
- }
- }
- }
-
- public void start() {
- if (this.thethread == null) {
- this.thethread = new Thread(this);
- this.thethread.start();
- }
-
- }
-
- public void stop() {
- if (this.thethread != null) {
- this.thethread.stop();
- this.thethread = null;
- }
-
- }
- }
-