Package quicktime.std.image

Examples of quicktime.std.image.GraphicsImporter


  public static Image makeJimage(Pict pic, int width, int height)
  throws QTException
  {

    // graphics importer and a graphicsImporterDrawer
    GraphicsImporter gi  = new GraphicsImporter(
      StdQTConstants.kQTFileTypePicture);
    GraphicsImporterDrawer gid = new GraphicsImporterDrawer(gi);

    // Add 512 byte header so the grapics importer will think that it's dealing
    // with a pict file

    byte[] newPictBytes = new byte[pic.getSize() + 512];
    pic.copyToArray(0, newPictBytes, 512, newPictBytes.length - 512);
    pic = new Pict(newPictBytes);

    // export the pict
    DataRef ref = new DataRef(pic, StdQTConstants.kDataRefQTFileTypeTag,
    "PICT");
    gi.setDataReference(ref);
    Dimension dim = new Dimension(width, height);
    QTImageProducer ip  = new QTImageProducer(gid, dim);

    // convert to java.awt.Image and then to image icon
    Image image = Toolkit.getDefaultToolkit().createImage(ip);
View Full Code Here


  /* get a pict from a QTFile */
  private static Pict pictFromFile(QTFile file)
  throws QTException
  {
    GraphicsImporter gi = new GraphicsImporter(file);
    return gi.getAsPicture();
  } // pictFromFile(QTFile)
View Full Code Here

      // create media for new track
      VideoMedia videoMedia = new VideoMedia(videoTrack, timeScale);

      // get a GraphicsImporter
      GraphicsImporter gi = new GraphicsImporter(
        StdQTConstants.kQTFileTypePicture);

      // create an offscreen QDGraphics / GWorld the size of the picts
      // importer will draw into this and pass to CSequence
      QDGraphics gw = new QDGraphics(new QDRect(0, 0, WIDTH, HEIGHT));

      // set importer's GWorld
      gi.setGWorld(gw, null);
      QDRect gRect = new QDRect(0, 0, WIDTH, HEIGHT);

      // add images to media
      videoMedia.beginEdits();
      int frames = pics.length;
      int rawImageSize = QTImage.getMaxCompressionSize(gw, gRect,
        gw.getPixMap().getPixelSize(), StdQTConstants.codecLosslessQuality,
        CODEC_TYPE, CodecComponent.bestFidelityCodec);
      QTHandle imageHandle = new QTHandle(rawImageSize, true);
      imageHandle.lock();
      RawEncodedImage compressed = RawEncodedImage.fromQTHandle(imageHandle);
      CSequence seq = new CSequence(gw, gRect, gw.getPixMap().getPixelSize(),
        CODEC_TYPE, CodecComponent.bestFidelityCodec,
        StdQTConstants.codecLosslessQuality,
        StdQTConstants.codecLosslessQuality,
        KEY_FRAME_RATE, null, StdQTConstants.codecFlagUpdatePrevious);
      ImageDescription imgDesc = seq.getDescription();

      // attempt to loop through all frames, scaling to fit the first frame
      for (int x = 0; x < frames; x++)
      {
        QDRect srcRect = new QDRect(0, 0, pics[x].getPictFrame().getWidthF(),
          pics[x].getPictFrame().getHeightF());

        // add 512 byte header so the grapics importer will think that it's
        // dealing with a pict file

        byte[] newPictBytes = new byte[pics[x].getSize() + 512];
        pics[x].copyToArray(0, newPictBytes, 512, newPictBytes.length - 512);
        pics[x] = new Pict(newPictBytes);

        // export the pict
        DataRef ref = new DataRef(pics[x],
          StdQTConstants.kDataRefQTFileTypeTag, "PICT");
        gi.setDataReference(ref);

        // create matrix to represent scaling of each pict
        Matrix drawMatrix = new Matrix();
        drawMatrix.rect(srcRect, gRect);
        gi.setMatrix(drawMatrix);
        gi.draw();

        // compress frame
        CompressedFrameInfo cfInfo = seq.compressFrame(gw, gRect,
          StdQTConstants.codecFlagUpdatePrevious, compressed);
View Full Code Here

/*     */       }
/*     */     }
/*     */
/* 425 */     DataRef localDataRef = new DataRef(paramString);
/*     */
/* 427 */     GraphicsImporter localGraphicsImporter = importImage(localDataRef);
/* 428 */     Movie localMovie = null;
/* 429 */     if (localGraphicsImporter != null) {
/* 430 */       localMovie = checkIfMovie(localDataRef);
/* 431 */       if (localMovie == null) {
/* 432 */         return paramQTDrawableMaker.fromGraphicsImporter(localGraphicsImporter);
View Full Code Here

/* 455 */     return new QTHandle(arrayOfByte);
/*     */   }
/*     */
/*     */   private static GraphicsImporter openAsImage(QTFile paramQTFile) throws QTException {
/*     */     try {
/* 460 */       return new GraphicsImporter(paramQTFile); } catch (StdQTException localStdQTException) {
/*     */     }
/* 462 */     return null;
/*     */   }
View Full Code Here

/* 462 */     return null;
/*     */   }
/*     */
/*     */   private static GraphicsImporter openAsImage(DataRef paramDataRef) throws QTException {
/*     */     try {
/* 467 */       return new GraphicsImporter(paramDataRef); } catch (StdQTException localStdQTException) {
/*     */     }
/* 469 */     return null;
/*     */   }
View Full Code Here

/* 469 */     return null;
/*     */   }
/*     */
/*     */   private static GraphicsImporter importImage(DataRef paramDataRef) throws QTException {
/*     */     try {
/* 474 */       return new GraphicsImporter(paramDataRef);
/*     */     } catch (QTException localQTException) {
/*     */     }
/* 477 */     return null;
/*     */   }
View Full Code Here

/* 434 */     return new QTHandle(arrayOfByte);
/*     */   }
/*     */
/*     */   private static GraphicsImporter openAsImage(QTFile paramQTFile) throws QTException {
/*     */     try {
/* 439 */       return new GraphicsImporter(paramQTFile); } catch (StdQTException localStdQTException) {
/*     */     }
/* 441 */     return null;
/*     */   }
View Full Code Here

/* 441 */     return null;
/*     */   }
/*     */
/*     */   private static GraphicsImporter openAsImage(DataRef paramDataRef) throws QTException {
/*     */     try {
/* 446 */       return new GraphicsImporter(paramDataRef); } catch (StdQTException localStdQTException) {
/*     */     }
/* 448 */     return null;
/*     */   }
View Full Code Here

/* 448 */     return null;
/*     */   }
/*     */
/*     */   private static GraphicsImporter importImage(DataRef paramDataRef) throws QTException {
/*     */     try {
/* 453 */       return new GraphicsImporter(paramDataRef);
/*     */     } catch (QTException localQTException) {
/*     */     }
/* 456 */     return null;
/*     */   }
View Full Code Here

TOP

Related Classes of quicktime.std.image.GraphicsImporter

Copyright © 2018 www.massapicom. 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.