Package quicktime.qd

Examples of quicktime.qd.QDRect


  {
    try
    {
      // create a new PictWindow
      PictWindow monitor = new PictWindow("Frame");
      QDRect rect = pic.getPictFrame();
      monitor.picture = pic;

      // convert to Image, then to ImageIcon for display
      Image image = util.ImageUtils.makeJimage(monitor.picture, rect.getWidth(),
        rect.getHeight());
      ImageIcon icon  = new ImageIcon(image);
      JLabel label = new JLabel(icon);
      monitor.getContentPane().add(label);
      monitor.pack();
      this.view.add(monitor);
View Full Code Here


        } // if (Thread.interrupted())
        Track video = mov.getIndTrackType(1, StdQTConstants.videoMediaType,
          StdQTConstants.movieTrackMediaType);
        Track newTrack = MovieUtils.addVideoTrack(video, temp);
        Matrix mat = new Matrix();
        QDRect from = mov.getBounds();
        QDRect to = null;
        int height = from.getHeight();
        int width = from.getWidth();
        int x = 0;
        int y = 0;
        if ((direction == 0) || (direction == 2))
        {
          height = Math.round(from.getHeight() * (float)1.0f/(i+1));
          y = j * height;
        } // if ((direction == 0) || (direction == 2))
        else if ((direction == 1) || (direction == 3))
        {
          width = Math.round(from.getWidth() * (float)1.0f/(i+1));
          x = j * width;
        } // else if ((direction == 1) || (direction == 3))
        to = new QDRect(x, y, width, height);
        mat.rect(from, to);
        newTrack.setMatrix(mat);
        newTrack.setLayer(-1);
      } // for
      result.add(temp);
