Package quicktime.app.anim

Source Code of quicktime.app.anim.TwoDSprite

/*     */ package quicktime.app.anim;
/*     */
/*     */ import java.awt.Dimension;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.app.QTAppException;
/*     */ import quicktime.app.actions.Notifier;
/*     */ import quicktime.app.actions.NotifyListener;
/*     */ import quicktime.app.display.Layerable;
/*     */ import quicktime.app.image.Compositable;
/*     */ import quicktime.app.image.ImageDataSequence;
/*     */ import quicktime.app.image.ImageSettable;
/*     */ import quicktime.app.image.ImageSpec;
/*     */ import quicktime.app.image.Transformable;
/*     */ import quicktime.app.time.Timer;
/*     */ import quicktime.qd.QDDimension;
/*     */ import quicktime.qd.QDGraphics;
/*     */ import quicktime.qd.QDPoint;
/*     */ import quicktime.std.anim.Sprite;
/*     */ import quicktime.std.anim.SpriteWorld;
/*     */ import quicktime.std.image.GraphicsMode;
/*     */ import quicktime.std.image.ImageDescription;
/*     */ import quicktime.std.image.Matrix;
/*     */ import quicktime.util.EncodedImage;
/*     */ import quicktime.util.RawEncodedImage;
/*     */
/*     */ /** @deprecated */
/*     */ public class TwoDSprite
/*     */   implements NotifyListener, Transformable, Layerable, ImageSettable, Compositable
/*     */ {
/*  50 */   private static EncodedImage ei = null;
/*     */
/*  57 */   private static ImageDescription id = null;
/*     */   private transient Sprite sprite;
/*     */   private TwoDSpriteInfo info;
/*     */   private transient ImageSpec is;
/*     */   transient SWCompositor spriteIsCompositor;
/*     */   private transient SWCompositor parentCompositor;
/*     */   private transient Timer parentsTimer;
/*     */   protected String label;
/*     */
/*     */   private static EncodedImage getDummyEI()
/*     */     throws QTException
/*     */   {
/*  52 */     if (ei == null)
/*  53 */       ei = new RawEncodedImage(4, true);
/*  54 */     return ei;
/*     */   }
/*     */
/*     */   private static ImageDescription getDummyID() throws QTException
/*     */   {
/*  59 */     if (id == null) {
/*  60 */       if (QTSession.isCurrentOS(2)) {
/*  61 */         id = new ImageDescription(32);
/*  62 */         id.setDepth(0);
/*     */       } else {
/*  64 */         id = new ImageDescription(1918990112);
/*  65 */         id.setDepth(32);
/*     */       }
/*     */
/*  68 */       id.setSpatialQuality(512);
/*  69 */       id.setWidth(1);
/*  70 */       id.setHeight(1);
/*  71 */       id.setHRes(72.0F);
/*  72 */       id.setVRes(72.0F);
/*  73 */       id.setDataSize(4);
/*  74 */       id.setFrameCount(1);
/*  75 */       id.setClutID(-1);
/*     */     }
/*  77 */     return id;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(TwoDSpriteInfo paramTwoDSpriteInfo)
/*     */     throws QTException
/*     */   {
/*  88 */     this.info = paramTwoDSpriteInfo;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite()
/*     */     throws QTException
/*     */   {
/*  96 */     this(new Matrix(), 1, null);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(Matrix paramMatrix, int paramInt, GraphicsMode paramGraphicsMode)
/*     */     throws QTException
/*     */   {
/* 111 */     this.info = new TwoDSpriteInfo(getDummyEI(), getDummyID(), paramMatrix, false, paramInt, paramGraphicsMode);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(ImageSpec paramImageSpec, Matrix paramMatrix, boolean paramBoolean, int paramInt)
/*     */     throws QTException
/*     */   {
/* 125 */     this.info = new TwoDSpriteInfo(paramImageSpec.getImage(), paramImageSpec.getDescription(), paramMatrix, paramBoolean, paramInt);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(ImageSpec paramImageSpec, Matrix paramMatrix, boolean paramBoolean, int paramInt, GraphicsMode paramGraphicsMode)
/*     */     throws QTException
/*     */   {
/* 141 */     this.info = new TwoDSpriteInfo(paramImageSpec.getImage(), paramImageSpec.getDescription(), paramMatrix, paramBoolean, paramInt, paramGraphicsMode);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(ImageDataSequence paramImageDataSequence, int paramInt1, Matrix paramMatrix, boolean paramBoolean, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 157 */     this.info = new TwoDSpriteInfo(paramImageDataSequence.getImage(paramInt1), paramImageDataSequence.getDescription(), paramMatrix, paramBoolean, paramInt2);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSprite(ImageDataSequence paramImageDataSequence, int paramInt1, Matrix paramMatrix, boolean paramBoolean, int paramInt2, GraphicsMode paramGraphicsMode)
/*     */     throws QTException
/*     */   {
/* 175 */     this.info = new TwoDSpriteInfo(paramImageDataSequence.getImage(paramInt1), paramImageDataSequence.getDescription(), paramMatrix, paramBoolean, paramInt2, paramGraphicsMode);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   TwoDSprite(Sprite paramSprite)
/*     */     throws QTException
/*     */   {
/* 184 */     this.sprite = paramSprite;
/* 185 */     this.info = new TwoDSpriteInfo(this.sprite.getImageData(), this.sprite.getImageDescription(), this.sprite.getMatrix(), this.sprite.getVisible(), this.sprite.getLayer());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setLabel(String paramString)
/*     */   {
/* 210 */     this.label = paramString;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public String getLabel()
/*     */   {
/* 218 */     return this.label;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean setNotifier(Notifier paramNotifier)
/*     */   {
/* 230 */     if ((paramNotifier instanceof ImageSpec)) {
/* 231 */       this.is = ((ImageSpec)paramNotifier);
/* 232 */       return true;
/*     */     }
/* 234 */     this.is = null;
/* 235 */     return false;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void notifyComplete()
/*     */   {
/* 244 */     if (this.is == null) return; try
/*     */     {
/* 246 */       synchronized (this.is) {
/* 247 */         setImageData(this.is.getImage(), this.is.getDescription());
/*     */       }
/*     */     } catch (QTException localQTException) {
/* 250 */       QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this, "setImageData");
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setImageData(EncodedImage paramEncodedImage, ImageDescription paramImageDescription)
/*     */     throws QTException
/*     */   {
/* 266 */     paramEncodedImage = paramEncodedImage == null ? getDummyEI() : paramEncodedImage;
/* 267 */     paramImageDescription = paramImageDescription == null ? getDummyID() : paramImageDescription;
/* 268 */     this.info.desc = paramImageDescription;
/*     */
/* 270 */     if (this.sprite != null) {
/* 271 */       this.sprite.setImageDescription(paramImageDescription);
/*     */
/* 274 */       if ((paramEncodedImage != getDummyEI()) && (this.info.image == getDummyEI())) {
/* 275 */         this.sprite.setGraphicsMode(this.info.graphicsMode);
/* 276 */         this.sprite.setVisible(true);
/*     */       }
/* 278 */       setImage(paramEncodedImage);
/*     */     } else {
/* 280 */       setImage(paramEncodedImage);
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setImage(EncodedImage paramEncodedImage)
/*     */     throws QTException
/*     */   {
/* 289 */     paramEncodedImage = paramEncodedImage != null ? paramEncodedImage : getDummyEI();
/* 290 */     if (this.sprite != null) {
/* 291 */       boolean bool = this.sprite.setImageDataIfDifferent(paramEncodedImage);
/* 292 */       if (paramEncodedImage == getDummyEI())
/* 293 */         this.sprite.setVisible(false);
/* 294 */       if (bool)
/* 295 */         doParentRedraw(true);
/*     */     }
/* 297 */     this.info.image = paramEncodedImage;
/*     */   }
/*     */
/*     */   private final void doParentRedraw(boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/* 305 */     if ((paramBoolean) && (this.parentsTimer != null) && (!this.parentsTimer.isTicking()) && (this.parentCompositor != null) && (this.parentCompositor.isAutoRedrawing()))
/*     */     {
/* 309 */       this.parentCompositor.idle();
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public SWCompositor getParent()
/*     */   {
/* 321 */     return this.parentCompositor;
/*     */   }
/*     */
/*     */   void setParent(SWCompositor paramSWCompositor) {
/* 325 */     this.parentCompositor = paramSWCompositor;
/* 326 */     if (paramSWCompositor != null)
/* 327 */       this.parentsTimer = paramSWCompositor.getTimer();
/*     */     else
/* 329 */       this.parentsTimer = null;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   Sprite getSprite()
/*     */   {
/* 340 */     return this.sprite;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean isValid()
/*     */   {
/* 349 */     return this.sprite != null;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void remove()
/*     */     throws QTException
/*     */   {
/* 359 */     if (this.sprite != null) {
/* 360 */       boolean bool = getVisible();
/* 361 */       this.sprite.remove();
/* 362 */       doParentRedraw(bool);
/* 363 */       this.sprite = null;
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public TwoDSpriteInfo getSpriteInfo()
/*     */     throws QTException
/*     */   {
/* 375 */     return this.info;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void removeNotify()
/*     */     throws QTException
/*     */   {
/* 385 */     if (this.spriteIsCompositor != null)
/* 386 */       this.spriteIsCompositor.setGWorld(QDGraphics.scratch);
/* 387 */     this.sprite = null;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void createSprite(SpriteWorld paramSpriteWorld)
/*     */     throws QTException
/*     */   {
/* 397 */     if (this.sprite != null)
/* 398 */       this.sprite.remove();
/* 399 */     if (this.info == null) throw new QTAppException("Can't create sprite with no information");
/* 400 */     if ((this.info.image == null) || (this.info.desc == null)) {
/* 401 */       this.info.image = getDummyEI();
/* 402 */       this.info.desc = getDummyID();
/*     */     }
/* 404 */     if ((this.info.image == getDummyEI()) || (this.info.desc == getDummyID()))
/* 405 */       this.info.visible = false;
/* 406 */     this.sprite = new Sprite(paramSpriteWorld, this.info.desc, this.info.image, this.info.matrix, this.info.visible, this.info.layer);
/*     */
/* 412 */     this.sprite.setGraphicsMode(this.info.graphicsMode);
/*     */
/* 414 */     if (this.spriteIsCompositor != null) {
/* 415 */       this.spriteIsCompositor.setGWorld(QDGraphics.validScratch);
/*     */     }
/* 417 */     doParentRedraw(getVisible());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Matrix getMatrix()
/*     */     throws QTException
/*     */   {
/* 425 */     if (this.sprite != null)
/* 426 */       return this.sprite.getMatrix();
/* 427 */     return this.info.matrix;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setMatrix(Matrix paramMatrix)
/*     */     throws QTException
/*     */   {
/* 436 */     if (this.sprite != null)
/* 437 */       this.sprite.setMatrix(paramMatrix);
/* 438 */     this.info.matrix = paramMatrix;
/* 439 */     if (this.spriteIsCompositor != null)
/* 440 */       this.spriteIsCompositor.setMatrix(paramMatrix);
/* 441 */     if (this.sprite != null)
/* 442 */       doParentRedraw(getVisible());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Dimension getInitialSize()
/*     */     throws QTException
/*     */   {
/* 455 */     return new Dimension(this.info.desc.getWidth(), this.info.desc.getHeight());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public QDDimension getOriginalSize()
/*     */     throws QTException
/*     */   {
/* 465 */     return new QDDimension(this.info.desc.getWidth(), this.info.desc.getHeight());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public final void invalidate()
/*     */     throws QTException
/*     */   {
/* 474 */     if (this.sprite == null) {
/* 475 */       QTRuntimeException.handleOrThrow(new SpriteInvalidException(toString()), this, "invalidate");
/* 476 */       return;
/*     */     }
/* 478 */     this.sprite.invalidate();
/*     */
/* 480 */     if (!(this.info.image instanceof RawEncodedImage))
/* 481 */       this.sprite.setImageData(this.info.image);
/* 482 */     doParentRedraw(getVisible());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean hitTest(int paramInt, QDPoint paramQDPoint)
/*     */     throws QTException
/*     */   {
/* 493 */     if (this.sprite == null) {
/* 494 */       QTRuntimeException.handleOrThrow(new SpriteInvalidException(toString()), this, "hitTest");
/* 495 */       return false;
/*     */     }
/* 497 */     return this.sprite.hitTest(paramInt, paramQDPoint);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public ImageDescription getDescription()
/*     */     throws QTException
/*     */   {
/* 506 */     if (this.sprite != null)
/* 507 */       return this.sprite.getImageDescription();
/* 508 */     return this.info.desc;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setDescription(ImageDescription paramImageDescription)
/*     */     throws QTException
/*     */   {
/* 517 */     if (this.sprite != null)
/* 518 */       this.sprite.setImageDescription(paramImageDescription);
/* 519 */     this.info.desc = paramImageDescription;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public EncodedImage getImage()
/*     */     throws QTException
/*     */   {
/* 528 */     if (this.sprite != null)
/* 529 */       return this.sprite.getImageData();
/* 530 */     return this.info.image;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean getVisible()
/*     */     throws QTException
/*     */   {
/* 539 */     if (this.sprite != null)
/* 540 */       return this.sprite.getVisible();
/* 541 */     return this.info.visible;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setVisible(boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/* 550 */     if (this.sprite != null) {
/* 551 */       this.sprite.setVisible(paramBoolean);
/* 552 */       doParentRedraw(paramBoolean);
/*     */     }
/* 554 */     this.info.visible = paramBoolean;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public int getLayer()
/*     */     throws QTException
/*     */   {
/* 563 */     if (this.sprite != null)
/* 564 */       return this.sprite.getLayer();
/* 565 */     return this.info.layer;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setLayer(int paramInt)
/*     */     throws QTException
/*     */   {
/* 574 */     if (this.sprite != null) {
/* 575 */       this.sprite.setLayer(paramInt);
/* 576 */       doParentRedraw(getVisible());
/*     */     }
/* 578 */     this.info.layer = paramInt;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public GraphicsMode getGraphicsMode()
/*     */     throws QTException
/*     */   {
/* 587 */     if (this.sprite != null)
/* 588 */       return this.sprite.getGraphicsMode();
/* 589 */     return this.info.graphicsMode;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setGraphicsMode(GraphicsMode paramGraphicsMode)
/*     */     throws QTException
/*     */   {
/* 598 */     if (this.sprite != null) {
/* 599 */       this.sprite.setGraphicsMode(paramGraphicsMode);
/* 600 */       doParentRedraw(getVisible());
/*     */     }
/* 602 */     this.info.graphicsMode = paramGraphicsMode;
/*     */   }
/*     */
/*     */   public boolean equals(Object paramObject)
/*     */   {
/* 608 */     if (this == paramObject) return true;
/* 609 */     if ((paramObject instanceof TwoDSprite)) {
/* 610 */       TwoDSprite localTwoDSprite = (TwoDSprite)paramObject;
/* 611 */       if (localTwoDSprite.sprite == null) {
/* 612 */         return false;
/*     */       }
/* 614 */       return localTwoDSprite.sprite.equals(this.sprite);
/*     */     }
/*     */
/* 617 */     return false;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public String toString()
/*     */   {
/*     */     try
/*     */     {
/* 626 */       String str = "";
/* 627 */       if (this.label != null)
/* 628 */         str = "label=" + this.label;
/* 629 */       return getClass().getName() + "[" + str + "sprite= " + this.sprite + ",matrix=" + getMatrix() + "]"; } catch (QTException localQTException) {
/*     */     }
/* 631 */     return getClass().getName();
/*     */   }
/*     */
/*     */   static
/*     */   {
/*  45 */     if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/*  46 */       throw new QTRuntimeException("Unsupported on Mac OS X and Java 1.4 and higher.");
/*     */   }
/*     */ }

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

Related Classes of quicktime.app.anim.TwoDSprite

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.