2 * PROJECT: NyARToolkit QuickTime sample program.
3 * --------------------------------------------------------------------------------
5 * Copyright (c) 2008 nyatla
6 * airmail(at)ebony.plala.or.jp
7 * http://nyatla.jp/nyartoolkit/
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 package jp.nyatla.nyartoolkit.qt.sample;
29 import jp.nyatla.nyartoolkit.NyARException;
30 import jp.nyatla.nyartoolkit.qt.utils.*;
37 public class QtCaptureTest extends Frame implements QtCaptureListener
39 private static final long serialVersionUID = -734697739607654631L;
41 public QtCaptureTest() throws NyARException
43 setTitle("QtCaptureTest");
44 setBounds(0, 0, 320 + 64, 240 + 64);
45 capture = new QtCameraCapture(320, 240, 30f);
46 capture.setCaptureListener(this);
48 raster = new QtNyARRaster_RGB(320, 240);
51 private QtCameraCapture capture;
53 private QtNyARRaster_RGB raster;
55 public void onUpdateBuffer(byte[] pixels)
57 raster.setBuffer(pixels);
58 Image img = raster.createImage();
59 Graphics g = getGraphics();
60 g.drawImage(img, 32, 32, this);
63 private void startCapture()
67 } catch (Exception e) {
72 public static void main(String[] args)
75 QtCaptureTest mainwin = new QtCaptureTest();
76 mainwin.setVisible(true);
77 mainwin.startCapture();
78 } catch (Exception e) {