package controller;
//----- JDK Imports ------------------------------------------------------------
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
//----- Quicktime Imports ------------------------------------------------------
import quicktime.qd.Pict;
import quicktime.qd.QDRect;
//----- Phoenix Imports --------------------------------------------------------
import view.PhoenixWindow;
import view.PictWindow;
/**
* Video Phoenix
* Version 0.2.0
* Copyright (c) 2007 Lunderskov, Ian; Pan, Jiabei; Rebelsky, Samuel;
* Whisenhunt, Heather; Young, Ian; Zuleta Benavides, Luis.
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* @author Pan, Jiabei; Rebelsky, Samuel; Whisenhunt, Heather.
* @author Glimmer Labs
* @version 0.2.0
*/
public class PictController
{
/*--------*-------------------------------------------------------------------
* Fields *
*--------*/
// this controller's instance of Phoenix
PhoenixController phoenix;
// main display window
PhoenixWindow view;
/*--------------*-------------------------------------------------------------
* Constructors *
*--------------*/
/**
* Create a new PictController
*
* @param phoenix PhoenixController for this PictController
*/
public PictController(PhoenixController phoenix)
{
this.phoenix = phoenix;
this.view = this.phoenix.view;
} // PictController(PhoenixController)
/*---------*------------------------------------------------------------------
* Methods *
*---------*/
/**
* Create a new PictMonitor and display a Pict
*
* @param pic QuickTime Pict to be displayed
*/
public void showPict(Pict pic)
{
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);
monitor.moveToFront();
} // try
catch (Exception e)
{
e.printStackTrace();
} // catch (Exception)
} // showPict(Pict)
} // class PictController