Package quicktime.std.anim

Source Code of quicktime.std.anim.Sprite

/*     */ package quicktime.std.anim;
/*     */
/*     */ import java.awt.Dimension;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTObject;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.jdirect.QTNative;
/*     */ import quicktime.qd.QDDimension;
/*     */ import quicktime.qd.QDPoint;
/*     */ import quicktime.std.StdQTException;
/*     */ import quicktime.std.image.GraphicsMode;
/*     */ import quicktime.std.image.ImageDescription;
/*     */ import quicktime.std.image.Matrix;
/*     */ import quicktime.util.ByteEncodedImage;
/*     */ import quicktime.util.EncodedImage;
/*     */ import quicktime.util.IntEncodedImage;
/*     */ import quicktime.util.RawEncodedImage;
/*     */
/*     */ public final class Sprite extends QTObject
/*     */ {
/*  26 */   private static boolean apriori = QTSession.apriori();
/*     */   private SpriteWorld sw;
/*     */
/*     */   Sprite(int paramInt, SpriteWorld paramSpriteWorld)
/*     */     throws QTException
/*     */   {
/*  34 */     super(paramInt);
/*  35 */     this.sw = paramSpriteWorld;
/*     */   }
/*     */
/*     */   public Sprite(SpriteWorld paramSpriteWorld, ImageDescription paramImageDescription, EncodedImage paramEncodedImage, Matrix paramMatrix, boolean paramBoolean, int paramInt)
/*     */     throws QTException
/*     */   {
/*  51 */     super(allocate(paramSpriteWorld, paramImageDescription, paramEncodedImage, paramMatrix, paramBoolean, paramInt));
/*  52 */     this.sw = paramSpriteWorld;
/*     */   }
/*     */
/*     */   private static int allocate(SpriteWorld paramSpriteWorld, ImageDescription paramImageDescription, EncodedImage paramEncodedImage, Matrix paramMatrix, boolean paramBoolean, int paramInt) throws StdQTException
/*     */   {
/*  57 */     byte b = (byte)(paramBoolean ? 1 : 0);
/*  58 */     int[] arrayOfInt = new int[1];
/*  59 */     int i = -50;
/*  60 */     synchronized (QTNative.globalsLock) {
/*  61 */       if ((paramEncodedImage instanceof ByteEncodedImage)) {
/*  62 */         i = NewSprite(arrayOfInt, QTObject.ID(paramSpriteWorld), QTObject.ID(paramImageDescription), ((ByteEncodedImage)paramEncodedImage).getBytes(), paramMatrix.getBytes(), b, (short)paramInt);
/*     */       }
/*  69 */       else if ((paramEncodedImage instanceof IntEncodedImage)) {
/*  70 */         i = NewSprite(arrayOfInt, QTObject.ID(paramSpriteWorld), QTObject.ID(paramImageDescription), ((IntEncodedImage)paramEncodedImage).getInts(), paramMatrix.getBytes(), b, (short)paramInt);
/*     */       }
/*  77 */       else if ((paramEncodedImage instanceof RawEncodedImage)) {
/*  78 */         i = NewSprite(arrayOfInt, QTObject.ID(paramSpriteWorld), QTObject.ID(paramImageDescription), QTObject.ID((RawEncodedImage)paramEncodedImage), paramMatrix.getBytes(), b, (short)paramInt);
/*     */       }
/*     */
/*  85 */       StdQTException.checkError(i);
/*     */     }
/*  87 */     return arrayOfInt[0];
/*     */   }
/*     */
/*     */   public SpriteWorld getSpriteWorld()
/*     */   {
/*  96 */     return this.sw;
/*     */   }
/*     */
/*     */   public void invalidate()
/*     */   {
/* 104 */     synchronized (QTNative.globalsLock) {
/* 105 */       InvalidateSprite(_ID());
/*     */     }
/*     */   }
/*     */
/*     */   public boolean hitTest(int paramInt, QDPoint paramQDPoint)
/*     */     throws StdQTException
/*     */   {
/* 117 */     byte[] arrayOfByte = { 0 };
/* 118 */     synchronized (QTNative.globalsLock) {
/* 119 */       StdQTException.checkError(SpriteHitTest(_ID(), paramInt, paramQDPoint.getPoint(), arrayOfByte));
/*     */     }
/*     */
/* 124 */     return arrayOfByte[0] != 0;
/*     */   }
/*     */
/*     */   public Matrix getMatrix()
/*     */     throws StdQTException
/*     */   {
/* 133 */     Matrix localMatrix = new Matrix();
/* 134 */     synchronized (QTNative.globalsLock) {
/* 135 */       int i = GetSpriteProperty(_ID(), 1, localMatrix.getBytes());
/*     */
/* 138 */       StdQTException.checkError(i);
/*     */     }
/* 140 */     return localMatrix;
/*     */   }
/*     */
/*     */   public void setMatrix(Matrix paramMatrix)
/*     */     throws StdQTException
/*     */   {
/* 149 */     synchronized (QTNative.globalsLock) {
/* 150 */       int i = SetSpriteProperty(_ID(), 1, paramMatrix.getBytes());
/*     */
/* 153 */       StdQTException.checkError(i);
/*     */     }
/*     */   }
/*     */
/*     */   public ImageDescription getImageDescription()
/*     */     throws StdQTException
/*     */   {
/* 163 */     return ImageDescription.fromSprite(this);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Dimension getInitialSize()
/*     */     throws StdQTException
/*     */   {
/* 175 */     int[] arrayOfInt = { 0 };
/* 176 */     synchronized (QTNative.globalsLock) {
/* 177 */       int i = GetSpriteProperty(_ID(), 2, arrayOfInt);
/* 178 */       StdQTException.checkError(i);
/*     */     }
/* 180 */     return new Dimension(getShortFromHandle(arrayOfInt[0], 32), getShortFromHandle(arrayOfInt[0], 34));
/*     */   }
/*     */
/*     */   public QDDimension getOriginalSize()
/*     */     throws StdQTException
/*     */   {
/* 191 */     int[] arrayOfInt = { 0 };
/* 192 */     synchronized (QTNative.globalsLock) {
/* 193 */       int i = GetSpriteProperty(_ID(), 2, arrayOfInt);
/* 194 */       StdQTException.checkError(i);
/*     */     }
/* 196 */     return new QDDimension(getShortFromHandle(arrayOfInt[0], 32), getShortFromHandle(arrayOfInt[0], 34));
/*     */   }
/*     */
/*     */   public void setImageDescription(ImageDescription paramImageDescription)
/*     */     throws StdQTException
/*     */   {
/* 206 */     int[] arrayOfInt = { 0 };
/* 207 */     synchronized (QTNative.globalsLock) {
/* 208 */       int i = GetSpriteProperty(_ID(), 2, arrayOfInt);
/* 209 */       StdQTException.checkError(i);
/*     */
/* 211 */       if (arrayOfInt[0] == QTObject.ID(paramImageDescription))
/* 212 */         return;
/* 213 */       i = SetSpriteProperty(_ID(), 2, QTObject.ID(paramImageDescription));
/*     */
/* 216 */       StdQTException.checkError(i);
/*     */     }
/*     */   }
/*     */
/*     */   public RawEncodedImage getImageData()
/*     */     throws StdQTException
/*     */   {
/* 226 */     return RawEncodedImage.fromSprite(this);
/*     */   }
/*     */
/*     */   public void setImageData(EncodedImage paramEncodedImage)
/*     */     throws StdQTException
/*     */   {
/* 238 */     int i = -50;
/* 239 */     synchronized (QTNative.globalsLock) {
/* 240 */       if ((paramEncodedImage instanceof ByteEncodedImage)) {
/* 241 */         i = SetSpriteProperty(_ID(), 3, ((ByteEncodedImage)paramEncodedImage).getBytes());
/*     */       }
/* 244 */       else if ((paramEncodedImage instanceof IntEncodedImage)) {
/* 245 */         i = SetSpriteProperty(_ID(), 3, ((IntEncodedImage)paramEncodedImage).getInts());
/*     */       }
/* 248 */       else if ((paramEncodedImage instanceof RawEncodedImage)) {
/* 249 */         i = SetSpriteProperty(_ID(), 3, QTObject.ID((RawEncodedImage)paramEncodedImage));
/*     */       }
/*     */
/* 252 */       StdQTException.checkError(i);
/*     */     }
/* 254 */     setImageDataSize(paramEncodedImage.getSize());
/*     */   }
/*     */
/*     */   public boolean setImageDataIfDifferent(EncodedImage paramEncodedImage)
/*     */     throws StdQTException
/*     */   {
/* 271 */     int[] arrayOfInt = { 0 };
/* 272 */     int i = 0;
/* 273 */     synchronized (QTNative.globalsLock) {
/* 274 */       i = GetSpriteProperty(_ID(), 3, arrayOfInt);
/* 275 */       StdQTException.checkError(i);
/*     */     }
/* 277 */     i = -50;
/* 278 */     synchronized (QTNative.globalsLock) {
/* 279 */       if ((paramEncodedImage instanceof ByteEncodedImage)) {
/* 280 */         i = SetSpriteProperty(_ID(), 3, ((ByteEncodedImage)paramEncodedImage).getBytes());
/*     */       }
/* 283 */       else if ((paramEncodedImage instanceof IntEncodedImage)) {
/* 284 */         i = SetSpriteProperty(_ID(), 3, ((IntEncodedImage)paramEncodedImage).getInts());
/*     */       }
/* 287 */       else if ((paramEncodedImage instanceof RawEncodedImage)) {
/* 288 */         i = SetSpriteProperty(_ID(), 3, QTObject.ID((RawEncodedImage)paramEncodedImage));
/*     */       }
/*     */
/* 291 */       StdQTException.checkError(i);
/*     */     }
/* 293 */     ??? = new int[] { 0 };
/* 294 */     GetSpriteProperty(_ID(), 3, (int[])???);
/* 295 */     if (???[0] != arrayOfInt[0]) {
/* 296 */       setImageDataSize(paramEncodedImage.getSize());
/* 297 */       return true;
/*     */     }
/* 299 */     return false;
/*     */   }
/*     */
/*     */   public boolean getVisible()
/*     */     throws StdQTException
/*     */   {
/* 308 */     byte[] arrayOfByte = { 0 };
/* 309 */     synchronized (QTNative.globalsLock) {
/* 310 */       int i = GetSpriteProperty(_ID(), 4, arrayOfByte);
/* 311 */       StdQTException.checkError(i);
/*     */     }
/* 313 */     return arrayOfByte[0] != 0;
/*     */   }
/*     */
/*     */   public void setVisible(boolean paramBoolean)
/*     */     throws StdQTException
/*     */   {
/* 322 */     int i = (byte)(paramBoolean ? 1 : 0);
/* 323 */     synchronized (QTNative.globalsLock) {
/* 324 */       int j = SetSpriteProperty(_ID(), 4, (short)i);
/* 325 */       StdQTException.checkError(j);
/*     */     }
/*     */   }
/*     */
/*     */   public int getLayer()
/*     */     throws StdQTException
/*     */   {
/* 335 */     short[] arrayOfShort = { 0 };
/* 336 */     synchronized (QTNative.globalsLock) {
/* 337 */       int i = GetSpriteProperty(_ID(), 5, arrayOfShort);
/* 338 */       StdQTException.checkError(i);
/*     */     }
/* 340 */     return arrayOfShort[0];
/*     */   }
/*     */
/*     */   public void setLayer(int paramInt)
/*     */     throws StdQTException
/*     */   {
/* 349 */     synchronized (QTNative.globalsLock) {
/* 350 */       int i = SetSpriteProperty(_ID(), 5, (short)paramInt);
/* 351 */       StdQTException.checkError(i);
/*     */     }
/*     */   }
/*     */
/*     */   public GraphicsMode getGraphicsMode()
/*     */     throws StdQTException
/*     */   {
/* 361 */     GraphicsMode localGraphicsMode = new GraphicsMode();
/* 362 */     synchronized (QTNative.globalsLock) {
/* 363 */       int i = GetSpriteProperty(_ID(), 6, localGraphicsMode.getBytes());
/* 364 */       StdQTException.checkError(i);
/*     */     }
/* 366 */     return localGraphicsMode;
/*     */   }
/*     */
/*     */   public void setGraphicsMode(GraphicsMode paramGraphicsMode)
/*     */     throws StdQTException
/*     */   {
/* 375 */     synchronized (QTNative.globalsLock) {
/* 376 */       if (paramGraphicsMode != null) {
/* 377 */         int i = SetSpriteProperty(_ID(), 6, paramGraphicsMode.getBytes());
/* 378 */         StdQTException.checkError(i);
/*     */       }
/*     */     }
/*     */   }
/*     */
/*     */   public int getImageDataSize()
/*     */     throws StdQTException
/*     */   {
/* 389 */     int[] arrayOfInt = { 0 };
/* 390 */     synchronized (QTNative.globalsLock) {
/* 391 */       int i = GetSpriteProperty(_ID(), 7, arrayOfInt);
/* 392 */       StdQTException.checkError(i);
/*     */     }
/* 394 */     return arrayOfInt[0];
/*     */   }
/*     */
/*     */   public void setImageDataSize(int paramInt)
/*     */     throws StdQTException
/*     */   {
/* 404 */     synchronized (QTNative.globalsLock) {
/* 405 */       int i = SetSpriteProperty(_ID(), 7, paramInt);
/* 406 */       StdQTException.checkError(i);
/*     */     }
/*     */   }
/*     */
/*     */   public void remove()
/*     */   {
/* 418 */     synchronized (QTNative.globalsLock) {
/* 419 */       DisposeSprite(_ID());
/*     */     }
/* 421 */     this.sw = null;
/*     */     try {
/* 423 */       finalize();
/*     */     }
/*     */     catch (Throwable localThrowable)
/*     */     {
/*     */     }
/*     */   }
/*     */
/*     */   private static native short NewSprite(int[] paramArrayOfInt, int paramInt1, int paramInt2, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte paramByte, short paramShort);
/*     */
/*     */   private static native short NewSprite(int[] paramArrayOfInt1, int paramInt1, int paramInt2, int[] paramArrayOfInt2, byte[] paramArrayOfByte, byte paramByte, short paramShort);
/*     */
/*     */   private static native short NewSprite(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, byte[] paramArrayOfByte, byte paramByte, short paramShort);
/*     */
/*     */   private static native void InvalidateSprite(int paramInt);
/*     */
/*     */   private static native short SpriteHitTest(int paramInt1, int paramInt2, int paramInt3, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short GetSpriteProperty(int paramInt1, int paramInt2, short[] paramArrayOfShort);
/*     */
/*     */   private static native short GetSpriteProperty(int paramInt1, int paramInt2, int[] paramArrayOfInt);
/*     */
/*     */   private static native short GetSpriteProperty(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/*     */
/*     */   private static native short SetSpriteProperty(int paramInt1, int paramInt2, short[] paramArrayOfShort);
/*     */
/*     */   private static native short SetSpriteProperty(int paramInt1, int paramInt2, short paramShort);
/*     */
/*     */   private static native short SetSpriteProperty(int paramInt1, int paramInt2, int[] paramArrayOfInt);
/*     */
/*     */   private static native short SetSpriteProperty(int paramInt1, int paramInt2, int paramInt3);
/*     */
/*     */   private static native short SetSpriteProperty(int paramInt1, int paramInt2, byte[] paramArrayOfByte);
/*     */
/*     */   private static native void DisposeSprite(int paramInt);
/*     */
/*     */   private static native short getShortFromHandle(int paramInt1, int paramInt2);
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.std.anim.Sprite
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.std.anim.Sprite

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.