Package quicktime.app.actions

Source Code of quicktime.app.actions.MatrixAction

/*     */ package quicktime.app.actions;
/*     */
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.app.display.QTDisplaySpace;
/*     */ import quicktime.app.display.QTDrawable;
/*     */ import quicktime.app.image.Transformable;
/*     */ import quicktime.qd.QDDimension;
/*     */ import quicktime.qd.QDRect;
/*     */ import quicktime.std.image.Matrix;
/*     */
/*     */ /** @deprecated */
/*     */ public class MatrixAction extends PeriodicAction
/*     */   implements Targetable
/*     */ {
/*     */
/*     */   /** @deprecated */
/*     */   protected static final int kLeftSide = 1;
/*     */
/*     */   /** @deprecated */
/*     */   protected static final int kRightSide = 16;
/*     */
/*     */   /** @deprecated */
/*     */   protected static final int kTopSide = 256;
/*     */
/*     */   /** @deprecated */
/*     */   protected static final int kBottomSide = 4096;
/*     */   protected Transformable target;
/*     */   protected TransformMatrix transMatrix;
/*     */
/*     */   /** @deprecated */
/* 108 */   protected boolean doConstraintBoundsTesting = false;
/*     */
/* 110 */   private boolean forwards = true;
/*     */   private QTDrawable space;
/* 112 */   private boolean consReached = false;
/*     */
/*     */   /** @deprecated */
/*     */   protected MatrixAction(int paramInt1, int paramInt2, QTDrawable paramQTDrawable, Transformable paramTransformable)
/*     */     throws QTException
/*     */   {
/*  71 */     super(paramInt1, paramInt2);
/*  72 */     this.target = paramTransformable;
/*  73 */     this.space = paramQTDrawable;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public MatrixAction(int paramInt1, int paramInt2, QTDisplaySpace paramQTDisplaySpace, Transformable paramTransformable, TransformMatrix paramTransformMatrix)
/*     */     throws QTException
/*     */   {
/*  87 */     super(paramInt1, paramInt2);
/*  88 */     this.target = paramTransformable;
/*  89 */     this.space = paramQTDisplaySpace;
/*  90 */     this.transMatrix = paramTransformMatrix;
/*  91 */     this.transMatrix.initialize(paramQTDisplaySpace, paramTransformable);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setTarget(Object paramObject)
/*     */   {
/* 122 */     this.target = ((Transformable)paramObject);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Object getTarget()
/*     */   {
/* 133 */     return this.target;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public QTDrawable getSpace()
/*     */   {
/* 144 */     return this.space;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setSpace(QTDrawable paramQTDrawable)
/*     */   {
/* 154 */     this.space = paramQTDrawable;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void doAction(float paramFloat, int paramInt)
/*     */     throws QTException
/*     */   {
/* 171 */     this.consReached = false;
/* 172 */     if (((paramFloat > 0.0F) && (!this.forwards)) || ((paramFloat < 0.0F) && (this.forwards))) {
/* 173 */       this.forwards = (paramFloat > 0.0F);
/* 174 */       if (this.transMatrix != null)
/* 175 */         this.transMatrix.flipTransformationSettings();
/*     */       else {
/* 177 */         rateDirectionChanged(this.forwards);
/*     */       }
/*     */     }
/* 180 */     if (this.transMatrix != null) {
/* 181 */       this.consReached = this.transMatrix.transformTarget();
/*     */     }
/*     */     else
/*     */     {
/* 186 */       Matrix localMatrix1 = this.target.getMatrix().copy();
/* 187 */       transformMatrix(localMatrix1);
/*     */
/* 189 */       if (this.doConstraintBoundsTesting)
/*     */       {
/* 191 */         Matrix localMatrix2 = new Matrix();
/* 192 */         this.space.getMatrix().inverse(localMatrix2);
/*     */
/* 195 */         QDRect localQDRect1 = this.space.getDisplayBounds().copy();
/* 196 */         localMatrix2.transformRect(localQDRect1);
/*     */
/* 199 */         QDDimension localQDDimension = this.target.getOriginalSize();
/* 200 */         float f1 = localMatrix1.getTx();
/* 201 */         float f2 = localMatrix1.getTy();
/* 202 */         int i = localQDRect1.getX();
/* 203 */         int j = localQDRect1.getWidth() - localQDDimension.getWidth();
/* 204 */         int k = localQDRect1.getY();
/* 205 */         int m = localQDRect1.getHeight() - localQDDimension.getHeight();
/*     */
/* 207 */         switch (localMatrix1.getType()) {
/*     */         case 0:
/*     */         case 1:
/* 210 */           break;
/*     */         default:
/* 214 */           QDRect localQDRect2 = new QDRect(0, 0, localQDDimension.getWidth(), localQDDimension.getHeight());
/* 215 */           localMatrix1.transformRect(localQDRect2);
/* 216 */           localQDDimension.setWidth(localQDRect2.getWidth());
/* 217 */           localQDDimension.setHeight(localQDRect2.getHeight());
/* 218 */           i = (int)(localMatrix1.getTx() - localQDRect2.getX() + 0.5F);
/* 219 */           f1 -= i;
/* 220 */           k = (int)(localMatrix1.getTy() - localQDRect2.getY() + 0.5F);
/* 221 */           f2 -= k;
/* 222 */           m = localQDRect1.getHeight() - localQDDimension.getHeight() + k;
/* 223 */           j = localQDRect1.getWidth() - localQDDimension.getWidth() + i;
/*     */         }
/*     */
/* 227 */         if (f1 < localQDRect1.getX()) {
/* 228 */           localMatrix1.setTx(i);
/* 229 */           boundsReached(1);
/* 230 */           this.consReached = true;
/* 231 */         } else if (f1 + localQDDimension.getWidth() > localQDRect1.getWidth()) {
/* 232 */           localMatrix1.setTx(j);
/* 233 */           boundsReached(16);
/* 234 */           this.consReached = true;
/*     */         }
/*     */
/* 237 */         if (f2 < localQDRect1.getY()) {
/* 238 */           localMatrix1.setTy(k);
/* 239 */           boundsReached(256);
/* 240 */           this.consReached = true;
/* 241 */         } else if (f2 + localQDDimension.getHeight() > localQDRect1.getHeight()) {
/* 242 */           localMatrix1.setTy(m);
/* 243 */           boundsReached(4096);
/* 244 */           this.consReached = true;
/*     */         }
/*     */       }
/* 247 */       setTargetMatrix(localMatrix1);
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void rateDirectionChanged(boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void transformMatrix(Matrix paramMatrix)
/*     */     throws QTException
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void boundsReached(int paramInt)
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected void setTargetMatrix(Matrix paramMatrix)
/*     */     throws QTException
/*     */   {
/* 292 */     this.target.setMatrix(paramMatrix);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected boolean constraintReached()
/*     */   {
/* 305 */     return this.consReached;
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 311 */     return getClass().getName() + "[target=" + this.target + "]";
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean equals(Object paramObject)
/*     */   {
/* 321 */     if ((paramObject instanceof MatrixAction)) {
/* 322 */       MatrixAction localMatrixAction = (MatrixAction)paramObject;
/* 323 */       if (this.transMatrix != null) {
/* 324 */         if (!this.transMatrix.equals(localMatrixAction.transMatrix)) {
/* 325 */           return false;
/*     */         }
/* 327 */         return super.equals(paramObject);
/*     */       }
/* 329 */       if (!this.target.equals(localMatrixAction.target)) {
/* 330 */         return false;
/*     */       }
/* 332 */       return super.equals(paramObject);
/*     */     }
/*     */
/* 335 */     return false;
/*     */   }
/*     */
/*     */   static
/*     */   {
/*  41 */     if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/*  42 */       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.actions.MatrixAction
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.app.actions.MatrixAction

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.