Package quicktime.app.actions

Source Code of quicktime.app.actions.TransformMatrix

/*     */ package quicktime.app.actions;
/*     */
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.app.display.QTDisplaySpace;
/*     */ import quicktime.app.image.Transformable;
/*     */ import quicktime.qd.QDDimension;
/*     */ import quicktime.qd.QDPoint;
/*     */ import quicktime.qd.QDRect;
/*     */ import quicktime.std.image.Matrix;
/*     */
/*     */ /** @deprecated */
/*     */ public abstract class TransformMatrix
/*     */ {
/*  40 */   private static boolean apriori = QTSession.apriori();
/*     */
/*     */   /** @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;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kNoConstraint = 0;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinLeft = 1;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinRight = 16;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinTop = 256;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinBottom = 4096;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinHorizontal = 17;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinVertical = 4352;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstrainWithinAll = 4369;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedLeft = 65536;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedRight = 1048576;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedTop = 16777216;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedBottom = 268435456;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedHorizontal = 1114112;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedVertical = 285212672;
/*     */
/*     */   /** @deprecated */
/*     */   public static final int kConstraintSpecifiedAll = 286326784;
/*  93 */   private int constrained = 0;
/*     */
/*     */   /** @deprecated */
/*     */   protected Transformable target;
/*     */
/*     */   /** @deprecated */
/* 107 */   public int specifiedRightConstraint = 1;
/*     */
/*     */   /** @deprecated */
/* 113 */   public int specifiedLeftConstraint = 1;
/*     */
/*     */   /** @deprecated */
/* 119 */   public int specifiedTopConstraint = 1;
/*     */
/*     */   /** @deprecated */
/* 125 */   public int specifiedBottomConstraint = 1;
/*     */   private QDPoint[] origPt;
/*     */   private QDRect spaceRect;
/*     */   private Matrix invSpaceMatrix;
/*     */   private Matrix origTargetMatrix;
/* 132 */   private QDPoint[] newPt = new QDPoint[1];
/* 133 */   private QDRect transformMatrixRect = new QDRect();
/*     */   private Matrix deltaMatrix;
/*     */   private int setXLeft;
/*     */   private int setXRight;
/*     */   private int setYTop;
/*     */   private int setYBottom;
/*     */
/*     */   /** @deprecated */
/*     */   protected TransformMatrix()
/*     */   {
/*  89 */     this.newPt[0] = new QDPoint(0, 0);
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 141 */     return getClass().getName() + "[target=" + this.target + "]";
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean equals(Object paramObject)
/*     */   {
/* 151 */     if (paramObject == this) return true;
/* 152 */     if (paramObject == null) return false;
/* 153 */     if (!paramObject.getClass().getName().equals(getClass().getName()))
/* 154 */       return false;
/* 155 */     if ((paramObject instanceof TransformMatrix)) {
/* 156 */       TransformMatrix localTransformMatrix = (TransformMatrix)paramObject;
/* 157 */       if (this.target != null)
/* 158 */         return this.target.equals(localTransformMatrix.target);
/*     */     }
/* 160 */     return false;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Transformable getTarget()
/*     */   {
/* 168 */     return this.target;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setConstraint(int paramInt)
/*     */   {
/* 177 */     this.constrained = paramInt;
/*     */   }
/*     */
/*     */   public int getConstraint()
/*     */   {
/* 183 */     return this.constrained;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void initialize(QTDisplaySpace paramQTDisplaySpace, Transformable paramTransformable)
/*     */     throws QTException
/*     */   {
/* 205 */     this.target = paramTransformable;
/*     */
/* 207 */     QDRect localQDRect = paramQTDisplaySpace.getDisplayBounds();
/* 208 */     Matrix localMatrix1 = paramQTDisplaySpace.getMatrix();
/*     */
/* 210 */     this.invSpaceMatrix = new Matrix();
/* 211 */     Matrix localMatrix2 = localMatrix1.copy();
/* 212 */     localMatrix2.setTx(0.0F);
/* 213 */     localMatrix2.setTy(0.0F);
/* 214 */     localMatrix2.inverse(this.invSpaceMatrix);
/*     */
/* 216 */     this.origPt = new QDPoint[1];
/* 217 */     this.origPt[0] = new QDPoint(0, 0);
/*     */
/* 219 */     this.origTargetMatrix = this.target.getMatrix();
/* 220 */     this.spaceRect = localQDRect.copy();
/* 221 */     this.spaceRect.setX(0);
/* 222 */     this.spaceRect.setY(0);
/* 223 */     this.invSpaceMatrix.transformRect(this.spaceRect);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void initialize(QTDisplaySpace paramQTDisplaySpace, Transformable paramTransformable, int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 239 */     this.target = paramTransformable;
/*     */
/* 241 */     QDRect localQDRect = paramQTDisplaySpace.getDisplayBounds();
/* 242 */     Matrix localMatrix1 = paramQTDisplaySpace.getMatrix();
/*     */
/* 244 */     this.invSpaceMatrix = new Matrix();
/* 245 */     Matrix localMatrix2 = localMatrix1.copy();
/* 246 */     localMatrix2.setTx(0.0F);
/* 247 */     localMatrix2.setTy(0.0F);
/* 248 */     localMatrix2.inverse(this.invSpaceMatrix);
/*     */
/* 250 */     this.origPt = new QDPoint[1];
/* 251 */     this.origPt[0] = new QDPoint(paramInt1, paramInt2);
/*     */
/* 253 */     this.invSpaceMatrix.transformPoints(this.origPt);
/* 254 */     this.origTargetMatrix = this.target.getMatrix();
/* 255 */     this.spaceRect = localQDRect.copy();
/* 256 */     this.spaceRect.setX(0);
/* 257 */     this.spaceRect.setY(0);
/* 258 */     this.invSpaceMatrix.transformRect(this.spaceRect);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean transformTarget()
/*     */     throws QTException
/*     */   {
/* 268 */     this.deltaMatrix = this.target.getMatrix().copy();
/* 269 */     doTransformation(this.deltaMatrix);
/* 270 */     return completeTransformation();
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean transformTarget(int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 282 */     this.newPt[0].setX(paramInt1);
/* 283 */     this.newPt[0].setY(paramInt2);
/* 284 */     this.invSpaceMatrix.transformPoints(this.newPt);
/* 285 */     int i = this.newPt[0].getX() - this.origPt[0].getX();
/* 286 */     int j = this.newPt[0].getY() - this.origPt[0].getY();
/* 287 */     this.deltaMatrix = this.origTargetMatrix.copy();
/* 288 */     doTransformation(this.deltaMatrix, i, j);
/* 289 */     return completeTransformation();
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void flipTransformationSettings()
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected abstract void doTransformation(Matrix paramMatrix, int paramInt1, int paramInt2)
/*     */     throws QTException;
/*     */
/*     */   /** @deprecated */
/*     */   protected abstract void doTransformation(Matrix paramMatrix)
/*     */     throws QTException;
/*     */
/*     */   /** @deprecated */
/*     */   protected void boundsReached(int paramInt)
/*     */   {
/*     */   }
/*     */
/*     */   private boolean completeTransformation()
/*     */     throws QTException
/*     */   {
/* 324 */     boolean bool = false;
/* 325 */     if (this.constrained != 0) {
/* 326 */       QDDimension localQDDimension = this.target.getOriginalSize();
/* 327 */       int i = localQDDimension.getWidth();
/* 328 */       int j = localQDDimension.getHeight();
/*     */
/* 330 */       float f1 = this.deltaMatrix.getTx();
/* 331 */       float f2 = this.deltaMatrix.getTy();
/* 332 */       this.setXLeft = this.spaceRect.getX();
/* 333 */       this.setXRight = (this.spaceRect.getWidth() - i);
/* 334 */       this.setYTop = this.spaceRect.getY();
/* 335 */       this.setYBottom = (this.spaceRect.getHeight() - j);
/*     */
/* 337 */       int k = this.deltaMatrix.getType();
/* 338 */       switch (k) {
/*     */       case 0:
/*     */       case 1:
/* 341 */         break;
/*     */       default:
/* 345 */         this.transformMatrixRect.setWidth(i);
/* 346 */         this.transformMatrixRect.setHeight(j);
/* 347 */         this.transformMatrixRect.setX(0);
/* 348 */         this.transformMatrixRect.setY(0);
/* 349 */         this.deltaMatrix.transformRect(this.transformMatrixRect);
/* 350 */         i = this.transformMatrixRect.getWidth();
/* 351 */         j = this.transformMatrixRect.getHeight();
/* 352 */         this.setXLeft = ((int)(this.deltaMatrix.getTx() - this.transformMatrixRect.getX() + 0.5F));
/* 353 */         f1 -= this.setXLeft;
/* 354 */         this.setYTop = ((int)(this.deltaMatrix.getTy() - this.transformMatrixRect.getY() + 0.5F));
/* 355 */         f2 -= this.setYTop;
/* 356 */         this.setYBottom = (this.spaceRect.getHeight() - j + this.setYTop);
/* 357 */         this.setXRight = (this.spaceRect.getWidth() - j + this.setXLeft);
/*     */       }
/* 359 */       bool = doConstraintsTesting(f1, f2, i, j);
/*     */     }
/*     */
/* 362 */     this.target.setMatrix(this.deltaMatrix);
/*     */
/* 364 */     return bool;
/*     */   }
/*     */
/*     */   private boolean doConstraintsTesting(float paramFloat1, float paramFloat2, int paramInt1, int paramInt2) {
/* 368 */     boolean bool = false;
/*     */
/* 371 */     if (paramFloat1 < this.spaceRect.getX()) {
/* 372 */       if ((this.constrained & 0x1) != 0) {
/* 373 */         this.deltaMatrix.setTx(this.setXLeft);
/* 374 */         boundsReached(1);
/* 375 */         bool = true;
/* 376 */       } else if (((this.constrained & 0x10000) != 0) && (paramFloat1 <= -paramInt1)) {
/* 377 */         this.deltaMatrix.setTx(-paramInt1 + this.specifiedLeftConstraint + this.setXLeft);
/* 378 */         boundsReached(1);
/* 379 */         bool = true;
/*     */       }
/* 381 */     } else if (paramFloat1 + paramInt1 > this.spaceRect.getWidth()) {
/* 382 */       if ((this.constrained & 0x10) != 0) {
/* 383 */         this.deltaMatrix.setTx(this.setXRight);
/* 384 */         boundsReached(16);
/* 385 */         bool = true;
/* 386 */       } else if (((this.constrained & 0x100000) != 0) && (paramFloat1 >= this.spaceRect.getWidth())) {
/* 387 */         this.deltaMatrix.setTx(this.setXRight + paramInt1 - this.specifiedRightConstraint);
/* 388 */         boundsReached(16);
/* 389 */         bool = true;
/*     */       }
/*     */     }
/*     */
/* 393 */     if (paramFloat2 < this.spaceRect.getY()) {
/* 394 */       if ((this.constrained & 0x100) != 0) {
/* 395 */         this.deltaMatrix.setTy(this.setYTop);
/* 396 */         boundsReached(256);
/* 397 */         bool = true;
/* 398 */       } else if (((this.constrained & 0x1000000) != 0) && (paramFloat2 <= -paramInt2)) {
/* 399 */         this.deltaMatrix.setTy(-paramInt2 + this.specifiedTopConstraint + this.setYTop);
/* 400 */         boundsReached(256);
/* 401 */         bool = true;
/*     */       }
/* 403 */     } else if (paramFloat2 + paramInt2 > this.spaceRect.getHeight()) {
/* 404 */       if ((this.constrained & 0x1000) != 0) {
/* 405 */         this.deltaMatrix.setTy(this.setYBottom);
/* 406 */         boundsReached(4096);
/* 407 */         bool = true;
/* 408 */       } else if (((this.constrained & 0x10000000) != 0) && (paramFloat2 >= this.spaceRect.getHeight())) {
/* 409 */         this.deltaMatrix.setTy(this.setYBottom + paramInt2 - this.specifiedBottomConstraint);
/* 410 */         boundsReached(4096);
/* 411 */         bool = true;
/*     */       }
/*     */     }
/* 414 */     return bool;
/*     */   }
/*     */
/*     */   static
/*     */   {
/*  43 */     if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/*  44 */       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.TransformMatrix
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.app.actions.TransformMatrix

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.