home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Netobjs / Install.exe / data1.cab / Components / AdBanner / UnrollTransition.class (.txt) < prev   
Encoding:
Java Class File  |  1998-12-16  |  2.2 KB  |  97 lines

  1. import java.awt.image.MemoryImageSource;
  2.  
  3. public class UnrollTransition extends BannerTransition {
  4.    static int[] fillPixels = new int[]{-1, -16777216, -16777216, -1};
  5.    int[] unrollAmount;
  6.    int location;
  7.  
  8.    public UnrollTransition() {
  9.       super.numOfFrames = 9;
  10.    }
  11.  
  12.    public void finishInit() {
  13.       float var1 = (float)super.imageHeight / (float)(super.numOfFrames + 1) / ((float)(super.numOfFrames + 2) / 2.0F);
  14.       int var2 = 0;
  15.       this.unrollAmount = new int[super.numOfFrames + 1];
  16.  
  17.       for(int var3 = 0; var3 <= super.numOfFrames; ++var3) {
  18.          this.unrollAmount[var3] = (int)(var1 * (float)(super.numOfFrames - var3 + 1));
  19.          var2 += this.unrollAmount[var3];
  20.       }
  21.  
  22.       if (var2 < 0) {
  23.          int var10002 = this.unrollAmount[0]--;
  24.       }
  25.  
  26.       super.delay = 220;
  27.       this.location = super.pixelsPerImage;
  28.       System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, 0, super.workPixels, 0, super.pixelsPerImage);
  29.  
  30.       for(int var4 = 0; var4 < super.numOfFrames; ++var4) {
  31.          this.location -= this.unrollAmount[var4] * super.imageWidth;
  32.  
  33.          try {
  34.             Thread.sleep(150L);
  35.          } catch (InterruptedException var6) {
  36.          }
  37.  
  38.          this.Unroll(var4);
  39.  
  40.          try {
  41.             Thread.sleep(100L);
  42.          } catch (InterruptedException var5) {
  43.          }
  44.  
  45.          super.frames[var4] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
  46.          super.owner.prepareImage(super.frames[var4], super.owner);
  47.          System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, this.location, super.workPixels, this.location, this.unrollAmount[var4] * super.imageWidth);
  48.       }
  49.  
  50.       super.workPixels = null;
  51.    }
  52.  
  53.    void Unroll(int var1) {
  54.       int var2 = super.imageWidth;
  55.       int[] var3 = new int[this.unrollAmount[var1]];
  56.  
  57.       for(int var4 = 0; var4 < this.unrollAmount[var1]; ++var4) {
  58.          var3[var4] = 4;
  59.       }
  60.  
  61.       var3[0] = 2;
  62.       if (this.unrollAmount[var1] > 1) {
  63.          var3[1] = 3;
  64.       }
  65.  
  66.       if (this.unrollAmount[var1] > 2) {
  67.          var3[this.unrollAmount[var1] - 1] = 2;
  68.       }
  69.  
  70.       if (this.unrollAmount[var1] > 3) {
  71.          var3[this.unrollAmount[var1] - 2] = 3;
  72.       }
  73.  
  74.       int var5 = 0;
  75.  
  76.       for(int var6 = this.location; var6 < this.location + this.unrollAmount[var1] * super.imageWidth; var6 += super.imageWidth) {
  77.          try {
  78.             System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, var6 - var2 + var3[var5], super.workPixels, var6, super.imageWidth - var3[var5]);
  79.             System.arraycopy(fillPixels, 0, super.workPixels, var6 + super.imageWidth - var3[var5], var3[var5]);
  80.             ++var5;
  81.             var2 += super.imageWidth + super.imageWidth;
  82.          } catch (ArrayIndexOutOfBoundsException var8) {
  83.             break;
  84.          }
  85.       }
  86.  
  87.       for(int var7 = this.location + super.imageWidth - 1; var7 > this.location; --var7) {
  88.          int[] var10000 = super.workPixels;
  89.          var10000[var7] |= -5592406;
  90.          var10000 = super.workPixels;
  91.          int var10001 = var7 + this.unrollAmount[var1];
  92.          var10000[var10001] &= -11184811;
  93.       }
  94.  
  95.    }
  96. }
  97.