/* */ package quicktime.app.image;
/* */
/* */ import java.io.File;
/* */ import java.io.FileNotFoundException;
/* */ import java.io.IOException;
/* */ import java.util.Vector;
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.io.QTFile;
/* */ import quicktime.qd.PixMap;
/* */ import quicktime.qd.QDColor;
/* */ import quicktime.qd.QDGraphics;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.qd.Region;
/* */ import quicktime.std.image.CSequence;
/* */ import quicktime.std.image.CodecComponent;
/* */ import quicktime.std.image.ImageDescription;
/* */ import quicktime.std.image.ImageSequenceDataSource;
/* */ import quicktime.std.movies.Track;
/* */ import quicktime.std.movies.media.Media;
/* */ import quicktime.std.movies.media.MediaSample;
/* */ import quicktime.util.EncodedImage;
/* */ import quicktime.util.QTHandle;
/* */ import quicktime.util.QTHandleRef;
/* */ import quicktime.util.QTPointerRef;
/* */ import quicktime.util.QTUtils;
/* */ import quicktime.util.RawEncodedImage;
/* */
/* */ /** @deprecated */
/* */ public final class ImageUtil
/* */ {
/* 31 */ private static boolean apriori = QTSession.apriori();
/* */ private static final boolean debug = false;
/* */ public static final int kHitTestRgnSrc = 1768776048;
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence makeTransparent(ImageSpec paramImageSpec, QDColor paramQDColor)
/* */ throws QTException
/* */ {
/* 59 */ return makeTransparent(paramImageSpec, paramQDColor, new QDGraphics(16, paramImageSpec.getDescription().getBounds()), null, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence makeTransparent(ImageSpec paramImageSpec, QDColor paramQDColor, QDGraphics paramQDGraphics)
/* */ throws QTException
/* */ {
/* 82 */ return makeTransparent(paramImageSpec, paramQDColor, paramQDGraphics, null, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence makeTransparent(ImageSpec paramImageSpec, QDColor paramQDColor, QDGraphics paramQDGraphics, Region paramRegion)
/* */ throws QTException
/* */ {
/* 107 */ return makeTransparent(paramImageSpec, paramQDColor, paramQDGraphics, paramRegion, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence makeTransparent(ImageDataSequence paramImageDataSequence, QDColor paramQDColor, QDGraphics paramQDGraphics, Region[] paramArrayOfRegion)
/* */ throws QTException
/* */ {
/* 134 */ return makeTransparent(paramImageDataSequence, paramQDColor, paramQDGraphics, null, paramArrayOfRegion);
/* */ }
/* */
/* */ private static ImageDataSequence makeTransparent(ImageSpec paramImageSpec, QDColor paramQDColor, QDGraphics paramQDGraphics, Region paramRegion, Region[] paramArrayOfRegion)
/* */ throws QTException
/* */ {
/* 155 */ QDRect localQDRect = paramQDGraphics.getPortRect();
/* 156 */ PixMap localPixMap1 = paramQDGraphics.getPixMap();
/* 157 */ int i = localPixMap1.getPixelSize();
/* */
/* 159 */ int j = (paramRegion != null) || (paramArrayOfRegion != null) ? 1 : 0;
/* */
/* 161 */ DSequenceFromMemory localDSequenceFromMemory = new DSequenceFromMemory(paramImageSpec);
/* 162 */ localDSequenceFromMemory.setGWorld(paramQDGraphics);
/* 163 */ ImageDataSequence localImageDataSequence1 = new ImageDataSequence();
/* */
/* 165 */ CSequenceToMemory localCSequenceToMemory = new CSequenceToMemory(2);
/* */
/* 167 */ QDGraphics localQDGraphics1 = null;
/* 168 */ QDGraphics localQDGraphics2 = null;
/* 169 */ PixMap localPixMap2 = null;
/* 170 */ ImageDescription localImageDescription = null;
/* 171 */ ImageSequenceDataSource localImageSequenceDataSource = null;
/* 172 */ if (j != 0) {
/* 173 */ localQDGraphics1 = new QDGraphics(localQDRect);
/* 174 */ localQDGraphics2 = new QDGraphics(8, localQDRect);
/* 175 */ localPixMap2 = localQDGraphics2.getPixMap();
/* 176 */ localImageDescription = new ImageDescription(localPixMap2);
/* 177 */ localImageDescription.lock();
/* */ }
/* */
/* 180 */ if ((paramImageSpec instanceof ImageDataSequence)) {
/* 181 */ ImageDataSequence localImageDataSequence2 = (ImageDataSequence)paramImageSpec;
/* 182 */ for (int k = 1; k <= localImageDataSequence2.size(); k++)
/* */ {
/* 184 */ if (j != 0) {
/* 185 */ localCSequenceToMemory.begin(localQDGraphics1, localQDRect, i, 1919706400, CodecComponent.anyCodec, 1024, 1024, 2, paramImageSpec.getDescription().getCTable(), 0);
/* */
/* 196 */ localImageSequenceDataSource = new ImageSequenceDataSource(localCSequenceToMemory.getSequence(), 1768776048, 1, localImageDescription);
/* 197 */ localImageSequenceDataSource.setSourceData(RawEncodedImage.fromPixMap(localPixMap2));
/* */
/* 199 */ localQDGraphics1.setBackColor(paramQDColor);
/* 200 */ localQDGraphics1.eraseRect(null);
/* 201 */ localQDGraphics2.setBackColor(QDColor.white);
/* 202 */ localQDGraphics2.eraseRect(null);
/* 203 */ localQDGraphics2.setForeColor(QDColor.black);
/* 204 */ localQDGraphics2.paintRgn(paramRegion != null ? paramRegion : paramArrayOfRegion[(k - 1)]);
/* */
/* 207 */ localCSequenceToMemory.compressFrame(localQDGraphics1, localQDRect, 0);
/* */
/* 209 */ localCSequenceToMemory.getSequence().setPrev(localQDGraphics1, null);
/* */
/* 211 */ paramQDGraphics.setBackColor(paramQDColor);
/* 212 */ paramQDGraphics.eraseRect(null);
/* */ } else {
/* 214 */ localCSequenceToMemory.begin(paramQDGraphics, localQDRect, i, 1919706400, CodecComponent.anyCodec, 1024, 1024, 2, paramImageSpec.getDescription().getCTable(), 0);
/* */
/* 225 */ paramQDGraphics.setBackColor(paramQDColor);
/* 226 */ paramQDGraphics.eraseRect(null);
/* */
/* 228 */ localCSequenceToMemory.compressFrame(paramQDGraphics, localQDRect, 4);
/* */ }
/* */
/* 232 */ localDSequenceFromMemory.redraw(null);
/* */
/* 234 */ localCSequenceToMemory.compressFrame(paramQDGraphics, localQDRect, j != 0 ? 0 : 4);
/* */
/* 237 */ if (k == 1) {
/* 238 */ localImageDataSequence1.setDescription(localCSequenceToMemory.getDescription());
/* 239 */ localImageDataSequence1.getDescription().setFrameCount(localImageDataSequence2.size());
/* */ }
/* */
/* 243 */ localImageDataSequence1.append((EncodedImage)localCSequenceToMemory.getFrames().elementAt(1));
/* */
/* 245 */ localDSequenceFromMemory.setFrameNext();
/* */
/* 247 */ if (k % 3 == 0) QTUtils.reclaimMemory();
/* */ }
/* */ }
/* 250 */ else { if (j != 0) {
/* 251 */ localCSequenceToMemory.begin(localQDGraphics1, localQDRect, i, 1919706400, CodecComponent.anyCodec, 1024, 1024, 2, paramImageSpec.getDescription().getCTable(), 0);
/* */
/* 261 */ localImageSequenceDataSource = new ImageSequenceDataSource(localCSequenceToMemory.getSequence(), 1768776048, 1, localImageDescription);
/* 262 */ localImageSequenceDataSource.setSourceData(RawEncodedImage.fromPixMap(localPixMap2));
/* */
/* 264 */ localQDGraphics1.setBackColor(paramQDColor);
/* 265 */ localQDGraphics1.eraseRect(null);
/* 266 */ localQDGraphics2.setBackColor(QDColor.white);
/* 267 */ localQDGraphics2.eraseRect(null);
/* 268 */ localQDGraphics2.setForeColor(QDColor.black);
/* 269 */ localQDGraphics2.paintRgn(paramRegion != null ? paramRegion : paramArrayOfRegion[0]);
/* */
/* 272 */ localCSequenceToMemory.compressFrame(localQDGraphics1, localQDRect, 0);
/* */
/* 274 */ localCSequenceToMemory.getSequence().setPrev(localQDGraphics1, null);
/* */
/* 276 */ paramQDGraphics.setBackColor(paramQDColor);
/* 277 */ paramQDGraphics.eraseRect(null);
/* */ } else {
/* 279 */ localCSequenceToMemory.begin(paramQDGraphics, localQDRect, i, 1919706400, CodecComponent.anyCodec, 1024, 1024, 2, paramImageSpec.getDescription().getCTable(), 0);
/* */
/* 290 */ paramQDGraphics.setBackColor(paramQDColor);
/* 291 */ paramQDGraphics.eraseRect(null);
/* */
/* 293 */ localCSequenceToMemory.compressFrame(paramQDGraphics, localQDRect, 4);
/* */ }
/* */
/* 297 */ localDSequenceFromMemory.redraw(null);
/* */
/* 299 */ localCSequenceToMemory.compressFrame(paramQDGraphics, localQDRect, j != 0 ? 0 : 4);
/* */
/* 302 */ localImageDataSequence1.setDescription(localCSequenceToMemory.getDescription());
/* 303 */ localImageDataSequence1.getDescription().setFrameCount(1);
/* */
/* 305 */ localImageDataSequence1.append((EncodedImage)localCSequenceToMemory.getFrames().elementAt(1));
/* */ }
/* */
/* 308 */ localPixMap1 = null;
/* 309 */ paramQDGraphics = null;
/* */
/* 311 */ return localImageDataSequence1;
/* */ }
/* */
/* */ private static File checkDir(String paramString)
/* */ throws IOException
/* */ {
/* 318 */ int i = paramString.charAt(paramString.length() - 1);
/* 319 */ if (i != 47) paramString = paramString + "/";
/* */
/* 321 */ File localFile = new File(paramString);
/* 322 */ if (!localFile.isDirectory()) throw new IOException(paramString);
/* 323 */ return localFile;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence createSequence(Track paramTrack)
/* */ throws QTException
/* */ {
/* 337 */ Media localMedia = Media.getTrackMedia(paramTrack);
/* 338 */ int i = localMedia.getSampleCount();
/* 339 */ int j = 0;
/* 340 */ ImageDataSequence localImageDataSequence = new ImageDataSequence((ImageDescription)localMedia.getSampleDescription(1));
/* 341 */ for (int k = 1; k <= i; k++) {
/* 342 */ MediaSample localMediaSample = localMedia.getSample(0, j, 1);
/* 343 */ if (localMediaSample.descriptionIndex != 1)
/* */ break;
/* 345 */ QTPointerRef localQTPointerRef = ((QTHandleRef)localMediaSample.data.clone()).toQTPointer();
/* 346 */ localImageDataSequence.addMember(RawEncodedImage.fromQTPointer(localQTPointerRef));
/* 347 */ j += localMediaSample.duration;
/* 348 */ if (k % 5 == 0)
/* 349 */ QTUtils.reclaimMemory();
/* */ }
/* 351 */ QTUtils.reclaimMemory();
/* 352 */ return localImageDataSequence;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence createSequence(File paramFile)
/* */ throws IOException, QTException
/* */ {
/* 370 */ return createSequence(paramFile, new FileFilter());
/* */ }
/* */
/* */ /** @deprecated */
/* */ public static ImageDataSequence createSequence(File paramFile, FileFilter paramFileFilter)
/* */ throws IOException, QTException
/* */ {
/* 389 */ if (!paramFile.exists()) throw new FileNotFoundException(paramFile.getAbsolutePath());
/* */
/* 397 */ String str1 = paramFile.getParent();
/* 398 */ if (str1.charAt(str1.length() - 1) != File.separatorChar) {
/* 399 */ str1 = str1 + File.separatorChar;
/* */ }
/* 401 */ String str2 = paramFile.getName();
/* 402 */ paramFileFilter.extractPrefixAndSuffix(str2);
/* */
/* 406 */ File localFile = new File(str1);
/* 407 */ if (!localFile.isDirectory()) throw new IOException(str1);
/* */
/* 410 */ String[] arrayOfString = localFile.list(paramFileFilter);
/* */
/* 413 */ if (paramFileFilter != null) {
/* 414 */ arrayOfString = paramFileFilter.postProcess(arrayOfString);
/* */ }
/* */
/* 417 */ ImageDataSequence localImageDataSequence = new ImageDataSequence();
/* 418 */ int i = 0;
/* */
/* 420 */ for (int j = 0; j < arrayOfString.length; j++) {
/* 421 */ QTFile localQTFile = null;
/* 422 */ localQTFile = new QTFile(str1 + arrayOfString[j]);
/* 423 */ GraphicsImporterDrawer localGraphicsImporterDrawer = new GraphicsImporterDrawer(localQTFile);
/* */
/* 431 */ if ((j == 0) || (localImageDataSequence.isEmpty())) {
/* 432 */ localImageDataSequence.setDescription(localGraphicsImporterDrawer.getDescription());
/* */ }
/* 434 */ localImageDataSequence.append(localGraphicsImporterDrawer.getImage());
/* 435 */ i++;
/* */ }
/* */
/* 438 */ if (localImageDataSequence == null) throw new FileNotFoundException(paramFile.getAbsolutePath());
/* 439 */ localImageDataSequence.getDescription().setFrameCount(i);
/* 440 */ return localImageDataSequence;
/* */ }
/* */
/* */ static
/* */ {
/* 34 */ if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/* 35 */ 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.ImageUtil
* JD-Core Version: 0.6.2
*/