/* */ package quicktime.app.image;
/* */
/* */ import java.awt.Dimension;
/* */ import java.awt.image.ColorModel;
/* */ import java.awt.image.DirectColorModel;
/* */ import java.awt.image.ImageConsumer;
/* */ import java.awt.image.ImageProducer;
/* */ import java.util.Enumeration;
/* */ import java.util.Hashtable;
/* */ import java.util.Vector;
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.app.display.QTDrawable;
/* */ import quicktime.app.players.MoviePlayer;
/* */ import quicktime.app.players.QTPlayer;
/* */ import quicktime.app.spaces.Space;
/* */ import quicktime.app.time.Timeable;
/* */ import quicktime.jdirect.QTNative;
/* */ import quicktime.qd.PixMap;
/* */ import quicktime.qd.QDGraphics;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.qd.Region;
/* */ import quicktime.std.movies.MovieController;
/* */ import quicktime.util.RawEncodedImage;
/* */
/* */ /** @deprecated */
/* */ public class QTImageProducer
/* */ implements ImageProducer, Redrawable
/* */ {
/* */ private static final boolean debug = false;
/* 64 */ private static long msecs = 0L;
/* */ private static final boolean profile = false;
/* */ private Dimension size;
/* */ private int rowInts;
/* */ private QDGraphics gw;
/* */ private PixMap pm;
/* */ private int[] pixels;
/* */ private QTDrawable qtSource;
/* 114 */ private ColorModel cm = new DirectColorModel(32, 16711680, 65280, 255, 0);
/* 115 */ private Hashtable props = new Hashtable();
/* 116 */ private Vector consumers = new Vector();
/* */ private boolean doesRedraw;
/* */ private boolean singleFrame;
/* */
/* */ private static boolean requiresRedrawing(QTDrawable paramQTDrawable)
/* */ {
/* 68 */ return ((paramQTDrawable instanceof Space)) || ((paramQTDrawable instanceof Timeable)) || (((paramQTDrawable instanceof Redrawable)) && (!((Redrawable)paramQTDrawable).isSingleFrame()));
/* */ }
/* */
/* */ /** @deprecated */
/* */ public QTImageProducer(QTDrawable paramQTDrawable, Dimension paramDimension)
/* */ throws QTException
/* */ {
/* 81 */ if ((paramQTDrawable instanceof QTPlayer))
/* 82 */ paramQTDrawable = new MoviePlayer(((QTPlayer)paramQTDrawable).getMovieController().getMovie());
/* 83 */ this.qtSource = paramQTDrawable;
/* 84 */ setRedrawing(requiresRedrawing(paramQTDrawable));
/* 85 */ this.singleFrame = (!isRedrawing());
/* 86 */ this.size = paramDimension;
/* 87 */ this.gw = new QDGraphics(new QDRect(this.size));
/* 88 */ paramQTDrawable.setDisplayBounds(new QDRect(this.size));
/* 89 */ paramQTDrawable.setGWorld(this.gw);
/* 90 */ this.pm = this.gw.getPixMap();
/* 91 */ this.rowInts = (this.pm.getRowBytes() / 4);
/* 92 */ this.pixels = new int[this.rowInts * this.size.height];
/* 93 */ paramQTDrawable.redraw(null);
/* 94 */ copyPixels();
/* 95 */ if (isSingleFrame()) {
/* 96 */ this.gw.disposeQTObject();
/* 97 */ this.gw = null;
/* 98 */ this.pm = null;
/* 99 */ this.qtSource = null;
/* */ }
/* */ }
/* */
/* */ public QDGraphics getGWorld() {
/* 104 */ return this.gw;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isSingleFrame()
/* */ {
/* 127 */ return this.singleFrame;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void addConsumer(ImageConsumer paramImageConsumer)
/* */ {
/* 142 */ if (isConsumer(paramImageConsumer)) return;
/* */
/* */ try
/* */ {
/* 147 */ this.consumers.addElement(paramImageConsumer);
/* 148 */ paramImageConsumer.setDimensions(this.size.width, this.size.height);
/* */
/* 151 */ if (isConsumer(paramImageConsumer)) {
/* 152 */ paramImageConsumer.setProperties(this.props);
/* */ }
/* */ else {
/* 155 */ return;
/* */ }
/* 157 */ if (isConsumer(paramImageConsumer)) {
/* 158 */ paramImageConsumer.setColorModel(this.cm);
/* */ }
/* */ else {
/* 161 */ return;
/* */ }
/* 163 */ if (isConsumer(paramImageConsumer)) {
/* 164 */ int i = 14;
/* 165 */ if (isSingleFrame())
/* 166 */ i |= 16;
/* 167 */ paramImageConsumer.setHints(i);
/* */ }
/* */ }
/* */ catch (Exception localException) {
/* 171 */ if (isConsumer(paramImageConsumer))
/* 172 */ paramImageConsumer.imageComplete(1);
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized boolean isConsumer(ImageConsumer paramImageConsumer)
/* */ {
/* 186 */ return this.consumers.contains(paramImageConsumer);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void removeConsumer(ImageConsumer paramImageConsumer)
/* */ {
/* 201 */ this.consumers.removeElement(paramImageConsumer);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void startProduction(ImageConsumer paramImageConsumer)
/* */ {
/* 216 */ synchronized (QTNative.globalsLock) {
/* 217 */ synchronized (this)
/* */ {
/* */ try {
/* 220 */ addConsumer(paramImageConsumer);
/* 221 */ if (isConsumer(paramImageConsumer)) {
/* 222 */ paramImageConsumer.setPixels(0, 0, this.size.width, this.size.height, this.cm, this.pixels, 0, this.rowInts);
/* */ }
/* */ else {
/* 225 */ return;
/* */ }
/* 227 */ if (isConsumer(paramImageConsumer))
/* 228 */ if (isSingleFrame()) {
/* 229 */ paramImageConsumer.imageComplete(3);
/* 230 */ if (isConsumer(paramImageConsumer)) {
/* 231 */ paramImageConsumer.imageComplete(1);
/* 232 */ removeConsumer(paramImageConsumer);
/* */ }
/* */ } else {
/* 235 */ paramImageConsumer.imageComplete(2);
/* */ }
/* */ }
/* */ catch (Exception localException)
/* */ {
/* 240 */ if (isConsumer(paramImageConsumer))
/* 241 */ paramImageConsumer.imageComplete(1);
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void requestTopDownLeftRightResend(ImageConsumer paramImageConsumer)
/* */ {
/* */ }
/* */
/* */ private synchronized void copyPixels()
/* */ throws QTException
/* */ {
/* 277 */ RawEncodedImage localRawEncodedImage = this.pm.getPixelData();
/* 278 */ localRawEncodedImage.copyToArray(0, this.pixels, 0, this.pixels.length);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void redraw(Region paramRegion)
/* */ throws QTException
/* */ {
/* 302 */ if ((!this.consumers.isEmpty()) || (!isSingleFrame()))
/* */ {
/* 308 */ this.qtSource.redraw(null);
/* */ }
/* 310 */ else return;
/* */
/* 312 */ updateConsumers(paramRegion);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void updateConsumers(Region paramRegion)
/* */ throws QTException
/* */ {
/* 326 */ if (!isSingleFrame())
/* 327 */ copyPixels();
/* 328 */ int m = 0;
/* */ int i;
/* */ int j;
/* */ int k;
/* 329 */ if (paramRegion != null) {
/* 330 */ localObject = paramRegion.getRgnBBox();
/* 331 */ i = ((QDRect)localObject).getX();
/* 332 */ j = ((QDRect)localObject).getY();
/* 333 */ k = ((QDRect)localObject).getWidth();
/* 334 */ m = ((QDRect)localObject).getHeight();
/* */ } else {
/* 336 */ i = 0;
/* 337 */ j = 0;
/* 338 */ k = this.size.width;
/* 339 */ m = this.size.height;
/* */ }
/* */
/* 343 */ Object localObject = this.consumers.elements();
/* 344 */ while (((Enumeration)localObject).hasMoreElements()) {
/* 345 */ ImageConsumer localImageConsumer = (ImageConsumer)((Enumeration)localObject).nextElement();
/* 346 */ localImageConsumer.setPixels(i, j, k, m, this.cm, this.pixels, 0, this.rowInts);
/* */
/* 349 */ if (isConsumer(localImageConsumer))
/* 350 */ localImageConsumer.imageComplete(2);
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public synchronized void setRedrawing(boolean paramBoolean)
/* */ {
/* 368 */ this.doesRedraw = paramBoolean;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isRedrawing()
/* */ {
/* 378 */ return this.doesRedraw;
/* */ }
/* */
/* */ public Dimension getSize()
/* */ {
/* 383 */ return new Dimension(this.size);
/* */ }
/* */
/* */ static
/* */ {
/* 58 */ if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/* 59 */ 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.QTImageProducer
* JD-Core Version: 0.6.2
*/