View Full Code Here

    Rectangle2D rect = font.getStringBounds(text, context);
    int TEXT_TRACK_WIDTH = (int)rect.getWidth();
    int TEXT_TRACK_HEIGHT = (int)rect.getHeight();
    temp = null;
    tempF = null;
    QDRect textBox = new QDRect(0, 0, TEXT_TRACK_WIDTH, TEXT_TRACK_HEIGHT);

    // add text track
    Track textTrack;
    try
    {
      textTrack = movie.addTrack(TEXT_TRACK_WIDTH, TEXT_TRACK_HEIGHT, 0);
      Media textMedia = new TextMedia(textTrack, movie.getTimeScale());
      TextMediaHandler handler = (TextMediaHandler)textMedia.getHandler();
      textMedia.beginEdits();
      byte[] msgBytes = text.getBytes();
      QTPointer msgPoint = new QTPointer(msgBytes);
      handler.addTextSample(msgPoint, QDFont.getFNum(fontName), fontSize, style,
        new QDColor(fgColor[0] / 255f, fgColor[1] / 255f, fgColor[2] / 255f),
        new QDColor(bgColor[0] / 255f, bgColor[1] / 255f, bgColor[2] / 255f),
        QDConstants.teJustLeft, textBox, dfFlag, QDFont.getFNum(fontName), 0, 0,
        QDColor.white, Math.round(duration * movie.getTimeScale()));
      textMedia.endEdits();
      textTrack.insertMedia(Math.round(start * movie.getTimeScale()), 0,
        textMedia.getDuration(), 1);

      // position the text track to (x, y)
      Matrix mat = new Matrix();
      mat.rect(new QDRect(0, 0, TEXT_TRACK_WIDTH, TEXT_TRACK_HEIGHT),
        new QDRect(x, y, TEXT_TRACK_WIDTH, TEXT_TRACK_HEIGHT));
      textTrack.setMatrix(mat);
    } // try
    catch (Exception e)
    {
      e.printStackTrace();
View Full Code Here

    // insert media into track
    tcTrack.insertMedia(0, 0, tcMedia.getDuration(), 1);

    // set a transparent-background GrahpicsMode
    QDRect moveFrom = new QDRect(0, 0, width, height);
    QDRect moveTo = new QDRect(x, y, width, height);
    Matrix matrix = new Matrix();
    matrix.rect(moveFrom, moveTo);
    tcTrack.setMatrix (matrix);

    // if transparency is indicated, make the special value the transparent
View Full Code Here

    Movie composite = null;
    Movie movie1 = null;
    Movie movie2 = null;
    try
    {
      QDRect box1 = mov1.getBox();
      QDRect box2 = mov2.getBox();
      int height1 = box1.getHeight();
      int height2 = box2.getHeight();
      int width1 = box1.getWidth();
      int width2 = box2.getWidth();

      // variables for the matrix translations
      float a = 0, b = 0, c = 0, d = 0;
      movie1 = new Movie();
      movie2 = new Movie();
View Full Code Here

      // scaling factor to adjust aspect ratios
      float scale = changedaspect * (1 / originalaspect);

      // get track matrix to preserve other scaling changes
      Matrix stretch = video.getMatrix();
      QDRect oldsize = new QDRect(0, 0, dim_size.getWidthF(),
        dim_size.getHeightF());
      QDRect newsize;

      // determine whether the aspect ratio needs to be checked/maintained
      if (aspect)
      {
        if (originalaspect != changedaspect)
        {
          height = (int) (height * scale);
        } // if (originalaspect != changedaspect)
      } // if (aspect)
      newsize = new QDRect(0, 0, width, height);
      stretch.map(oldsize, newsize);
      video.setMatrix(stretch);
    } // try
    catch (QTException qte)
    {
View Full Code Here

        StdQTConstants.movieTrackCharacteristic);
      trackBack = MovieUtils.addVideoTrack(trackBack, result);

      // make sure both tracks have their actual size
      Matrix matrix1 = new Matrix();
      QDRect from1 = new QDRect(0, 0, trackFore.getSize().getWidth(),
        trackFore.getSize().getHeight());
      QDRect to1 = new QDRect(0, 0,
        movFore.getDisplayBoundsRgn().getBounds().getWidth(),
        movFore.getDisplayBoundsRgn().getBounds().getHeight());
      matrix1.map(from1, to1);
      Matrix matrix2 = new Matrix();
      QDRect from2 = new QDRect(0, 0, trackBack.getSize().getWidth(),
        trackBack.getSize().getHeight());
      QDRect to2 = new QDRect(0, 0,
        movBack.getDisplayBoundsRgn().getBounds().getWidth(),
        movBack.getDisplayBoundsRgn().getBounds().getHeight());
      matrix2.map(from2, to2);

      GraphicsMode graph = new GraphicsMode(QDConstants.transparent, key);
View Full Code Here

      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
View Full Code Here

            _videoTrack = _movie.addTrack(_frameWidth, _frameHeight, kNoVolume);
            _videoMedia = new VideoMedia(_videoTrack, kVidTimeScale);

            _videoMedia.beginEdits();

            _videoSize = new QDRect(_frameWidth, _frameHeight);
            _gw = new QDGraphics(_videoSize);

            int size = QTImage.getMaxCompressionSize(_gw, _videoSize, _gw
                    .getPixMap().getPixelSize(), codecNormalQuality,
                    kAnimationCodecType, CodecComponent.anyCodec);
View Full Code Here

            _videoTrack = _movie.addTrack(_frameWidth, _frameHeight, kNoVolume);
            _videoMedia = new VideoMedia(_videoTrack, kVidTimeScale);

            _videoMedia.beginEdits();

            _videoSize = new QDRect(_frameWidth, _frameHeight);
            _gw = new QDGraphics(_videoSize);

            int size = QTImage.getMaxCompressionSize(_gw, _videoSize, _gw
                    .getPixMap().getPixelSize(), codecNormalQuality,
                    kAnimationCodecType, CodecComponent.anyCodec);
View Full Code Here

TOP

Related Classes of quicktime.qd.QDRect

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.