Package quicktime.app.image

Source Code of quicktime.app.image.ImagePresenter

/*     */ package quicktime.app.image;
/*     */
/*     */ import java.awt.Dimension;
/*     */ import java.io.IOException;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.app.display.QTDrawable;
/*     */ import quicktime.io.QTFile;
/*     */ import quicktime.qd.Pict;
/*     */ import quicktime.qd.PixMap;
/*     */ import quicktime.qd.QDDimension;
/*     */ import quicktime.qd.QDGraphics;
/*     */ import quicktime.qd.QDRect;
/*     */ import quicktime.qd.Region;
/*     */ import quicktime.qd.SetGWorld;
/*     */ import quicktime.std.StdQTException;
/*     */ import quicktime.std.image.CodecComponent;
/*     */ import quicktime.std.image.DSequence;
/*     */ import quicktime.std.image.GraphicsImporter;
/*     */ import quicktime.std.image.GraphicsMode;
/*     */ import quicktime.std.image.ICMPixelFormatInfo;
/*     */ import quicktime.std.image.ImageDescription;
/*     */ import quicktime.std.image.Matrix;
/*     */ import quicktime.std.image.QTImage;
/*     */ import quicktime.util.ByteEncodedImage;
/*     */ import quicktime.util.EncodedImage;
/*     */ import quicktime.util.IntEncodedImage;
/*     */ import quicktime.util.RawEncodedImage;
/*     */
/*     */ /** @deprecated */
/*     */ public class ImagePresenter
/*     */   implements QTDrawable, Compositable, ImageSettable
/*     */ {
/*     */   private static final boolean doDrawProfile = false;
/* 192 */   private ImageDescription mImageDescription = null;
/* 193 */   private DSequence mImageSeq = null;
/* 194 */   private QDRect mDisplayBounds = null;
/*     */   private ByteEncodedImage mDataB;
/*     */   private RawEncodedImage mDataR;
/*     */   private IntEncodedImage mDataI;
/*     */   private EncodedImage mData;
/* 199 */   private QDGraphics port = QDGraphics.scratch;
/*     */   private int origWidth;
/*     */   private int origHeight;
/* 201 */   private Matrix mat = new Matrix();
/*     */   private Region clip;
/* 203 */   private GraphicsMode gMode = new GraphicsMode();
/* 204 */   private boolean optimiseRedraw = true;
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromFile(QTFile paramQTFile)
/*     */     throws IOException, QTException
/*     */   {
/*  55 */     return fromGraphicsImporterDrawer(new GraphicsImporterDrawer(paramQTFile));
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromGraphicsImporter(GraphicsImporter paramGraphicsImporter)
/*     */     throws IOException, QTException
/*     */   {
/*  64 */     return fromGraphicsImporterDrawer(new GraphicsImporterDrawer(paramGraphicsImporter));
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromGraphicsImporterDrawer(GraphicsImporterDrawer paramGraphicsImporterDrawer)
/*     */     throws IOException, QTException
/*     */   {
/*  73 */     QDRect localQDRect = new QDRect(paramGraphicsImporterDrawer.getDisplayBounds().getWidth(), paramGraphicsImporterDrawer.getDisplayBounds().getHeight());
/*  74 */     QDGraphics localQDGraphics = new QDGraphics(localQDRect);
/*  75 */     paramGraphicsImporterDrawer.setDisplayBounds(localQDRect);
/*  76 */     paramGraphicsImporterDrawer.setGWorld(localQDGraphics);
/*  77 */     paramGraphicsImporterDrawer.redraw(null);
/*  78 */     return fromGWorld(localQDGraphics);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromImageSpec(ImageSpec paramImageSpec)
/*     */     throws QTException
/*     */   {
/*  88 */     return fromQTImage(paramImageSpec.getImage(), paramImageSpec.getDescription());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromImageSequence(ImageDataSequence paramImageDataSequence, int paramInt)
/*     */     throws QTException
/*     */   {
/*  98 */     return fromQTImage(paramImageDataSequence.getImage(paramInt), paramImageDataSequence.getDescription());
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromGWorld(QDGraphics paramQDGraphics)
/*     */     throws QTException
/*     */   {
/* 108 */     PixMap localPixMap = paramQDGraphics.getPixMap();
/* 109 */     return new ImagePresenter(localPixMap.getPixelData(), new ImageDescription(localPixMap));
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromGWorld(QDGraphics paramQDGraphics, QDRect paramQDRect, int paramInt1, int paramInt2, int paramInt3, CodecComponent paramCodecComponent)
/*     */     throws QTException
/*     */   {
/* 127 */     int i = QTImage.getMaxCompressionSize(paramQDGraphics, paramQDRect, paramInt1, paramInt2, paramInt3, paramCodecComponent);
/* 128 */     RawEncodedImage localRawEncodedImage = new RawEncodedImage(i, true);
/* 129 */     ImageDescription localImageDescription = QTImage.compress(paramQDGraphics, paramQDRect, paramInt2, paramInt3, localRawEncodedImage);
/* 130 */     localRawEncodedImage.setSize(localImageDescription.getDataSize());
/* 131 */     ImagePresenter localImagePresenter = new ImagePresenter(paramQDRect);
/* 132 */     localImagePresenter.optimiseRedraw = false;
/* 133 */     localImagePresenter.setImageData(localRawEncodedImage, localImageDescription);
/* 134 */     return localImagePresenter;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromPict(Pict paramPict)
/*     */     throws QTException
/*     */   {
/* 143 */     ImageDescription localImageDescription = new ImageDescription(1902408311);
/* 144 */     QDRect localQDRect = paramPict.getPictFrame();
/* 145 */     localImageDescription.setVersion(-2);
/* 146 */     localImageDescription.setVendor(1634758764);
/* 147 */     localImageDescription.setSpatialQuality(1024);
/* 148 */     localImageDescription.setWidth(localQDRect.getWidth());
/* 149 */     localImageDescription.setHeight(localQDRect.getHeight());
/* 150 */     localImageDescription.setHRes(72.0F);
/* 151 */     localImageDescription.setVRes(72.0F);
/* 152 */     localImageDescription.setDataSize(paramPict.getSize());
/* 153 */     localImageDescription.setFrameCount(1);
/* 154 */     localImageDescription.setDepth(24);
/* 155 */     localImageDescription.setClutID(-1);
/* 156 */     return new ImagePresenter(paramPict.toEncodedImage(), localImageDescription);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public static ImagePresenter fromQTImage(EncodedImage paramEncodedImage, ImageDescription paramImageDescription)
/*     */     throws QTException
/*     */   {
/* 166 */     return new ImagePresenter(paramEncodedImage, paramImageDescription);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public ImagePresenter(QDRect paramQDRect)
/*     */   {
/* 175 */     this.mDisplayBounds = paramQDRect;
/* 176 */     this.origWidth = paramQDRect.getWidth();
/* 177 */     this.origHeight = paramQDRect.getHeight();
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   private ImagePresenter(EncodedImage paramEncodedImage, ImageDescription paramImageDescription)
/*     */     throws QTException
/*     */   {
/* 187 */     setImageData(paramEncodedImage, paramImageDescription);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setImageData(EncodedImage paramEncodedImage, ImageDescription paramImageDescription)
/*     */     throws QTException
/*     */   {
/* 220 */     int i = paramImageDescription.getCType();
/* 221 */     this.mImageDescription = paramImageDescription;
/* 222 */     if ((paramEncodedImage != null) &&
/* 223 */       (this.optimiseRedraw)) if (((i == 1919706400) || (i == 1918990112) || (i == 1902408311) || (i == 1885434984) || (ICMPixelFormatInfo.isValidPixelFormat(i)) ? 1 : 0) == 0)
/*     */       {
/* 229 */         Object localObject1 = null;
/*     */         try {
/* 231 */           QDGraphics localQDGraphics = new QDGraphics(new QDRect(paramImageDescription.getWidth(), paramImageDescription.getHeight()));
/* 232 */           DSequence localDSequence = new DSequence(paramImageDescription, localQDGraphics, null, null, null, 0, 768, CodecComponent.anyCodec);
/*     */
/* 240 */           localDSequence.decompressFrameS(paramEncodedImage, 0);
/* 241 */           PixMap localPixMap = localQDGraphics.getPixMap();
/* 242 */           this.mImageDescription = new ImageDescription(localPixMap);
/* 243 */           paramEncodedImage = localPixMap.getPixelData();
/*     */         } catch (QTException localQTException) {
/* 245 */           this.mImageDescription = paramImageDescription;
/*     */         } finally {
/* 247 */           if (localObject1 != null) localObject1.reset();
/*     */         }
/*     */       }
/*     */
/* 251 */     this.mImageDescription.setFrameCount(1);
/*     */
/* 253 */     this.origWidth = paramImageDescription.getWidth();
/* 254 */     this.origHeight = paramImageDescription.getHeight();
/* 255 */     if (this.mDisplayBounds == null)
/* 256 */       this.mDisplayBounds = new QDRect(paramImageDescription.getWidth(), paramImageDescription.getHeight());
/* 257 */     setDisplayBounds(this.mDisplayBounds);
/*     */
/* 259 */     setImageData(paramEncodedImage);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setImageData(EncodedImage paramEncodedImage)
/*     */     throws QTException
/*     */   {
/* 271 */     this.mData = paramEncodedImage;
/* 272 */     if ((this.mData instanceof ByteEncodedImage)) {
/* 273 */       this.mDataB = ((ByteEncodedImage)this.mData);
/* 274 */       this.mDataI = null;
/* 275 */       this.mDataR = null;
/* 276 */     } else if ((this.mData instanceof IntEncodedImage)) {
/* 277 */       this.mDataI = ((IntEncodedImage)this.mData);
/* 278 */       this.mDataB = null;
/* 279 */       this.mDataR = null;
/* 280 */     } else if ((this.mData instanceof RawEncodedImage)) {
/* 281 */       this.mDataR = ((RawEncodedImage)this.mData);
/* 282 */       this.mDataI = null;
/* 283 */       this.mDataB = null;
/*     */     } else {
/* 285 */       this.mDataR = null;
/* 286 */       this.mDataI = null;
/* 287 */       this.mDataB = null;
/*     */     }
/* 289 */     if (this.mData != null) {
/* 290 */       this.mImageDescription.setDataSize(this.mData.getSize());
/* 291 */       if (this.mImageSeq == null)
/* 292 */         setGWorld(this.port);
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setRedrawOptimised(boolean paramBoolean)
/*     */   {
/* 307 */     this.optimiseRedraw = paramBoolean;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public boolean isRedrawOptimised()
/*     */   {
/* 316 */     return this.optimiseRedraw;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void removeImageData()
/*     */     throws QTException
/*     */   {
/* 326 */     setGWorld(QDGraphics.scratch);
/* 327 */     this.mData = null;
/* 328 */     this.mDataI = null;
/* 329 */     this.mDataB = null;
/* 330 */     this.mDataR = null;
/* 331 */     this.mImageDescription = null;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public ImageDescription getDescription()
/*     */   {
/* 341 */     return this.mImageDescription;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public DSequence getDSequence()
/*     */   {
/* 353 */     return this.mImageSeq;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Region getClip()
/*     */     throws QTException
/*     */   {
/* 362 */     return this.clip;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public synchronized void setClip(Region paramRegion)
/*     */     throws StdQTException
/*     */   {
/* 371 */     if (this.mImageSeq != null) this.mImageSeq.setMask(paramRegion);
/* 372 */     this.clip = paramRegion;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void addedTo(Object paramObject)
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void removedFrom(Object paramObject)
/*     */   {
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Matrix getMatrix()
/*     */     throws StdQTException
/*     */   {
/* 402 */     return this.mImageSeq != null ? this.mImageSeq.getMatrix() : this.mat;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setMatrix(Matrix paramMatrix)
/*     */     throws QTException
/*     */   {
/* 416 */     if (this.mImageSeq != null) this.mImageSeq.setMatrix(paramMatrix);
/*     */
/* 418 */     this.mDisplayBounds.setX(paramMatrix.getTx() + 0.5F);
/* 419 */     this.mDisplayBounds.setY(paramMatrix.getTy() + 0.5F);
/* 420 */     this.mDisplayBounds.setWidth(this.origWidth * paramMatrix.getSx() + 0.5F);
/* 421 */     this.mDisplayBounds.setHeight(this.origHeight * paramMatrix.getSy() + 0.5F);
/* 422 */     this.mat = paramMatrix;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public Dimension getInitialSize()
/*     */     throws QTException
/*     */   {
/* 433 */     return new Dimension(this.origWidth, this.origHeight);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public QDDimension getOriginalSize()
/*     */     throws QTException
/*     */   {
/* 443 */     return new QDDimension(this.origWidth, this.origHeight);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public EncodedImage getImage()
/*     */   {
/* 452 */     return this.mData;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public QDGraphics getGWorld()
/*     */   {
/* 461 */     return this.port;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setGWorld(QDGraphics paramQDGraphics)
/*     */     throws QTException
/*     */   {
/* 474 */     if ((this.mData != null) && (this.mImageDescription != null)) {
/* 475 */       if (QDGraphics.scratch.equals(paramQDGraphics)) {
/* 476 */         this.mImageSeq = null;
/*     */       } else {
/* 478 */         this.mImageSeq = new DSequence(this.mImageDescription, paramQDGraphics, null, getMatrix(), getClip(), 0, 768, CodecComponent.bestFidelityCodec);
/*     */
/* 486 */         setGraphicsMode(this.gMode);
/*     */       }
/*     */     }
/* 489 */     this.port = paramQDGraphics;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setDisplayBounds(QDRect paramQDRect)
/*     */     throws StdQTException
/*     */   {
/* 501 */     Matrix localMatrix = new Matrix();
/*     */
/* 503 */     localMatrix.setTx(paramQDRect.getX());
/* 504 */     localMatrix.setTy(paramQDRect.getY());
/* 505 */     localMatrix.setSx(paramQDRect.getWidth() / this.origWidth);
/* 506 */     localMatrix.setSy(paramQDRect.getHeight() / this.origHeight);
/*     */
/* 508 */     if (this.mImageSeq != null) this.mImageSeq.setMatrix(localMatrix);
/* 509 */     this.mat = localMatrix;
/* 510 */     this.mDisplayBounds = paramQDRect;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setLocation(int paramInt1, int paramInt2)
/*     */     throws QTException
/*     */   {
/* 520 */     QDRect localQDRect = getDisplayBounds();
/* 521 */     localQDRect.setX(paramInt1);
/* 522 */     localQDRect.setY(paramInt2);
/* 523 */     setDisplayBounds(localQDRect);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public QDRect getDisplayBounds()
/*     */   {
/* 533 */     return this.mDisplayBounds;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public synchronized void redraw(Region paramRegion)
/*     */     throws QTException
/*     */   {
/* 545 */     if (this.mImageSeq == null) return;
/*     */
/* 547 */     long l = 0L;
/*     */
/* 549 */     if (paramRegion != null) {
/* 550 */       if (this.clip == null)
/* 551 */         this.mImageSeq.setMask(paramRegion);
/*     */       else
/* 553 */         this.mImageSeq.invalidate(paramRegion);
/* 554 */       doDraw();
/* 555 */       if (this.clip == null)
/* 556 */         this.mImageSeq.setMask(this.clip);
/*     */     } else {
/* 558 */       doDraw();
/*     */     }
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   protected final void doDraw()
/*     */     throws QTException
/*     */   {
/* 568 */     if (this.mDataR != null)
/* 569 */       this.mImageSeq.decompressFrameS(this.mDataR, 0);
/* 570 */     else if (this.mDataI != null)
/* 571 */       this.mImageSeq.decompressFrameS(this.mDataI, 0);
/* 572 */     else if (this.mDataB != null)
/* 573 */       this.mImageSeq.decompressFrameS(this.mDataB, 0);
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public void setGraphicsMode(GraphicsMode paramGraphicsMode)
/*     */     throws QTException
/*     */   {
/* 583 */     if (this.mImageSeq != null) this.mImageSeq.setGraphicsMode(paramGraphicsMode);
/* 584 */     this.gMode = paramGraphicsMode;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public GraphicsMode getGraphicsMode()
/*     */   {
/* 593 */     return this.gMode;
/*     */   }
/*     */
/*     */   /** @deprecated */
/*     */   public String toString()
/*     */   {
/* 601 */     return getClass().getName() + "[" + this.mData + "," + this.mImageDescription + "]";
/*     */   }
/*     */
/*     */   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.image.ImagePresenter
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.app.image.ImagePresenter

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.