OSDN Git Service

[backup]NyARToolkit
authornyatla <nyatla@7cac0a50-4618-4814-88d0-24b83990f816>
Wed, 13 Jan 2010 14:17:53 +0000 (14:17 +0000)
committernyatla <nyatla@7cac0a50-4618-4814-88d0-24b83990f816>
Wed, 13 Jan 2010 14:17:53 +0000 (14:17 +0000)
+INyARBufferReaderの廃止とINyARRasterへの統合。
+付随する修正

git-svn-id: http://svn.sourceforge.jp/svnroot/nyartoolkit/NyARToolkit@382 7cac0a50-4618-4814-88d0-24b83990f816

98 files changed:
trunk/sample/java3d/.classpath
trunk/sample/jmf/jp/nyatla/nyartoolkit/jmf/sample/LabelingViewer.java [new file with mode: 0644]
trunk/sample/jmf/jp/nyatla/nyartoolkit/jmf/sample/NyarToolkitLinkTest.java
trunk/sample/jogl/jp/nyatla/nyartoolkit/jogl/sample/JavaSimpleLite.java
trunk/sample/jogl/jp/nyatla/nyartoolkit/jogl/sample/JavaSimpleLite2.java
trunk/sample/jogl/jp/nyatla/nyartoolkit/jogl/sample/SingleARMarker.java
trunk/sample/jogl/jp/nyatla/nyartoolkit/jogl/sample/SingleNyIdMarker.java
trunk/sample/qt/.classpath
trunk/sample/qt/jp/nyatla/nyartoolkit/qt/sample/NyarToolkitLinkTest.java
trunk/sample/qt/jp/nyatla/nyartoolkit/qt/sample/QtCaptureTest.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasteranalyzer/NyARRasterDetector_QrCodeEdge.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasteranalyzer/threshold/NyARRasterThresholdAnalyzer_DiffHistgram.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_Edge.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterOperator_Mul.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_CbCrCut.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_RgbOr.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/types/NyARFixedFloat16Point3d.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/core/types/matrix/NyARFixedFloat24Matrix33.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/qrcode/NyARQrCodeDetector.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/qrcode/NyARRasterFilter_QrAreaAverage.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/qrcode/NyARSingleQrDetector.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/qrcode/SingleQrTest.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/quadx2/NyARRasterFilter_ARTTh_Quad.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/x2/JavaSimpleLite_X2.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/x2/VisualTest.java
trunk/sample/sandbox/jp/nyatla/nyartoolkit/utils/j2se/NyARRGBRaster_BufferedImage.java
trunk/src.utils/java3d/.classpath
trunk/src.utils/java3d/jp/nyatla/nyartoolkit/java3d/utils/J3dNyARRaster_RGB.java
trunk/src.utils/java3d/jp/nyatla/nyartoolkit/java3d/utils/NyARSingleMarkerBehaviorHolder.java
trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/JmfCameraCapture.java [deleted file]
trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/JmfCaptureDeviceList.java
trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/JmfNyARRaster_RGB.java
trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/NyARBufferReader_Reader.java [deleted file]
trunk/src.utils/jogl/jp/nyatla/nyartoolkit/jogl/utils/GLNyARRaster_RGB.java
trunk/src.utils/qt/.classpath
trunk/src.utils/qt/jp/nyatla/nyartoolkit/qt/utils/QtCameraCapture.java
trunk/src.utils/qt/jp/nyatla/nyartoolkit/qt/utils/QtNyARRaster_RGB.java
trunk/src/jp/nyatla/nyartoolkit/core/NyARCode.java
trunk/src/jp/nyatla/nyartoolkit/core/analyzer/raster/NyARRasterAnalyzer_Histgram.java
trunk/src/jp/nyatla/nyartoolkit/core/labeling/artoolkit/NyARLabelingImage.java
trunk/src/jp/nyatla/nyartoolkit/core/labeling/artoolkit/NyARLabeling_ARToolKit.java
trunk/src/jp/nyatla/nyartoolkit/core/labeling/rlelabeling/NyARLabeling_Rle.java
trunk/src/jp/nyatla/nyartoolkit/core/match/NyARMatchPattDeviationBlackWhiteData.java
trunk/src/jp/nyatla/nyartoolkit/core/match/NyARMatchPattDeviationColorData.java
trunk/src/jp/nyatla/nyartoolkit/core/pickup/NyARColorPatt_O1.java
trunk/src/jp/nyatla/nyartoolkit/core/pickup/NyARColorPatt_O3.java
trunk/src/jp/nyatla/nyartoolkit/core/pickup/NyARColorPatt_Perspective.java
trunk/src/jp/nyatla/nyartoolkit/core/pickup/NyARColorPatt_PseudoAffine.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/INyARRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/NyARBinRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/NyARGrayscaleRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/NyARHsvRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/NyARRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/NyARRaster_BasicClass.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/rgb/NyARRgbRaster.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/rgb/NyARRgbRaster_BGRA.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/rgb/NyARRgbRaster_BasicClass.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/rgb/NyARRgbRaster_Blank.java
trunk/src/jp/nyatla/nyartoolkit/core/raster/rgb/NyARRgbRaster_RGB.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_CustomToneTable.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_GaussianSmooth.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_Reverse.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_Rgb2Hsv.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_Roberts.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/NyARRasterFilter_SimpleSmooth.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/gs2bin/NyARRasterFilter_ConstantThreshold.java [moved from trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/gs2bin/NyARRasterFilter_ConstantThrshold.java with 59% similarity]
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/INyARRasterFilter_Rgb2Bin.java [moved from trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/INyARRasterFilter_RgbToBin.java with 94% similarity]
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/INyARRasterFilter_Rgb2Gs.java [moved from trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/INyARRasterFilter_RgbToGs.java with 94% similarity]
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_AveAdd.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_RgbCube.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_YCbCr.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/INyARBufferReader.java [deleted file]
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/INyARRgbPixelReader.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARBufferReader.java [deleted file]
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_BYTE1D_B8G8R8X8_32.java [new file with mode: 0644]
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_BYTE1D_R8G8B8_24.java [moved from trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_RGB24.java with 85% similarity]
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_BYTE1D_X8R8G8B8_32.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_INT1D_GRAY_8.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_INT1D_X8R8G8B8_32.java
trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARVectorReader_INT1D_GRAY_8.java
trunk/src/jp/nyatla/nyartoolkit/core/squaredetect/ContourPickup.java
trunk/src/jp/nyatla/nyartoolkit/core/utils/NyAREquationSolver.java
trunk/src/jp/nyatla/nyartoolkit/core/utils/NyARMath.java
trunk/src/jp/nyatla/nyartoolkit/detector/NyARCustomSingleDetectMarker.java
trunk/src/jp/nyatla/nyartoolkit/detector/NyARDetectMarker.java
trunk/src/jp/nyatla/nyartoolkit/sample/NyIdTest.java
trunk/src/jp/nyatla/nyartoolkit/sample/RawFileTest.java
trunk/src/jp/nyatla/nyartoolkit/sample/SingleARMarkerTest.java
trunk/src/jp/nyatla/nyartoolkit/utils/j2se/LabelingBufferdImage.java
trunk/src/jp/nyatla/nyartoolkit/utils/j2se/NyARRasterImageIO.java
trunk/test/.classpath [new file with mode: 0644]
trunk/test/.project [new file with mode: 0644]
trunk/test/jp/nyatla/nyartoolkit/dev/LabelingTest.java
trunk/test/jp/nyatla/nyartoolkit/dev/OptimizeCompareTest.java
trunk/test/jp/nyatla/nyartoolkit/dev/PattPickupTest.java
trunk/test/jp/nyatla/nyartoolkit/dev/tracking/MarkerTracking_3dTrans.java
trunk/test/jp/nyatla/nyartoolkit/dev/tracking/TrTest.java

index 14ab415..1060944 100644 (file)
@@ -2,12 +2,12 @@
 <classpath>\r
        <classpathentry kind="src" path=""/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
-       <classpathentry kind="lib" path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/j3dcore.jar"/>\r
-       <classpathentry kind="lib" path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/j3dutils.jar"/>\r
-       <classpathentry kind="lib" path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/vecmath.jar"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/NyARToolKit"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.jmf"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.java3d"/>\r
        <classpathentry kind="lib" path="C:/Program Files (x86)/JMF2.1.1e/lib/jmf.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/j3dcore.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/j3dutils.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/vecmath.jar"/>\r
        <classpathentry kind="output" path=""/>\r
 </classpath>\r
diff --git a/trunk/sample/jmf/jp/nyatla/nyartoolkit/jmf/sample/LabelingViewer.java b/trunk/sample/jmf/jp/nyatla/nyartoolkit/jmf/sample/LabelingViewer.java
new file mode 100644 (file)
index 0000000..c07a950
--- /dev/null
@@ -0,0 +1,175 @@
+/* 
+ * PROJECT: NyARToolkit JMF sample program.
+ * --------------------------------------------------------------------------------
+ * The MIT License
+ * Copyright (c) 2008 nyatla
+ * airmail(at)ebony.plala.or.jp
+ * http://nyatla.jp/nyartoolkit/
+ * 
+ * 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.
+ * 
+ */
+package jp.nyatla.nyartoolkit.jmf.sample;
+
+import javax.media.*;
+
+import javax.media.util.BufferToImage;
+import javax.media.format.*;
+
+import jp.nyatla.nyartoolkit.NyARException;
+import jp.nyatla.nyartoolkit.jmf.utils.*;
+
+import java.awt.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import jp.nyatla.nyartoolkit.core.labeling.rlelabeling.RleLabelFragmentInfoStack;
+import jp.nyatla.nyartoolkit.core.param.NyARParam;
+import jp.nyatla.nyartoolkit.core.raster.NyARBinRaster;
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin.NyARRasterFilter_ARToolkitThreshold;
+import jp.nyatla.nyartoolkit.core.squaredetect.INyARSquareContourDetector;
+import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareContourDetector_Rle;
+
+/**
+ * VFM+ARToolkitテストプログラム
+ * カメラから取り込んだデータからマーカーを検出して、一致度と変換行列を表示します。
+ */
+public class LabelingViewer extends Frame implements JmfCaptureListener
+{
+       private static final long serialVersionUID = 6471434231970804953L;
+
+       private final String PARAM_FILE = "../../Data/camera_para.dat";
+
+       private JmfCaptureDevice _capture;
+
+
+       private JmfNyARRaster_RGB _raster;
+
+       public LabelingViewer() throws NyARException
+       {
+               setTitle("JmfCaptureTest");
+               setBounds(0, 0, 320 + 64, 240 + 64);
+               //キャプチャの準備
+               JmfCaptureDeviceList devlist=new JmfCaptureDeviceList();
+               this._capture=devlist.getDevice(0);
+               //JmfNyARRaster_RGBはYUVよりもRGBで高速に動作します。
+               if(!this._capture.setCaptureFormat(JmfCaptureDevice.PIXEL_FORMAT_RGB,320, 240,15f)){
+                       if(!this._capture.setCaptureFormat(JmfCaptureDevice.PIXEL_FORMAT_YUV,320, 240,15f)){
+                               throw new NyARException("キャプチャフォーマットが見つかりません");
+                       }               
+               }
+               this._capture.setOnCapture(this);
+               this.addWindowListener(new WindowAdapter() {
+                       public void windowClosing(WindowEvent e)
+                       {
+                               System.exit(0);
+                       }
+               });
+               //NyARToolkitの準備
+               NyARParam ar_param = new NyARParam();
+               ar_param.loadARParamFromFile(PARAM_FILE);
+               ar_param.changeScreenSize(320, 240);
+               this._raster = new JmfNyARRaster_RGB(320, 240,this._capture.getCaptureFormat());
+               this._detect=new NyARSquareContourDetector_Rle(ar_param.getDistortionFactor(),ar_param.getScreenSize());
+               this._filter    = new NyARRasterFilter_ARToolkitThreshold(110, _raster.getBufferType());
+               //キャプチャイメージ用のラスタを準備
+               return;
+       }
+       private NyARSquareContourDetector_Rle _detect;
+       private NyARBinRaster _bi=new NyARBinRaster(320,240);
+       private NyARRasterFilter_ARToolkitThreshold _filter;
+       /**
+        * detectMarkerのコールバック関数
+        */
+       private class DetectSquareCB implements INyARSquareContourDetector.DetectMarkerCallback
+       {
+               public DetectSquareCB()
+               {
+                       return;
+               }
+               /**
+                * 矩形が見付かるたびに呼び出されます。
+                * 発見した矩形のパターンを検査して、方位を考慮した頂点データを確保します。
+                */
+               public void onSquareDetect(INyARSquareContourDetector i_sender,int[] i_coordx,int[] i_coordy,int i_coor_num,int[] i_vertex_index) throws NyARException
+               {                       
+               }
+       }
+       
+       public void onUpdateBuffer(Buffer i_buffer)
+       {
+               try {
+                       NyARBinRaster bin = this._bi;
+                       //キャプチャしたバッファをラスタにセット
+                       this._raster.setBuffer(i_buffer);
+
+                       //キャプチャしたイメージを表示用に加工
+                       BufferToImage b2i = new BufferToImage((VideoFormat) i_buffer.getFormat());
+                       Image img = b2i.createImage(i_buffer);
+                       this._filter.doFilter(this._raster,bin);
+
+                       Graphics g = getGraphics();
+                       
+                       NyARParam param=new NyARParam();
+                       param.loadARParamFromFile(PARAM_FILE);
+                       param.changeScreenSize(320,240);
+                       try{
+                               this._detect.detectMarkerCB(bin,new DetectSquareCB());
+                       }catch(Exception e){
+                               e.printStackTrace();
+                       }
+                       RleLabelFragmentInfoStack ls=this._detect._getFragmentStack();
+                       for(int i=0;i<ls.getLength();i++){
+                               RleLabelFragmentInfoStack.RleLabelFragmentInfo label=ls.getItem(i);
+//                             if(label.area==0){break;}
+                               Graphics g2=img.getGraphics();
+                               g2.setColor(Color.RED);
+                               g2.drawRect(label.clip_l,label.clip_t,label.clip_r-label.clip_l,label.clip_b-label.clip_t);
+                       }               
+                       
+                       
+                       g.drawImage(img,50,50,null);
+               }catch(Exception e)
+               {
+                       e.printStackTrace();
+               }
+
+       }
+
+       private void startCapture()
+       {
+               try {
+                       this._capture.start();
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void main(String[] args)
+       {
+               try {
+                       LabelingViewer mainwin = new LabelingViewer();
+                       mainwin.setVisible(true);
+                       mainwin.startCapture();
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+
+       }
+
+}
index 71b3962..c787653 100644 (file)
@@ -89,7 +89,7 @@ public class NyarToolkitLinkTest extends Frame implements JmfCaptureListener
                ar_param.loadARParamFromFile(PARAM_FILE);
                ar_param.changeScreenSize(320, 240);
                this._raster = new JmfNyARRaster_RGB(320, 240,this._capture.getCaptureFormat());
-               this._nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0,this._raster.getBufferReader().getBufferType());
+               this._nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0,this._raster.getBufferType());
                ar_code.loadARPattFromFile(CARCODE_FILE);
                //キャプチャイメージ用のラスタを準備
                return;
@@ -108,30 +108,32 @@ public class NyarToolkitLinkTest extends Frame implements JmfCaptureListener
                        Graphics g = getGraphics();
 
                        //マーカー検出
-                       boolean is_marker_exist = this._nya.detectMarkerLite(this._raster, 100);
+                       boolean is_marker_exist = this._nya.detectMarkerLite(this._raster, 110);
                        if (is_marker_exist) {
                                //変換行列を取得
                                this._nya.getTransmationMatrix(this._trans_mat_result);
                        }
-                       //情報を画面に書く       
-                       g.drawImage(img, 32, 32, this);
+                       //情報を画面に書く
+                       Graphics image_g=img.getGraphics();
+                       image_g.setColor(Color.red);
                        if (is_marker_exist) {
-                               g.drawString("マーカー検出:" + this._nya.getConfidence(), 32, 50);
-                               g.drawString("[m00]" +this._trans_mat_result.m00, 32, 50 + 16*1);
-                               g.drawString("[m01]" +this._trans_mat_result.m01, 32, 50 + 16*2);
-                               g.drawString("[m02]" +this._trans_mat_result.m02, 32, 50 + 16*3);
-                               g.drawString("[m03]" +this._trans_mat_result.m03, 32, 50 + 16*4);
-                               g.drawString("[m10]" +this._trans_mat_result.m10, 32, 50 + 16*5);
-                               g.drawString("[m11]" +this._trans_mat_result.m11, 32, 50 + 16*6);
-                               g.drawString("[m12]" +this._trans_mat_result.m12, 32, 50 + 16*7);
-                               g.drawString("[m13]" +this._trans_mat_result.m13, 32, 50 + 16*8);
-                               g.drawString("[m20]" +this._trans_mat_result.m20, 32, 50 + 16*9);
-                               g.drawString("[m21]" +this._trans_mat_result.m21, 32, 50 + 16*10);
-                               g.drawString("[m22]" +this._trans_mat_result.m22, 32, 50 + 16*11);
-                               g.drawString("[m23]" +this._trans_mat_result.m23, 32, 50 + 16*12);
+                               image_g.drawString("マーカー検出:" + this._nya.getConfidence(), 4, 20);
+                               image_g.drawString("[m00]" +this._trans_mat_result.m00, 4, 20 + 16*1);
+                               image_g.drawString("[m01]" +this._trans_mat_result.m01, 4, 20 + 16*2);
+                               image_g.drawString("[m02]" +this._trans_mat_result.m02, 4, 20 + 16*3);
+                               image_g.drawString("[m03]" +this._trans_mat_result.m03, 4, 20 + 16*4);
+                               image_g.drawString("[m10]" +this._trans_mat_result.m10, 4, 20 + 16*5);
+                               image_g.drawString("[m11]" +this._trans_mat_result.m11, 4, 20 + 16*6);
+                               image_g.drawString("[m12]" +this._trans_mat_result.m12, 4, 20 + 16*7);
+                               image_g.drawString("[m13]" +this._trans_mat_result.m13, 4, 20 + 16*8);
+                               image_g.drawString("[m20]" +this._trans_mat_result.m20, 4, 20 + 16*9);
+                               image_g.drawString("[m21]" +this._trans_mat_result.m21, 4, 20 + 16*10);
+                               image_g.drawString("[m22]" +this._trans_mat_result.m22, 4, 20 + 16*11);
+                               image_g.drawString("[m23]" +this._trans_mat_result.m23, 4, 20 + 16*12);
                        } else {
                                g.drawString("マーカー未検出:", 32, 100);
                        }
+                       g.drawImage(img, 32, 32, this);
                } catch (Exception e) {
                        e.printStackTrace();
                }
index 22dac61..60a2363 100644 (file)
@@ -129,7 +129,7 @@ public class JavaSimpleLite implements GLEventListener, JmfCaptureListener
                this._cap_image = new GLNyARRaster_RGB(this._ar_param, this._capture.getCaptureFormat());\r
                \r
                // NyARToolkitの準備\r
-               this._nya = new NyARSingleDetectMarker(this._ar_param, i_ar_code, 80.0,this._cap_image.getBufferReader().getBufferType());\r
+               this._nya = new NyARSingleDetectMarker(this._ar_param, i_ar_code, 80.0,this._cap_image.getBufferType());\r
                this._nya.setContinueMode(false);// ここをtrueにすると、transMatContinueモード(History計算)になります。\r
                \r
                // 3Dを描画するコンポーネント\r
@@ -191,7 +191,7 @@ public class JavaSimpleLite implements GLEventListener, JmfCaptureListener
        public void display(GLAutoDrawable drawable)\r
        {\r
                NyARTransMatResult transmat_result = __display_transmat_result;\r
-               if (!_cap_image.hasData()) {\r
+               if (!_cap_image.hasBuffer()) {\r
                        return;\r
                }\r
                // 背景を書く\r
index d4ff57e..4651f7d 100644 (file)
@@ -161,7 +161,7 @@ public class JavaSimpleLite2 implements GLEventListener, JmfCaptureListener
                        //GL対応のRGBラスタオブジェクト\r
                        this._cap_image = new GLNyARRaster_RGB(this._ar_param,_capture.getCaptureFormat());\r
 \r
-                       this._nya = new NyARDetectMarker(this._ar_param, ar_codes, width, 2,this._cap_image.getBufferReader().getBufferType());\r
+                       this._nya = new NyARDetectMarker(this._ar_param, ar_codes, width, 2,this._cap_image.getBufferType());\r
                        this._nya.setContinueMode(false);//ここをtrueにすると、transMatContinueモード(History計算)になります。\r
                        //NyARToolkit用の支援クラス\r
                        this._glnya = new NyARGLUtil(_gl);\r
@@ -198,7 +198,7 @@ public class JavaSimpleLite2 implements GLEventListener, JmfCaptureListener
                NyARTransMatResult transmat_result=__display_transmat_result;\r
 \r
                try {\r
-                       if (!_cap_image.hasData()) {\r
+                       if (!_cap_image.hasBuffer()) {\r
                                return;\r
                        }\r
                        _gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame.          \r
index dadbb24..f4d73ec 100644 (file)
@@ -149,7 +149,7 @@ public class SingleARMarker implements GLEventListener, JmfCaptureListener
                this._code_table[0]=new NyARCode(16,16);\r
                this._code_table[0].loadARPattFromFile(CARCODE_FILE1);\r
                //プロセッサの準備\r
-               this._processor=new MarkerProcessor(i_cparam,this._cap_image.getBufferReader().getBufferType());\r
+               this._processor=new MarkerProcessor(i_cparam,this._cap_image.getBufferType());\r
                this._processor.setARCodeTable(_code_table,16,80.0);\r
                \r
                //OpenGLフレームの準備(OpenGLリソースの初期化、カメラの撮影開始は、initコールバック関数内で実行)\r
@@ -214,7 +214,7 @@ public class SingleARMarker implements GLEventListener, JmfCaptureListener
        public void display(GLAutoDrawable drawable)\r
        {\r
                NyARTransMatResult transmat_result = this._processor.transmat;\r
-               if (!_cap_image.hasData()) {\r
+               if (!_cap_image.hasBuffer()) {\r
                        return;\r
                }\r
                // 背景を書く\r
index bf52d87..0cfc624 100644 (file)
@@ -38,7 +38,6 @@ import javax.media.opengl.*;
 import com.sun.opengl.util.*;\r
 import com.sun.opengl.util.j2d.*;\r
 import jp.nyatla.nyartoolkit.*;\r
-import jp.nyatla.nyartoolkit.core.*;\r
 import jp.nyatla.nyartoolkit.core.param.*;\r
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquare;\r
 import jp.nyatla.nyartoolkit.core.transmat.*;\r
@@ -160,7 +159,7 @@ public class SingleNyIdMarker implements GLEventListener, JmfCaptureListener
                this._cap_image = new GLNyARRaster_RGB(i_cparam,this._capture.getCaptureFormat());      \r
 \r
                //プロセッサの準備\r
-               this._processor=new MarkerProcessor(i_cparam,100,this._cap_image.getBufferReader().getBufferType());\r
+               this._processor=new MarkerProcessor(i_cparam,100,this._cap_image.getBufferType());\r
                \r
                //OpenGLフレームの準備(OpenGLリソースの初期化、カメラの撮影開始は、initコールバック関数内で実行)\r
                Frame frame = new Frame("Java simpleLite with NyARToolkit");\r
@@ -224,7 +223,7 @@ public class SingleNyIdMarker implements GLEventListener, JmfCaptureListener
        public void display(GLAutoDrawable drawable)\r
        {\r
                NyARTransMatResult transmat_result = this._processor.transmat;\r
-               if (!_cap_image.hasData()) {\r
+               if (!_cap_image.hasBuffer()) {\r
                        return;\r
                }\r
                // 背景を書く\r
index 2808887..e613370 100644 (file)
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
-       <classpathentry path="" kind="src"/>\r
-       <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>\r
-       <classpathentry path="C:/Program Files/JMF2.1.1e/lib/jmf.jar" kind="lib"/>\r
-       <classpathentry path="C:/Program Files/QuickTime/QTSystem/QTJava.zip" kind="lib"/>\r
-       <classpathentry path="/NyARToolKit" combineaccessrules="false" kind="src"/>\r
-       <classpathentry path="/NyARToolkit.utils.qt" combineaccessrules="false" kind="src"/>\r
-       <classpathentry path="bin" kind="output"/>\r
+       <classpathentry kind="src" path=""/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolKit"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.qt"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/jre6/lib/ext/QTJava.zip"/>\r
+       <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
index e597210..fb54d9b 100644 (file)
@@ -31,9 +31,14 @@ package jp.nyatla.nyartoolkit.qt.sample;
 import jp.nyatla.nyartoolkit.NyARException;
 import jp.nyatla.nyartoolkit.qt.utils.*;
 import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBuffer;
+import java.awt.image.WritableRaster;
+
 import jp.nyatla.nyartoolkit.core.*;
 import jp.nyatla.nyartoolkit.core.param.NyARParam;
 import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult;
+import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
 import jp.nyatla.nyartoolkit.detector.NyARSingleDetectMarker;
 /**
  * VFM+ARToolkitテストプログラム
@@ -69,7 +74,7 @@ public class NyarToolkitLinkTest extends Frame implements QtCaptureListener
                ar_param.loadARParamFromFile(PARAM_FILE);
                ar_param.changeScreenSize(320, 240);
                raster = new QtNyARRaster_RGB(320, 240);
-               nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0,raster.getBufferReader().getBufferType());
+               nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0,raster.getBufferType());
                ar_code.loadARPattFromFile(CARCODE_FILE);
                //キャプチャイメージ用のラスタを準備
        }
@@ -78,10 +83,19 @@ public class NyarToolkitLinkTest extends Frame implements QtCaptureListener
        {
                try {
                        //キャプチャしたバッファをラスタにセット
-                       raster.setBuffer(pixels);
-
-                       //キャプチャしたイメージを表示用に加工
-                       Image img = raster.createImage();
+                       raster.wrapBuffer(pixels);
+
+                       Image img;
+                       {
+                               //キャプチャしたイメージを表示用に加工
+                               NyARIntSize s=raster.getSize();
+                               WritableRaster wr = WritableRaster.createInterleavedRaster(DataBuffer.TYPE_BYTE, s.w,s.h, s.w * 3, 3, new int[] { 0, 1, 2 }, null);
+                               BufferedImage  bi = new BufferedImage(s.w, s.h, BufferedImage.TYPE_3BYTE_BGR);
+       
+                               wr.setDataElements(0, 0, s.w, s.h,raster.getBuffer());
+                               bi.setData(wr);
+                               img=bi;
+                       }
 
                        Graphics g = getGraphics();
 
@@ -92,25 +106,26 @@ public class NyarToolkitLinkTest extends Frame implements QtCaptureListener
                                nya.getTransmationMatrix(this.trans_mat_result);
                        }
                        //情報を画面に書く       
-                       g.drawImage(img, 32, 32, this);
+                       Graphics image_g=img.getGraphics();
+                       image_g.setColor(Color.red);
                        if (is_marker_exist) {
-                               g.drawString("マーカー検出:" + nya.getConfidence(), 32, 50);
-                               g.drawString("[m00]" + this.trans_mat_result.m00, 32, 50 + 16 * 1);
-                               g.drawString("[m01]" + this.trans_mat_result.m01, 32, 50 + 16 * 2);
-                               g.drawString("[m02]" + this.trans_mat_result.m02, 32, 50 + 16 * 3);
-                               g.drawString("[m03]" + this.trans_mat_result.m03, 32, 50 + 16 * 4);
-                               g.drawString("[m10]" + this.trans_mat_result.m10, 32, 50 + 16 * 5);
-                               g.drawString("[m11]" + this.trans_mat_result.m11, 32, 50 + 16 * 6);
-                               g.drawString("[m12]" + this.trans_mat_result.m12, 32, 50 + 16 * 7);
-                               g.drawString("[m13]" + this.trans_mat_result.m13, 32, 50 + 16 * 8);
-                               g.drawString("[m20]" + this.trans_mat_result.m20, 32, 50 + 16 * 9);
-                               g.drawString("[m21]" + this.trans_mat_result.m21, 32, 50 + 16 * 10);
-                               g.drawString("[m22]" + this.trans_mat_result.m22, 32, 50 + 16 * 11);
-                               g.drawString("[m23]" + this.trans_mat_result.m23, 32, 50 + 16 * 12);
-
+                               image_g.drawString("マーカー検出:" + nya.getConfidence(), 4, 20);
+                               image_g.drawString("[m00]" + this.trans_mat_result.m00, 4, 20 + 16 * 1);
+                               image_g.drawString("[m01]" + this.trans_mat_result.m01, 4, 20 + 16 * 2);
+                               image_g.drawString("[m02]" + this.trans_mat_result.m02, 4, 20 + 16 * 3);
+                               image_g.drawString("[m03]" + this.trans_mat_result.m03, 4, 20 + 16 * 4);
+                               image_g.drawString("[m10]" + this.trans_mat_result.m10, 4, 20 + 16 * 5);
+                               image_g.drawString("[m11]" + this.trans_mat_result.m11, 4, 20 + 16 * 6);
+                               image_g.drawString("[m12]" + this.trans_mat_result.m12, 4, 20 + 16 * 7);
+                               image_g.drawString("[m13]" + this.trans_mat_result.m13, 4, 20 + 16 * 8);
+                               image_g.drawString("[m20]" + this.trans_mat_result.m20, 4, 20 + 16 * 9);
+                               image_g.drawString("[m21]" + this.trans_mat_result.m21, 4, 20 + 16 * 10);
+                               image_g.drawString("[m22]" + this.trans_mat_result.m22, 4, 20 + 16 * 11);
+                               image_g.drawString("[m23]" + this.trans_mat_result.m23, 4, 20 + 16 * 12);
                        } else {
-                               g.drawString("マーカー未検出:", 32, 100);
+                               image_g.drawString("マーカー未検出:", 32, 100);
                        }
+                       g.drawImage(img, 32, 32, this);
                } catch (Exception e) {
                        e.printStackTrace();
                }
index 6deac55..df5eb57 100644 (file)
@@ -28,11 +28,22 @@ package jp.nyatla.nyartoolkit.qt.sample;
 
 import jp.nyatla.nyartoolkit.NyARException;
 import jp.nyatla.nyartoolkit.qt.utils.*;
+import jp.nyatla.nyartoolkit.core.types.*;
 
 import java.awt.*;
+import java.awt.image.*;
 /**
  * QuickTimeキャプチャプログラム
  *
+ * On windows, You might get couldntGetRequiredComponent error.
+ * If you got error try to install WinVDIG. 
+ * http://www.eden.net.nz/7/20071008/
+ * --
+ * Windowsの場合、WinVDIGが無いとキャプチャプログラムが動かないことがあります。
+ * couldntGetRequiredComponentエラーが出たら、WinVDIGをインストールしてみてね。
+ * WinVIDGはとりあえずここから入手可能。http://www.eden.net.nz/7/20071008/
+ * 
+ *
  */
 public class QtCaptureTest extends Frame implements QtCaptureListener
 {
@@ -49,15 +60,28 @@ public class QtCaptureTest extends Frame implements QtCaptureListener
        }
 
        private QtCameraCapture capture;
-
        private QtNyARRaster_RGB raster;
-
+       
        public void onUpdateBuffer(byte[] pixels)
        {
-               raster.setBuffer(pixels);
-               Image img = raster.createImage();
+               try{
+                       this.raster.wrapBuffer(pixels);
+               }catch(Exception e){
+                       e.printStackTrace();
+                       return;
+               }
+               //Imageに変換してみよう!
+
+               
+               NyARIntSize s=raster.getSize();
+               WritableRaster wr = WritableRaster.createInterleavedRaster(DataBuffer.TYPE_BYTE, s.w,s.h, s.w * 3, 3, new int[] { 0, 1, 2 }, null);
+               BufferedImage  bi = new BufferedImage(s.w, s.h, BufferedImage.TYPE_3BYTE_BGR);
+
+               wr.setDataElements(0, 0, s.w, s.h,raster.getBuffer());
+               bi.setData(wr);
+               
                Graphics g = getGraphics();
-               g.drawImage(img, 32, 32, this);
+               g.drawImage(bi, 32, 32, this);
        }
 
        private void startCapture()
index fba840e..2684ef6 100644 (file)
@@ -34,7 +34,6 @@ import jp.nyatla.nyartoolkit.NyARException;
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.types.stack.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 \r
 /**\r
  * QRコードの4頂点候補を探そうとするクラス。\r
@@ -45,7 +44,7 @@ public class NyARRasterDetector_QrCodeEdge
 {\r
        private NyARIntRectStack _result;\r
 \r
-       public NyARRasterDetector_QrCodeEdge(int i_result_max)\r
+       public NyARRasterDetector_QrCodeEdge(int i_result_max) throws NyARException\r
        {\r
                this._result = new NyARIntRectStack(i_result_max);\r
                return;\r
@@ -87,8 +86,7 @@ public class NyARRasterDetector_QrCodeEdge
        }       \r
        public void analyzeRaster(INyARRaster i_input) throws NyARException\r
        {\r
-               INyARBufferReader buffer_reader=i_input.getBufferReader();\r
-               assert (buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+               assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
 \r
                // 結果をクリア\r
                this._result.clear();\r
@@ -99,7 +97,7 @@ public class NyARRasterDetector_QrCodeEdge
                w1 = b1 = w2 = b2 = w3 = b3 = 0;\r
 \r
                NyARIntRect item;\r
-               int[] raster_buf=(int[])buffer_reader.getBuffer();\r
+               int[] raster_buf=(int[])i_input.getBuffer();\r
                int line_ptr;\r
                int s_pos, b2_spos,b3_spos;\r
                b2_spos=0;\r
index 1e18d90..e937da9 100644 (file)
@@ -27,7 +27,6 @@ package jp.nyatla.nyartoolkit.core.rasteranalyzer.threshold;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.analyzer.raster.threshold.INyARRasterThresholdAnalyzer;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 /**\r
@@ -83,10 +82,9 @@ public class NyARRasterThresholdAnalyzer_DiffHistgram implements INyARRasterThre
 \r
        public int analyzeRaster(INyARRaster i_input) throws NyARException\r
        {\r
-               final INyARBufferReader buffer_reader=i_input.getBufferReader();        \r
-               assert (buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                int[] histgram = new int[256];\r
-               return createHistgram((int[])buffer_reader.getBuffer(),i_input.getSize(), histgram);\r
+               return createHistgram((int[])i_input.getBuffer(),i_input.getSize(), histgram);\r
        }\r
 \r
        /**\r
@@ -97,13 +95,11 @@ public class NyARRasterThresholdAnalyzer_DiffHistgram implements INyARRasterThre
         */\r
        public void debugDrawHistgramMap(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader(); \r
-               assert (in_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-               assert (out_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                NyARIntSize size = i_output.getSize();\r
 \r
-               int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
+               int[] out_buf = (int[]) i_output.getBuffer();\r
                // 0で塗りつぶし\r
                for (int y = 0; y < size.h; y++) {\r
                        for (int x = 0; x < size.w; x++) {\r
@@ -112,7 +108,7 @@ public class NyARRasterThresholdAnalyzer_DiffHistgram implements INyARRasterThre
                }\r
                // ヒストグラムを計算\r
                int[] histgram = new int[256];\r
-               int threshold = createHistgram((int[])in_buffer_reader.getBuffer(),i_input.getSize(), histgram);\r
+               int threshold = createHistgram((int[])i_input.getBuffer(),i_input.getSize(), histgram);\r
 \r
                // ヒストグラムの最大値を出す\r
                int max_v = 0;\r
index 92f8a1f..d3794eb 100644 (file)
@@ -33,7 +33,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.rasterfilter.INyARRasterFilter;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -43,14 +42,12 @@ public class NyARRasterFilter_Edge implements INyARRasterFilter
 {\r
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader(); \r
-               assert (in_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-               assert (out_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
 \r
-               int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
-               int[] in_buf = (int[]) in_buffer_reader.getBuffer();\r
+               int[] out_buf = (int[]) i_output.getBuffer();\r
+               int[] in_buf = (int[]) i_input.getBuffer();\r
 \r
                int bp = 0;\r
                NyARIntSize size = i_output.getSize();\r
index 2603163..7fbfbc0 100644 (file)
@@ -32,7 +32,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -45,7 +44,7 @@ public class NyARRasterOperator_Mul
        public NyARRasterOperator_Mul(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._dofilterimpl=new IdoFilterImpl_INT1D_GRAY_8();\r
                        break;\r
                default:\r
@@ -57,22 +56,22 @@ public class NyARRasterOperator_Mul
        {\r
                assert (i_input_a.getSize().isEqualSize(i_output.getSize()) == true);\r
                assert (i_input_b.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input_a.getBufferReader(),i_input_b.getBufferReader(),i_output.getBufferReader(),i_output.getSize());\r
+               this._dofilterimpl.doFilter(i_input_a,i_input_b,i_output,i_output.getSize());\r
        }\r
        \r
        abstract class IdoFilterImpl\r
        {\r
                int[] _window_ref;\r
-               public abstract void doFilter(INyARBufferReader i_input_a,INyARBufferReader i_input_b,INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public abstract void doFilter(INyARRaster i_input_a,INyARRaster i_input_b,INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
                \r
        }\r
        class IdoFilterImpl_INT1D_GRAY_8 extends IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input_a,INyARBufferReader i_input_b,INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input_a,INyARRaster i_input_b,INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert(i_input_a.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert(i_input_b.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert(i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(i_input_a.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(i_input_b.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        int[] in_buf1 = (int[]) i_input_a.getBuffer();\r
index c85c777..ded1ec8 100644 (file)
@@ -1,9 +1,8 @@
 package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.raster.NyARGrayscaleRaster;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -13,7 +12,7 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
  * f(x):=exp(-x^2/s^2)  窓関数\r
  * p :=Y*f(cr)*f(cb)\r
  */\r
-public class NyARRasterFilter_Rgb2Gs_CbCrCut implements INyARRasterFilter_RgbToGs\r
+public class NyARRasterFilter_Rgb2Gs_CbCrCut implements INyARRasterFilter_Rgb2Gs\r
 {\r
        private IdoFilterImpl _dofilterimpl;\r
        /**\r
@@ -23,10 +22,10 @@ public class NyARRasterFilter_Rgb2Gs_CbCrCut implements INyARRasterFilter_RgbToG
        public NyARRasterFilter_Rgb2Gs_CbCrCut(int i_raster_type,double i_sigma) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                        this._dofilterimpl=new IdoFilterImpl_BYTE1D_B8G8R8_24();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                default:\r
                        throw new NyARException();\r
                }\r
@@ -40,21 +39,21 @@ public class NyARRasterFilter_Rgb2Gs_CbCrCut implements INyARRasterFilter_RgbToG
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._dofilterimpl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        abstract class IdoFilterImpl\r
        {\r
                int[] _window_ref;\r
-               public abstract void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public abstract void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
                \r
        }\r
        class IdoFilterImpl_BYTE1D_B8G8R8_24 extends IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert( i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24));\r
-                       assert( i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert( i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24));\r
+                       assert( i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
index c91aa7b..381c952 100644 (file)
@@ -33,27 +33,24 @@ package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_Rgb2Gs;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
-public class NyARRasterFilter_Rgb2Gs_RgbOr implements INyARRasterFilter_RgbToGs\r
+public class NyARRasterFilter_Rgb2Gs_RgbOr implements INyARRasterFilter_Rgb2Gs\r
 {\r
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
                \r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader();                 \r
-               assert( out_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert( i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
 \r
-               final int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
-               final byte[] in_buf = (byte[]) in_buffer_reader.getBuffer();\r
+               final int[] out_buf = (int[]) i_output.getBuffer();\r
+               final byte[] in_buf = (byte[]) i_input.getBuffer();\r
 \r
                NyARIntSize size = i_output.getSize();\r
-               switch (in_buffer_reader.getBufferType()) {\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               switch (i_input.getBufferType()) {\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        convert24BitRgb(in_buf, out_buf, size);\r
                        break;\r
                default:\r
index 15914e0..2bc80d0 100644 (file)
@@ -30,7 +30,6 @@
  */\r
 package jp.nyatla.nyartoolkit.core.types;\r
 \r
-import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.core.types.NyARFixedFloat16Point3d;\r
 import jp.nyatla.nyartoolkit.core.types.NyARI64Point3d;\r
 \r
index cd603c5..12284f5 100644 (file)
@@ -30,7 +30,6 @@
  */\r
 package jp.nyatla.nyartoolkit.core.types.matrix;\r
 \r
-import jp.nyatla.nyartoolkit.core.types.matrix.*;\r
 import jp.nyatla.nyartoolkit.core.types.matrix.NyARFixedFloat24Matrix33;\r
 import jp.nyatla.nyartoolkit.core.types.matrix.NyARI64Matrix33;\r
 \r
index f17f34c..6f0cd1c 100644 (file)
@@ -111,7 +111,7 @@ public class NyARQrCodeDetector implements INyARSquareContourDetector
                final int[] xcoord = this._xcoord;\r
                final int[] ycoord = this._ycoord;\r
                final int coord_max = this._max_coord;\r
-               final int[] buf = (int[]) limage.getBufferReader().getBuffer();\r
+               final int[] buf = (int[]) limage.getBuffer();\r
                final int[] indextable = limage.getIndexArray();\r
 \r
                int label_area;\r
index 006ad96..0193587 100644 (file)
@@ -33,21 +33,22 @@ package jp.nyatla.nyartoolkit.sandbox.qrcode;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.gs2bin.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 /**\r
  * 平均移動法を使った2値化フィルタ\r
  * \r
  */\r
-public class NyARRasterFilter_QrAreaAverage implements INyARRasterFilter_GsToBin\r
+public class NyARRasterFilter_QrAreaAverage implements INyARRasterFilter_Gs2Bin\r
 {\r
        private int _area = 8;\r
 \r
        public void doFilter(NyARGrayscaleRaster i_input, NyARBinRaster i_output) throws NyARException\r
        {\r
                final NyARIntSize size = i_output.getSize();\r
-               final int[] out_buf = (int[]) i_output.getBufferReader().getBuffer();\r
-               final int[] in_buf = (int[]) i_input.getBufferReader().getBuffer();\r
+               final int[] out_buf = (int[]) i_output.getBuffer();\r
+               final int[] in_buf = (int[]) i_input.getBuffer();\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
                assert (size.h % 8 == 0 && size.w % 8 == 0);//暫定実装なので。\r
 \r
index 874c555..a265ca7 100644 (file)
@@ -36,14 +36,14 @@ import jp.nyatla.nyartoolkit.core.*;
 import jp.nyatla.nyartoolkit.core.param.NyARParam;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.rasterfilter.*;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.*;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.gs2bin.*;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.squaredetect.INyARSquareContourDetector;\r
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquare;\r
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareStack;\r
 import jp.nyatla.nyartoolkit.core.transmat.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core2.rasterfilter.rgb2gs.*;\r
 \r
 /**\r
  * 画像からARCodeに最も一致するマーカーを1個検出し、その変換行列を計算するクラスです。\r
@@ -90,8 +90,8 @@ public class NyARSingleQrDetector
        private NyARBinRaster _bin_raster;\r
        private NyARGrayscaleRaster _gs_raster;\r
        //画処理フィルター\r
-       private INyARRasterFilter_RgbToGs _rgb2gs_filter=new NyARRasterFilter_RgbAve();\r
-       private INyARRasterFilter_GsToBin _gstobin_filter=new NyARRasterFilter_QrAreaAverage();\r
+       private INyARRasterFilter_Rgb2Gs _rgb2gs_filter=new NyARRasterFilter_Rgb2Gs_AveAdd();\r
+       private INyARRasterFilter_Gs2Bin _gstobin_filter=new NyARRasterFilter_QrAreaAverage();\r
 \r
        /**\r
         * i_imageにマーカー検出処理を実行し、結果を記録します。\r
index 0dfc1fa..672cba0 100644 (file)
@@ -23,13 +23,11 @@ import jp.nyatla.nyartoolkit.core.param.*;
 import jp.nyatla.nyartoolkit.core.raster.*;
 import jp.nyatla.nyartoolkit.core.rasteranalyzer.threshold.NyARRasterThresholdAnalyzer_DiffHistgram;
 import jp.nyatla.nyartoolkit.core.rasterfilter.*;
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.*;
+import jp.nyatla.nyartoolkit.core.rasterfilter.gs2bin.*;
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquare;
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareStack;
-import jp.nyatla.nyartoolkit.core2.rasterfilter.rgb2gs.*;
-import jp.nyatla.nyartoolkit.core2.rasterfilter.gs2bin.*;
 import jp.nyatla.nyartoolkit.core.types.*;
-import jp.nyatla.nyartoolkit.core2.rasteranalyzer.threshold.*;
 
 
 
@@ -83,14 +81,14 @@ public class SingleQrTest extends Frame implements JmfCaptureListener
                        this.getGraphics().drawImage(img, 32, 32, this);
 
                        // 画像1
-                       INyARRasterFilter_RgbToGs filter_rgb2gs = new NyARRasterFilter_RgbAve();
+                       INyARRasterFilter_Rgb2Gs filter_rgb2gs = new NyARRasterFilter_AveAdd();
 //                     INyARRasterFilter_RgbToGs filter_rgb2gs = new NyARRasterFilter_RgbMul();
                        
                        filter_rgb2gs.doFilter(_raster, _gsraster1);
                        this._bimg.drawImage(this._gsraster1);
                        this.getGraphics().drawImage(this._bimg, 32 + 320, 32, 320 + 320 + 32, 240 + 32, 0, 240, 320, 0, this);
                        _tha.analyzeRaster(_gsraster1);
-                       NyARRasterFilter_Threshold gs2bin=new NyARRasterFilter_Threshold(_tha.getThreshold());
+                       NyARRasterFilter_ConstantThreshold gs2bin=new NyARRasterFilter_ConstantThreshold(_tha.getThreshold());
                        
 
                        // 画像2
index edbf106..2d2fdbe 100644 (file)
@@ -33,16 +33,15 @@ package jp.nyatla.nyartoolkit.sandbox.quadx2;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
+import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.gs2bin.*;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin.*;\r
 \r
 /**\r
  * 1/4のサイズの画像に変換しながら閾値判定する関数\r
  * \r
  */\r
-public class NyARRasterFilter_ARTTh_Quad implements INyARRasterFilter_Bin\r
+public class NyARRasterFilter_ARTTh_Quad implements INyARRasterFilter_Rgb2Bin\r
 {\r
        private int _threshold;\r
 \r
@@ -57,21 +56,19 @@ public class NyARRasterFilter_ARTTh_Quad implements INyARRasterFilter_Bin
 \r
        public void doFilter(INyARRgbRaster i_input, NyARBinRaster i_output) throws NyARException\r
        {\r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader();\r
-               int in_buf_type=in_buffer_reader.getBufferType();\r
+               int in_buf_type=i_input.getBufferType();\r
 \r
                NyARIntSize size = i_output.getSize();\r
-               assert (out_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+               assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                assert (checkInputType(in_buf_type)==true);     \r
                assert (i_input.getSize().isEqualSize(size.w*2,size.h*2) == true);\r
 \r
-               int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
-               byte[] in_buf = (byte[]) in_buffer_reader.getBuffer();\r
+               int[] out_buf = (int[]) i_output.getBuffer();\r
+               byte[] in_buf = (byte[]) i_input.getBuffer();\r
 \r
-               switch (in_buffer_reader.getBufferType()) {\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               switch (i_input.getBufferType()) {\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        convert24BitRgb(in_buf, out_buf, size);\r
                        break;\r
 //             case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
@@ -182,10 +179,10 @@ public class NyARRasterFilter_ARTTh_Quad implements INyARRasterFilter_Bin
        private boolean checkInputType(int i_input_type) throws NyARException\r
        {\r
                switch(i_input_type){\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
-//             case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
-//             case INyARBufferReader.BUFFERFORMAT_BYTE1D_R5G6B5_16LE:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+//             case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
+//             case INyARRaster.BUFFERFORMAT_BYTE1D_R5G6B5_16LE:\r
                        return true;\r
                default:\r
                        return false;\r
index 5b50208..f023aa6 100644 (file)
@@ -162,7 +162,7 @@ public class JavaSimpleLite_X2 implements GLEventListener, JmfCaptureListener
                        _glnya = new NyARGLUtil(_gl);\r
                        //GL対応のRGBラスタオブジェクト\r
                        _cap_image = new GLNyARRaster_RGB(_ar_param,_capture.getCaptureFormat());\r
-                       _nya = new NyARSingleDetectMarker_X2(_ar_param, ar_code, 80.0,this._cap_image.getBufferReader().getBufferType());\r
+                       _nya = new NyARSingleDetectMarker_X2(_ar_param, ar_code, 80.0,this._cap_image.getBufferType());\r
                        _nya.setContinueMode(false);//ここをtrueにすると、transMatContinueモード(History計算)になります。\r
                        //キャプチャ開始\r
                        _capture.start();\r
@@ -196,7 +196,7 @@ public class JavaSimpleLite_X2 implements GLEventListener, JmfCaptureListener
        {\r
                NyARTransMatResult transmat_result=__display_transmat_result;\r
                try {\r
-                       if (!_cap_image.hasData()) {\r
+                       if (!_cap_image.hasBuffer()) {\r
                                return;\r
                        }\r
                        _gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame.          \r
index e71277f..a14c3d0 100644 (file)
@@ -26,7 +26,7 @@ import jp.nyatla.nyartoolkit.core.param.*;
 import jp.nyatla.nyartoolkit.core.raster.*;
 import jp.nyatla.nyartoolkit.core.rasteranalyzer.threshold.NyARRasterThresholdAnalyzer_DiffHistgram;
 import jp.nyatla.nyartoolkit.core.rasterfilter.*;
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_Rgb2Gs;
 import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareStack;
 import jp.nyatla.nyartoolkit.core2.rasterfilter.rgb2gs.*;
 import jp.nyatla.nyartoolkit.core2.rasterfilter.gs2bin.*;
@@ -85,7 +85,7 @@ public class VisualTest extends Frame implements JmfCaptureListener
                        this.getGraphics().drawImage(img, 32, 32, this);
 
                        // 画像1
-                       INyARRasterFilter_RgbToGs filter_rgb2gs = new NyARRasterFilter_RgbAve();
+                       INyARRasterFilter_Rgb2Gs filter_rgb2gs = new NyARRasterFilter_RgbAve();
 //                     INyARRasterFilter_RgbToGs filter_rgb2gs = new NyARRasterFilter_RgbMul();
                        
                        filter_rgb2gs.doFilter(_raster, _gsraster1);
index ad4264b..3e5e4c4 100644 (file)
@@ -3,46 +3,65 @@ package jp.nyatla.nyartoolkit.utils.j2se;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
+\r
+import java.awt.color.ColorSpace;\r
 import java.awt.image.BufferedImage;\r
 \r
 \r
-public class NyARRGBRaster_BufferedImage implements INyARRgbRaster\r
+public class NyARRGBRaster_BufferedImage extends NyARRgbRaster_BasicClass\r
 {\r
-       protected INyARRgbPixelReader _reader;\r
-       protected INyARBufferReader _buffer_reader;     \r
-       final protected NyARIntSize _size;\r
-       final public int getWidth()\r
+       private INyARRgbPixelReader _reader;\r
+       private BufferedImage _buf; \r
+       \r
+       /**\r
+        * バッファオブジェクトがアタッチされていればtrue\r
+        */\r
+       protected boolean _is_attached_buffer;\r
+       public NyARRGBRaster_BufferedImage(int i_width, int i_height,boolean i_is_alloc) throws NyARException\r
        {\r
-               return this._size.w;\r
+               super( new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_OBJECT_Java_BufferedImage);\r
+               if(!initInstance(this._size,i_is_alloc)){\r
+                       throw new NyARException();\r
+               }\r
        }\r
-\r
-       final public int getHeight()\r
+       public NyARRGBRaster_BufferedImage(int i_width, int i_height) throws NyARException\r
        {\r
-               return this._size.h;\r
+               super( new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_OBJECT_Java_BufferedImage);\r
+               if(!initInstance(this._size,true)){\r
+                       throw new NyARException();\r
+               }\r
        }\r
+       protected boolean initInstance(NyARIntSize i_size,boolean i_is_alloc)\r
+       {\r
+               this._buf=i_is_alloc?new BufferedImage(i_size.w,i_size.h, ColorSpace.TYPE_RGB):null;\r
+               this._reader=new PixelReader((BufferedImage)this._buf);\r
+               this._is_attached_buffer=i_is_alloc;\r
+               return true;\r
+       }       \r
+       \r
 \r
-       final public NyARIntSize getSize()\r
+       public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
        {\r
-               return this._size;\r
+               return this._reader;\r
        }\r
-       /**\r
-        * i_imageをラップするRGBラスタを定義する。\r
-        * @param i_image\r
-        */\r
-       protected NyARRGBRaster_BufferedImage(BufferedImage i_image)\r
+       public Object getBuffer()\r
        {\r
-               this._buffer_reader=new NyARBufferReader(i_image,INyARBufferReader.BUFFERFORMAT_OBJECT_Java_BufferedImage);\r
-               this._reader=new PixelReader(i_image);\r
-               this._size= new NyARIntSize(i_image.getWidth(),i_image.getHeight());\r
+               return this._buf;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
+       public boolean hasBuffer()\r
        {\r
-               return this._reader;\r
+               return this._buf!=null;\r
        }\r
-       public INyARBufferReader getBufferReader()\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
        {\r
-               return this._buffer_reader;\r
+               assert(!this._is_attached_buffer);//バッファがアタッチされていたら機能しない。\r
+               BufferedImage buf=(BufferedImage)i_ref_buf;\r
+               assert(buf.getWidth()==this._size.w && buf.getHeight()==this._size.h);\r
+               this._buf=buf;\r
+               //ピクセルリーダーの参照バッファを切り替える。\r
+               this._reader.switchBuffer(i_ref_buf);\r
        }\r
        \r
        \r
@@ -89,6 +108,10 @@ public class NyARRGBRaster_BufferedImage implements INyARRgbRaster
                {\r
                        NyARException.notImplement();           \r
                }\r
+               public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+               {\r
+                       this._ref_buf = (BufferedImage)i_ref_buffer;\r
+               }\r
                \r
        }       \r
        \r
index d15273a..a977672 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
-       <classpathentry path="" kind="src"/>\r
-       <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>\r
-       <classpathentry path="/NyARToolKit" combineaccessrules="false" kind="src"/>\r
-       <classpathentry path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/j3dcore.jar" kind="lib"/>\r
-       <classpathentry path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/j3dutils.jar" kind="lib"/>\r
-       <classpathentry path="C:/Program Files/Java/Java3D/1.5.1/lib/ext/vecmath.jar" kind="lib"/>\r
-       <classpathentry path="C:/Program Files/JMF2.1.1e/lib/jmf.jar" kind="lib"/>\r
-       <classpathentry path="/NyARToolkit.utils.jmf" combineaccessrules="false" kind="src"/>\r
-       <classpathentry path="" kind="output"/>\r
+       <classpathentry kind="src" path=""/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolKit"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.jmf"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/j3dcore.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/j3dutils.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/Java3D/1.5.1/lib/ext/vecmath.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/JMF2.1.1e/lib/jmf.jar"/>\r
+       <classpathentry kind="output" path=""/>\r
 </classpath>\r
index 106cc58..2c975e8 100644 (file)
@@ -35,7 +35,7 @@ import javax.media.j3d.ImageComponent2D;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.param.NyARParam;\r
 import jp.nyatla.nyartoolkit.jmf.utils.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 /**\r
  * \r
  * このクラスは、Java3Dと互換性のあるNyARToolkitのラスタイメージを保持します。\r
@@ -57,12 +57,12 @@ public class J3dNyARRaster_RGB extends JmfNyARRaster_RGB
         */\r
        public void setBuffer(javax.media.Buffer i_buffer) throws NyARException\r
        {\r
-               this._reader.changeBuffer(i_buffer);\r
+               super.setBuffer(i_buffer);\r
                synchronized (this){\r
                        //キャプチャデータをi2dのバッファにコピーする。\r
                        //現在はJmfNyARRaster_RGBでRGB画像がノーマライズされているので、\r
                        //ここでもう一度flipする。(これ省略したいなあ…。)\r
-                       byte[] src=(byte[])this._reader.getBuffer();\r
+                       byte[] src=(byte[])this.getBuffer();\r
                        final int length = this._size.w * 3;\r
                        int src_idx = 0;\r
                        int dest_idx = (this._size.h - 1) * length;                     \r
@@ -79,7 +79,7 @@ public class J3dNyARRaster_RGB extends JmfNyARRaster_RGB
        {\r
                super(i_cparam.getScreenSize(),i_format);\r
                //bufferdimageの種類を決める\r
-               if(this._reader.getBufferType()!=INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24){\r
+               if(this.getBufferType()!=INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24){\r
                        throw new NyARException();\r
                }\r
                //RGBのラスタを作る。\r
index 3f26617..b715bbd 100644 (file)
@@ -69,7 +69,7 @@ public class NyARSingleMarkerBehaviorHolder implements JmfCaptureListener
                this._capture.setCaptureFormat(scr_size.w, scr_size.h,15f);\r
                this._capture.setOnCapture(this);               \r
                this._nya_raster = new J3dNyARRaster_RGB(this._cparam,this._capture.getCaptureFormat());\r
-               this._nya = new NyARSingleDetectMarker(this._cparam, i_ar_code, i_marker_width,this._nya_raster.getBufferReader().getBufferType());\r
+               this._nya = new NyARSingleDetectMarker(this._cparam, i_ar_code, i_marker_width,this._nya_raster.getBufferType());\r
                this._nya_behavior = new NyARBehavior(this._nya, this._nya_raster, i_rate);\r
        }\r
 \r
@@ -208,7 +208,7 @@ class NyARBehavior extends Behavior
                                        raster.renewImageComponent2D();/*DirectXモードのときの対策*/\r
                                        back_ground.setImage(raster.getImageComponent2D());\r
                                }\r
-                               if (raster.hasData()) {\r
+                               if (raster.hasBuffer()) {\r
                                        is_marker_exist = related_nya.detectMarkerLite(raster, 100);\r
                                        if (is_marker_exist)\r
                                        {\r
diff --git a/trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/JmfCameraCapture.java b/trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/JmfCameraCapture.java
deleted file mode 100644 (file)
index 8f6939d..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/* \r
- * PROJECT: NyARToolkit JMF utilities.\r
- * --------------------------------------------------------------------------------\r
- * The MIT License\r
- * Copyright (c) 2008 nyatla\r
- * airmail(at)ebony.plala.or.jp\r
- * http://nyatla.jp/nyartoolkit/\r
- * \r
- * Permission is hereby granted, free of charge, to any person obtaining a copy\r
- * of this software and associated documentation files (the "Software"), to deal\r
- * in the Software without restriction, including without limitation the rights\r
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
- * copies of the Software, and to permit persons to whom the Software is\r
- * furnished to do so, subject to the following conditions:\r
- * The above copyright notice and this permission notice shall be included in\r
- * all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
- * THE SOFTWARE.\r
- * \r
- */\r
-package jp.nyatla.nyartoolkit.jmf.utils;\r
-\r
-import javax.media.*;\r
-import javax.media.protocol.*;\r
-import javax.media.control.*;\r
-import javax.media.format.*;\r
-import java.awt.*;\r
-import java.util.*;\r
-import javax.media.protocol.DataSource;\r
-\r
-import jp.nyatla.nyartoolkit.NyARException;\r
-\r
-/**\r
- * 簡易JMFキャプチャクラス\r
- * @deprecated このクラスは近い将来削除します。\r
- * JmfCaptureDeviceList/JmfCaptureDeviceを使用してください。\r
- * {@link #JmfCaptureDeviceList()}\r
- *\r
- */\r
-@Deprecated public class JmfCameraCapture\r
-{\r
-       private Dimension image_size;\r
-\r
-       private JmfCaptureListener capture_listener;\r
-\r
-       // private DataSource jmf_data_source;\r
-       private MonitorStream jmf_monitor_stream;\r
-\r
-       private Processor jmf_processor;\r
-\r
-       private VideoFormat jmf_video_format;\r
-\r
-       private Buffer read_buf = new Buffer();\r
-\r
-       public static final String PIXEL_FORMAT_RGB = "RGB";\r
-\r
-       public JmfCameraCapture(int i_width, int i_height, float i_rate, String i_pixcel_format)\r
-       {\r
-               String encoding = i_pixcel_format;// comboEncoding.getSelectedItem();\r
-               image_size = new Dimension(i_width, i_height);\r
-               jmf_video_format = new VideoFormat(encoding, image_size, Format.NOT_SPECIFIED, null, i_rate);\r
-       }\r
-\r
-       public Dimension getSize()\r
-       {\r
-               return image_size;\r
-       }\r
-\r
-       public javax.media.Buffer readBuffer() throws NyARException\r
-       {\r
-               if (jmf_monitor_stream == null) {\r
-                       throw new NyARException();\r
-               }\r
-               try {\r
-                       jmf_monitor_stream.read(read_buf);\r
-               } catch (Exception e) {\r
-                       throw new NyARException(e);\r
-               }\r
-               return read_buf;\r
-       }\r
-\r
-       public void setCaptureListener(JmfCaptureListener i_listener) throws NyARException\r
-       {\r
-               if (jmf_processor != null)\r
-               {\r
-                       throw new NyARException();\r
-               }\r
-               capture_listener = i_listener;\r
-\r
-       }\r
-\r
-       public void start() throws NyARException\r
-       {\r
-\r
-               DataSource ds = getCaptureDS(jmf_video_format);\r
-               VideoFormat[] formats = new VideoFormat[] { new VideoFormat(null) };\r
-               ProcessorModel pm = new ProcessorModel(ds, formats, null);// ,\r
-               // formats,\r
-               // ftd);\r
-               Processor processor;\r
-               try {\r
-                       processor = Manager.createRealizedProcessor(pm);\r
-               } catch (Exception e) {\r
-                       // Make sure the capture devices are released\r
-                       ds.disconnect();\r
-                       throw new NyARException(e);\r
-               }\r
-               // Get the monitor control:\r
-               // Since there are more than one MonitorControl objects\r
-               // exported by the DataSource, we get the specific one\r
-               // that is also the MonitorStream object.\r
-               jmf_monitor_stream = (MonitorStream) ds.getControl("jmfsample.MonitorStream");\r
-               jmf_monitor_stream.setCaptureListener(capture_listener);\r
-               // jmf_data_source=ds;\r
-               jmf_processor = processor;\r
-               jmf_processor.start();\r
-       }\r
-\r
-       public void stop()\r
-       {\r
-               jmf_processor.stop();\r
-               jmf_processor.close();\r
-               jmf_processor = null;\r
-\r
-       }\r
-\r
-       protected void finalize()\r
-       {\r
-               if (jmf_processor != null) {\r
-                       jmf_processor.stop();\r
-                       jmf_processor.close();\r
-                       jmf_processor = null;\r
-               }\r
-       }\r
-\r
-       private static DataSource getCaptureDS(VideoFormat vf)\r
-       {\r
-               DataSource dsVideo = null;\r
-               DataSource ds = null;\r
-\r
-               // Create a capture DataSource for the video\r
-               // If there is no video capture device, then exit with null\r
-               if (vf != null) {\r
-                       dsVideo = createDataSource(vf);\r
-                       if (dsVideo == null)\r
-                               return null;\r
-               }\r
-\r
-               // Create the monitoring datasource wrapper\r
-               if (dsVideo != null) {\r
-                       dsVideo = new MonitorCDS(dsVideo);\r
-                       return dsVideo;\r
-               }\r
-\r
-               // Merge the data sources, if both audio and video are available\r
-               try {\r
-                       ds = Manager.createMergingDataSource(new DataSource[] { dsVideo });\r
-               } catch (IncompatibleSourceException ise) {\r
-                       return null;\r
-               }\r
-\r
-               return ds;\r
-       }\r
-\r
-       private static DataSource createDataSource(Format format)\r
-       {\r
-               DataSource ds;\r
-               Vector devices;\r
-               CaptureDeviceInfo cdi;\r
-               MediaLocator ml;\r
-\r
-               // Find devices for format\r
-               devices = CaptureDeviceManager.getDeviceList(format);\r
-               if (devices.size() < 1) {\r
-                       System.err.println("! No Devices for " + format);\r
-                       return null;\r
-               }\r
-               // Pick the first device\r
-               cdi = (CaptureDeviceInfo) devices.elementAt(0);\r
-\r
-               ml = cdi.getLocator();\r
-\r
-               try {\r
-                       ds = Manager.createDataSource(ml);\r
-                       ds.connect();\r
-                       if (ds instanceof CaptureDevice) {\r
-                               setCaptureFormat((CaptureDevice) ds, format);\r
-                       }\r
-               } catch (Exception e) {\r
-                       System.err.println(e);\r
-                       return null;\r
-               }\r
-               return ds;\r
-       }\r
-\r
-       private static void setCaptureFormat(CaptureDevice cdev, Format format)\r
-       {\r
-               FormatControl[] fcs = cdev.getFormatControls();\r
-               if (fcs.length < 1) {\r
-                       return;\r
-               }\r
-               FormatControl fc = fcs[0];\r
-               Format[] formats = fc.getSupportedFormats();\r
-               for (int i = 0; i < formats.length; i++) {\r
-                       if (formats[i].matches(format)) {\r
-                               format = formats[i].intersects(format);\r
-                               fc.setFormat(format);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-}
\ No newline at end of file
index 4ce5937..0c35b31 100644 (file)
@@ -19,16 +19,16 @@ import jp.nyatla.nyartoolkit.*;
  */\r
 public class JmfCaptureDeviceList\r
 {\r
-       private Vector _devices;\r
+       private Vector<CaptureDeviceInfo> _devices;\r
 \r
        public JmfCaptureDeviceList() throws NyARException\r
-       {\r
-               this._devices = (Vector) CaptureDeviceManager.getDeviceList(null).clone();\r
+       { \r
+               this._devices = (Vector<CaptureDeviceInfo>)(CaptureDeviceManager.getDeviceList(null).clone());\r
                // ビデオソースのデバイスだけ残す\r
                try {\r
 \r
                        for (int i = 0; i < this._devices.size();) {\r
-                               CaptureDeviceInfo cdi = (CaptureDeviceInfo) this._devices.elementAt(i);\r
+                               CaptureDeviceInfo cdi =this._devices.elementAt(i);\r
                                // VideoFormatもってるかな?\r
                                if (!isCaptureDevice(cdi)) {\r
                                        this._devices.remove(i);\r
index 15bf2c6..06fd00b 100644 (file)
@@ -34,19 +34,148 @@ import com.sun.media.codec.video.colorspace.*;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 \r
 \r
+\r
+\r
+/**\r
+ * \r
+ * RGB形式のJMFバッファをラップするNyARRasterです。\r
+ * JMFから得たラスタデータのピクセル並び順を考慮します。\r
+ *\r
+ */\r
+public class JmfNyARRaster_RGB implements INyARRgbRaster\r
+{\r
+       private JmfRGB24RasterHolder _holder;\r
+       protected NyARIntSize _size;\r
+\r
+       /**\r
+        * i_fmtに一致する画素フォーマットのRasterを作成します。\r
+        * このコンストラクタで作成したクラスは、hasBuffer()がfalseを返すことがあります。\r
+        * @param i_width\r
+        * @param i_height\r
+        * @param i_fmt\r
+        * @throws NyARException\r
+        */\r
+       public JmfNyARRaster_RGB(int i_width,int i_height,VideoFormat i_fmt) throws NyARException\r
+       {\r
+               initMember(i_width,i_height,i_fmt);\r
+       }\r
+       /**\r
+        * i_fmtに一致する画素フォーマットのRasterを作成します。\r
+        * このコンストラクタで作成したクラスは、hasBuffer()がfalseを返すことがあります。\r
+        * @param i_size\r
+        * @param i_fmt\r
+        * @throws NyARException\r
+        */\r
+       public JmfNyARRaster_RGB(NyARIntSize i_size,VideoFormat i_fmt) throws NyARException\r
+       {\r
+               initMember(i_size.w,i_size.h,i_fmt);\r
+       }\r
+       private void initMember(int i_width,int i_height,VideoFormat i_fmt) throws NyARException\r
+       {\r
+               this._size= new NyARIntSize(i_width,i_height);\r
+               // データサイズの確認\r
+               final Dimension s = i_fmt.getSize();\r
+               if (!this._size.isEqualSize(s.width,s.height)) {\r
+                       throw new NyARException();\r
+               }\r
+               // データ配列の確認\r
+               if(i_fmt instanceof YUVFormat){\r
+                       //YUVフォーマット\r
+                       this._holder=new NyARGLPixelReader_YUV(this._size,(YUVFormat)i_fmt);                    \r
+               }else if(i_fmt instanceof RGBFormat){\r
+                       //RGBフォーマット\r
+                       this._holder=new NyARGLPixelReader_RGB24(this._size,(RGBFormat)i_fmt);\r
+               }else{\r
+                       throw new NyARException();\r
+               }               \r
+       }\r
+       public void setBuffer(javax.media.Buffer i_buffer) throws NyARException\r
+       {\r
+               this._holder.setMediaBuffer(i_buffer);\r
+               return;\r
+       }\r
+       final public int getWidth()\r
+       {\r
+               return this._size.w;\r
+       }\r
+\r
+       final public int getHeight()\r
+       {\r
+               return this._size.h;\r
+       }\r
+\r
+       final public NyARIntSize getSize()\r
+       {\r
+               return this._size;\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return this._holder.buffer_type;\r
+       }\r
+       final public INyARRgbPixelReader getRgbPixelReader()\r
+       {\r
+               return this._holder;\r
+       }\r
+       /**\r
+        * インスタンスがバッファを所有するかを返します。\r
+        * @return\r
+        */     \r
+       final public boolean hasBuffer()\r
+       {\r
+               return this._holder.buffer!=null;\r
+       }\r
+       final public Object getBuffer()\r
+       {\r
+               assert(this._holder.buffer!=null);\r
+               return this._holder.buffer;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return this._holder.buffer_type==i_type_value;\r
+       }\r
+       final public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }\r
+       /**\r
+        *      @deprecated hasBuffer()関数を使ってください。\r
+        * \r
+        */\r
+       final public boolean hasData()\r
+       {\r
+               return this.hasBuffer();\r
+       }\r
+\r
+}\r
+\r
+\r
+/**\r
+ * JMFと汎用バッファを中継する拡張INyARRgbPixelReader\r
+ * @author nyatla\r
+ *\r
+ */\r
+abstract class JmfRGB24RasterHolder implements INyARRgbPixelReader\r
+{\r
+       public int buffer_type;\r
+       public byte[] buffer;\r
+       public abstract void setMediaBuffer(javax.media.Buffer i_buffer);\r
+}\r
+\r
 /**\r
  * RGB24フォーマットのデータを扱うピクセルリーダ\r
  */\r
-class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader\r
+class NyARGLPixelReader_RGB24 extends JmfRGB24RasterHolder\r
 {\r
        protected boolean _is_flipped;\r
-       public NyARBufferReader_Reader_RGB24(RGBFormat i_input_format,NyARIntSize i_ref_size) throws NyARException\r
+       private NyARIntSize _ref_size;\r
+       public NyARGLPixelReader_RGB24(NyARIntSize i_ref_size,RGBFormat i_input_format) throws NyARException\r
        {\r
-               super(i_ref_size);\r
+               this._ref_size=i_ref_size;\r
                //ピクセルフォーマットを設定(現状は24bitRGBを受けつける。)\r
                RGBFormat fm=(RGBFormat)i_input_format;\r
                if(fm.getBitsPerPixel()!=24){\r
@@ -55,20 +184,20 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
                int r=fm.getRedMask();\r
                int b=fm.getBlueMask();\r
                if(r==1 && b==3){\r
-                       this._buf_type=BUFFERFORMAT_BYTE1D_R8G8B8_24;\r
+                       this.buffer_type=INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24;\r
                }else if(r==3 && b==1){\r
-                       this._buf_type=BUFFERFORMAT_BYTE1D_B8G8R8_24;                   \r
+                       this.buffer_type=INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24;                     \r
                }else{\r
                        throw new NyARException();\r
                }\r
                //vertical反転の有無を確認\r
                this._is_flipped=i_input_format.getFlipped()!=0?true:false;\r
-               this._ref_buf=new byte[i_ref_size.w*i_ref_size.h*3];\r
+               this.buffer=new byte[i_ref_size.w*i_ref_size.h*3];\r
                //RGBフォーマット\r
                \r
                return;\r
        }\r
-       public void changeBuffer(javax.media.Buffer i_buffer)\r
+       public void setMediaBuffer(javax.media.Buffer i_buffer)\r
        {\r
                //vertical反転が必要ならば、反転した画像を作成する。\r
                byte[] src=(byte[])i_buffer.getData();\r
@@ -77,27 +206,27 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
                        int src_idx = 0;\r
                        int dest_idx = (this._ref_size.h - 1) * length;                 \r
                        for (int i = 0; i < this._ref_size.h; i++) {\r
-                               System.arraycopy(src,src_idx, this._ref_buf, dest_idx, length);\r
+                               System.arraycopy(src,src_idx, this.buffer, dest_idx, length);\r
                                src_idx += length;\r
                                dest_idx -= length;\r
                        }\r
                }else{\r
-                       System.arraycopy(src,0,this._ref_buf,0,this._ref_buf.length);\r
-                       this._ref_buf=(byte[])i_buffer.getData();\r
+                       System.arraycopy(src,0,this.buffer,0,this.buffer.length);\r
+                       this.buffer=(byte[])i_buffer.getData();\r
                }\r
                return;\r
        }\r
        public void getPixel(int i_x, int i_y, int[] o_rgb) throws NyARException\r
        {\r
                int bp = (i_x + i_y * this._ref_size.w) * 3;\r
-               byte[] ref = this._ref_buf;\r
-               switch(this._buf_type){\r
-               case BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               byte[] ref = this.buffer;\r
+               switch(this.buffer_type){\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        o_rgb[0] = (ref[bp + 0] & 0xff);// R\r
                        o_rgb[1] = (ref[bp + 1] & 0xff);// G\r
                        o_rgb[2] = (ref[bp + 2] & 0xff);// B\r
                        break;\r
-               case BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                        o_rgb[0] = (ref[bp + 2] & 0xff);// B\r
                        o_rgb[1] = (ref[bp + 1] & 0xff);// G\r
                        o_rgb[2] = (ref[bp + 0] & 0xff);// R\r
@@ -110,10 +239,10 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
        public void getPixelSet(int[] i_x, int i_y[], int i_num, int[] o_rgb) throws NyARException\r
        {\r
                int width = this._ref_size.w;\r
-               byte[] ref = this._ref_buf;\r
+               byte[] ref = this.buffer;\r
                int bp;\r
-               switch(this._buf_type){\r
-               case BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               switch(this.buffer_type){\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        for (int i = i_num - 1; i >= 0; i--) {\r
                                bp = (i_x[i] + i_y[i] * width) * 3;\r
                                o_rgb[i * 3 + 0] = (ref[bp + 0] & 0xff);// R\r
@@ -121,7 +250,7 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
                                o_rgb[i * 3 + 2] = (ref[bp + 2] & 0xff);// B\r
                        }\r
                        break;\r
-               case BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                        for (int i = i_num - 1; i >= 0; i--) {\r
                                bp = (i_x[i] + i_y[i] * width) * 3;\r
                                o_rgb[i * 3 + 0] = (ref[bp + 2] & 0xff);// B\r
@@ -142,6 +271,10 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
        {\r
                NyARException.notImplement();           \r
        }\r
+       public void switchBuffer(Object i_ref_object) throws NyARException\r
+       {\r
+               NyARException.notImplement();           \r
+       }\r
 \r
 }\r
 \r
@@ -153,10 +286,11 @@ class NyARBufferReader_Reader_RGB24 extends NyARBufferReader_Reader
  * ソースデータをセットした時に変換します。\r
  * (将来YUVをそのまま素通りさせるように書き換えるかも)\r
  */\r
-class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader\r
+class NyARGLPixelReader_YUV extends JmfRGB24RasterHolder\r
 {\r
-       \r
+       private NyARIntSize _ref_size;  \r
        private YUVToRGB _yuv2rgb;\r
+\r
        private javax.media.Buffer _rgb_buf;\r
        /**\r
         * フォーマットアレイから、BGR24フォーマットを探す\r
@@ -178,12 +312,13 @@ class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader
                }\r
                return null;\r
        }\r
-       public NyARBufferReader_Reader_YUV(YUVFormat i_input_format,NyARIntSize i_ref_size) throws NyARException\r
+       public NyARGLPixelReader_YUV(NyARIntSize i_ref_size,YUVFormat i_input_format) throws NyARException\r
        {\r
-               super(i_ref_size,BUFFERFORMAT_BYTE1D_B8G8R8_24);\r
+               this._ref_size=i_ref_size;\r
+               this.buffer_type=INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24;\r
+               this.buffer=null;\r
                this._yuv2rgb=new YUVToRGB();\r
                this._rgb_buf=new javax.media.Buffer();\r
-               this._ref_buf=null;\r
                //24bit-BGRフォーマットのものを探す\r
                Format output_format=pickRGB24Format(this._yuv2rgb.getSupportedOutputFormats(i_input_format));\r
                if(output_format==null){\r
@@ -198,13 +333,13 @@ class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader
                }\r
                return;\r
        }\r
-       public void changeBuffer(javax.media.Buffer i_buffer)\r
+       public void setMediaBuffer(javax.media.Buffer i_buffer)\r
        {\r
                //エラー出した時のトラップ\r
                if(this._yuv2rgb.process(i_buffer, this._rgb_buf)!=YUVToRGB.BUFFER_PROCESSED_OK){\r
                        System.err.println("YUVToRGB.process error:");\r
                }\r
-               this._ref_buf=(byte[])this._rgb_buf.getData();\r
+               this.buffer=(byte[])this._rgb_buf.getData();\r
                return;\r
        }\r
        public void getPixel(int i_x, int i_y, int[] o_rgb) throws NyARException\r
@@ -212,7 +347,7 @@ class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader
                //IN :BGRBGR\r
                //   :012012\r
                final int bp = (i_x + i_y * this._ref_size.w) * 3;\r
-               final byte[] ref = this._ref_buf;\r
+               final byte[] ref = this.buffer;\r
                o_rgb[0] = (ref[bp + 2] & 0xff);// R\r
                o_rgb[1] = (ref[bp + 1] & 0xff);// G\r
                o_rgb[2] = (ref[bp + 0] & 0xff);// B\r
@@ -222,7 +357,7 @@ class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader
        {\r
                int bp;\r
                final int width = this._ref_size.w;\r
-               final byte[] ref = this._ref_buf;\r
+               final byte[] ref = this.buffer;\r
                for (int i = i_num - 1; i >= 0; i--) {\r
                        bp = (i_x[i] + i_y[i] * width) * 3;\r
                        o_rgb[i * 3 + 0] = (ref[bp + 2] & 0xff);// R\r
@@ -239,97 +374,9 @@ class NyARBufferReader_Reader_YUV extends NyARBufferReader_Reader
        {\r
                NyARException.notImplement();           \r
        }\r
-       \r
-}\r
-\r
-\r
-/**\r
- * \r
- * RGB形式のJMFバッファをラップするNyARRasterです。\r
- * JMFから得たラスタデータのピクセル並び順を考慮します。\r
- *\r
- */\r
-public class JmfNyARRaster_RGB extends NyARRgbRaster_BasicClass\r
-{\r
-\r
-       protected NyARBufferReader_Reader _reader;\r
-       /**\r
-        * i_formatに一致する画素フォーマットの\r
-        * @param i_size\r
-        * @param i_format\r
-        * @throws NyARException\r
-        */\r
-\r
-\r
-       public JmfNyARRaster_RGB(NyARIntSize i_ref_size,VideoFormat i_format) throws NyARException\r
+       public void switchBuffer(Object i_ref_object) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_ref_size));             \r
-               this._reader = createReader(i_format);\r
-       }\r
-       public JmfNyARRaster_RGB(int i_width,int i_height,VideoFormat i_format) throws NyARException\r
-       {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               this._reader = createReader(i_format);\r
-       }\r
-       \r
-       /**\r
-        * フォーマットを解析して、マッチするリーダオブジェクトを返します。\r
-        * @param i_fmt\r
-        * ビデオフォーマットを指定します。\r
-        * @return\r
-        * リーダオブジェクト\r
-        * @throws NyARException\r
-        */\r
-       private NyARBufferReader_Reader createReader(VideoFormat i_fmt) throws NyARException\r
-       {\r
-               // データサイズの確認\r
-               final Dimension s = i_fmt.getSize();\r
-               if (!this._size.isEqualSize(s.width, s.height)) {\r
-                       throw new NyARException();\r
-               }\r
-               // データ配列の確認\r
-               if(i_fmt instanceof YUVFormat){\r
-                       //YUVフォーマット\r
-                       return new NyARBufferReader_Reader_YUV((YUVFormat)i_fmt,this._size);                    \r
-               }else if(i_fmt instanceof RGBFormat){\r
-                       //RGBフォーマット\r
-                       return new NyARBufferReader_Reader_RGB24((RGBFormat)i_fmt,this._size);\r
-               }else{\r
-                       throw new NyARException();\r
-               }\r
-       }\r
-\r
-       /**\r
-        * javax.media.Bufferを分析して、その分析結果をNyARRasterに適合する形で保持します。\r
-        * 関数実行後に外部でi_bufferの内容変更した場合には、再度setBuffer関数を呼び出してください。\r
-        * この関数を実行すると、getRgbPixelReaderで取得したReaderのプロパティが変化することがあります。\r
-        * @param i_buffer\r
-        * RGB形式のデータを格納したjavax.media.Bufferオブジェクトを指定してください。\r
-        * @return i_bufferをラップしたオブジェクトを返します。\r
-        * @throws NyARException\r
-        */\r
-       public void setBuffer(javax.media.Buffer i_buffer) throws NyARException\r
-       {\r
-               this._reader.changeBuffer(i_buffer);\r
-               return;\r
-       }\r
-       /**\r
-        * データを持っているかを返します。\r
-        * @return\r
-        */\r
-       public boolean hasData()\r
-       {\r
-               return this._reader._ref_buf != null;\r
-       }\r
-       public INyARRgbPixelReader getRgbPixelReader()\r
-       {\r
-               return this._reader;\r
-       }\r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._reader;\r
-       }\r
+               NyARException.notImplement();           \r
+       }       \r
 }\r
 \r
-\r
-\r
diff --git a/trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/NyARBufferReader_Reader.java b/trunk/src.utils/jmf/jp/nyatla/nyartoolkit/jmf/utils/NyARBufferReader_Reader.java
deleted file mode 100644 (file)
index 8648612..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* \r
- * PROJECT: NyARToolkit JMF utilities.\r
- * --------------------------------------------------------------------------------\r
- * The MIT License\r
- * Copyright (c) 2008 nyatla\r
- * airmail(at)ebony.plala.or.jp\r
- * http://nyatla.jp/nyartoolkit/\r
- * \r
- * Permission is hereby granted, free of charge, to any person obtaining a copy\r
- * of this software and associated documentation files (the "Software"), to deal\r
- * in the Software without restriction, including without limitation the rights\r
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
- * copies of the Software, and to permit persons to whom the Software is\r
- * furnished to do so, subject to the following conditions:\r
- * The above copyright notice and this permission notice shall be included in\r
- * all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
- * THE SOFTWARE.\r
- * \r
- */\r
-package jp.nyatla.nyartoolkit.jmf.utils;\r
-\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARRgbPixelReader;\r
-import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
-\r
-public abstract class NyARBufferReader_Reader implements INyARRgbPixelReader,INyARBufferReader\r
-{\r
-       protected byte[] _ref_buf;\r
-       protected NyARIntSize _ref_size;\r
-       protected int _buf_type;\r
-       protected NyARBufferReader_Reader(NyARIntSize i_ref_size,int i_buf_type)\r
-       {\r
-               this._ref_size =i_ref_size;\r
-               this._buf_type=i_buf_type;\r
-               return;\r
-       }\r
-       protected NyARBufferReader_Reader(NyARIntSize i_ref_size)\r
-       {\r
-               this._ref_size =i_ref_size;\r
-               return;\r
-       }\r
-       final public Object getBuffer()\r
-       {\r
-               return this._ref_buf;\r
-       }\r
-       final public int getBufferType()\r
-       {\r
-               return this._buf_type;\r
-       }\r
-       final public boolean isEqualBufferType(int i_type_value)\r
-       {\r
-               return this._buf_type==i_type_value;\r
-       }\r
-       public abstract void changeBuffer(javax.media.Buffer i_buffer);\r
-\r
-}\r
index 0e1c29c..4f3634c 100644 (file)
@@ -36,7 +36,7 @@ import javax.media.opengl.GL;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.jmf.utils.*;\r
 import jp.nyatla.nyartoolkit.core.param.NyARParam;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import javax.media.format.*;\r
 \r
 /**\r
@@ -57,11 +57,22 @@ public class GLNyARRaster_RGB extends JmfNyARRaster_RGB
        public GLNyARRaster_RGB(NyARParam i_param,VideoFormat i_format) throws NyARException\r
        {\r
                super(i_param.getScreenSize(),i_format);\r
-               switch(this._reader.getBufferType()){\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               initMember(this.getBufferType());\r
+               return;\r
+       }\r
+       public GLNyARRaster_RGB(int i_width,int i_height,VideoFormat i_format) throws NyARException\r
+       {\r
+               super(i_width,i_height,i_format);\r
+               initMember(this.getBufferType());\r
+               return;\r
+       }       \r
+       private void initMember(int i_buffer_type) throws NyARException\r
+       {\r
+               switch(i_buffer_type){\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                        this._gl_flag = GL.GL_BGR;\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        this._gl_flag = GL.GL_RGB;\r
                        break;\r
                default:\r
@@ -77,7 +88,7 @@ public class GLNyARRaster_RGB extends JmfNyARRaster_RGB
         */\r
        public byte[] getGLRgbArray()\r
        {\r
-               return (byte[])this._reader.getBuffer();\r
+               return (byte[])this.getBuffer();\r
        }\r
 \r
        /**\r
@@ -90,4 +101,5 @@ public class GLNyARRaster_RGB extends JmfNyARRaster_RGB
        {\r
                return this._gl_flag;\r
        }\r
+\r
 }\r
index 76c4ee4..0ada1cd 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
-       <classpathentry path="" kind="src"/>\r
-       <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>\r
-       <classpathentry path="/NyARToolKit" combineaccessrules="false" kind="src"/>\r
-       <classpathentry path="C:/Program Files/QuickTime/QTSystem/QTJava.zip" kind="lib"/>\r
-       <classpathentry path="C:/Program Files/JMF2.1.1e/lib/jmf.jar" kind="lib"/>\r
-       <classpathentry path="" kind="output"/>\r
+       <classpathentry kind="src" path=""/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolKit"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/JMF2.1.1e/lib/jmf.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/jre6/lib/ext/QTJava.zip"/>\r
+       <classpathentry kind="output" path=""/>\r
 </classpath>\r
index 24f54fa..5a46699 100644 (file)
@@ -112,6 +112,10 @@ public class QtCameraCapture implements ActionListener
 \r
        }\r
 \r
+       /**\r
+        * @param input\r
+        * @throws QTException\r
+        */\r
        public void prepSetInput(Object input) throws QTException\r
        {\r
                QTSession.open();\r
@@ -122,6 +126,7 @@ public class QtCameraCapture implements ActionListener
                } else {\r
                        grabber = new SequenceGrabber();\r
                        grabber.setGWorld(graphics, null);\r
+                       //Please check WinVDIG if you got couldntGetRequiredComponent exception on Windows.\r
                        channel = new SGVideoChannel(grabber);\r
                        channel.setBounds(bounds);\r
 \r
index 3c96abd..edd972e 100644 (file)
  */\r
 package jp.nyatla.nyartoolkit.qt.utils;\r
 \r
-import java.awt.image.BufferedImage;\r
-import java.awt.image.DataBuffer;\r
-import java.awt.image.WritableRaster;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.raster.rgb.NyARRgbRaster_BasicClass;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
+import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
+\r
 /**\r
  * RGB形式のbyte配列をラップするNyARRasterです。\r
  * 保持したデータからBufferedImageを出力する機能も持ちます。\r
  */\r
-public class QtNyARRaster_RGB extends NyARRgbRaster_BasicClass\r
+public class QtNyARRaster_RGB implements INyARRgbRaster\r
 {\r
-       private class PixcelReader extends NyARRgbPixelReader_RGB24 implements INyARBufferReader\r
-       {\r
-               public PixcelReader(NyARIntSize i_size)\r
-               {\r
-                       super(null, i_size);\r
-                       return;\r
-               }\r
-\r
-               public void syncBuffer(byte[] i_ref_buffer)\r
-               {\r
-                       this._ref_buf = i_ref_buffer;\r
-                       return;\r
-               }\r
-\r
-               //\r
-               // INyARBufferReader\r
-               //\r
-               public Object getBuffer()\r
-               {\r
-                       return this._ref_buf;\r
-               }\r
-\r
-               public int getBufferType()\r
-               {\r
-                       return INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24;\r
-               }\r
-\r
-               public boolean isEqualBufferType(int i_type_value)\r
-               {\r
-                       return i_type_value == INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24;\r
-               }\r
-       }\r
-\r
-       protected byte[] _ref_buf;\r
-\r
-       protected PixcelReader _reader;\r
-\r
-       private WritableRaster _raster;\r
-\r
-       private BufferedImage _image;\r
+       private NyARIntSize _size;\r
+       private byte[] _buffer;\r
+       private NyARRgbPixelReader_BYTE1D_R8G8B8_24 _reader;\r
+       private int _buffer_type;\r
 \r
        /**\r
-        * RGB形式のJMFバッファをラップするオブジェクトをつくります。 生成直後のオブジェクトはデータを持ちません。 メンバ関数はsetBufferを実行後に使用可能になります。\r
+        * QuickTimeオブジェクトからイメージを取得するラスタオブジェクトを作ります。\r
+        * この\r
+        * @param i_width\r
+        * @param i_height\r
         */\r
        public QtNyARRaster_RGB(int i_width, int i_height)\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               this._ref_buf = null;\r
-               this._reader = new PixcelReader(this._size);\r
-               _raster = WritableRaster.createInterleavedRaster(DataBuffer.TYPE_BYTE, i_width, i_height, i_width * 3, 3, new int[] { 0, 1, 2 }, null);\r
-               _image = new BufferedImage(i_width, i_height, BufferedImage.TYPE_3BYTE_BGR);\r
+               this._size=new NyARIntSize(i_width,i_height);\r
+               this._buffer= null;\r
+               this._buffer_type=INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24;\r
+               this._reader = new NyARRgbPixelReader_BYTE1D_R8G8B8_24(null,this._size);\r
        }\r
-\r
-       /**\r
-        * javax.media.Bufferを分析して、その分析結果をNyARRasterに適合する形で保持します。 関数実行後に外部でi_bufferの内容変更した場合には、再度setBuffer関数を呼び出してください。\r
-        * \r
-        * @param i_buffer\r
-        * RGB形式のデータを格納したjavax.media.Bufferオブジェクトを指定してください。\r
-        * @return i_bufferをラップしたオブジェクトを返します。\r
-        * @throws NyARException\r
-        */\r
-       public void setBuffer(byte[] i_buffer)\r
+       \r
+       final public int getWidth()\r
        {\r
-               this._ref_buf = i_buffer;\r
-               this._reader.syncBuffer(i_buffer);\r
+               return this._size.w;\r
        }\r
 \r
-       public INyARBufferReader getBufferReader()\r
+       final public int getHeight()\r
        {\r
-               return this._reader;\r
+               return this._size.h;\r
        }\r
 \r
-       public INyARRgbPixelReader getRgbPixelReader()\r
+       final public NyARIntSize getSize()\r
+       {\r
+               return this._size;\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return this._buffer_type;\r
+       }\r
+       final public INyARRgbPixelReader getRgbPixelReader()\r
        {\r
                return this._reader;\r
        }\r
-\r
-       /**\r
-        * データを持っているかを返します。\r
-        * \r
-        * @return\r
-        */\r
-       public boolean hasData()\r
+       final public boolean hasBuffer()\r
        {\r
-               return this._ref_buf != null;\r
+               return this._buffer!=null;\r
+       }\r
+       final public Object getBuffer()\r
+       {\r
+               assert(this._buffer!=null);\r
+               return this._buffer;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return this._buffer_type==i_type_value;\r
+       }\r
+       final public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               this._buffer=(byte[])i_ref_buf;\r
+               this._reader.switchBuffer(i_ref_buf);\r
        }\r
-\r
        /**\r
-        * 保持しているデータからBufferedImageを作って返します\r
+        *      @deprecated hasBuffer()関数を使ってください\r
         * \r
-        * @return\r
         */\r
-       public BufferedImage createImage()\r
+       final public boolean hasData()\r
        {\r
-               _raster.setDataElements(0, 0, this._size.w, this._size.h, this._ref_buf);\r
-               _image.setData(_raster);\r
-               return _image;\r
+               return this.hasBuffer();\r
        }\r
-\r
 }\r
index e71955e..3c53f21 100644 (file)
@@ -38,8 +38,6 @@ import java.io.StreamTokenizer;
 import jp.nyatla.nyartoolkit.*;\r
 import jp.nyatla.nyartoolkit.core.match.*;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 \r
 class NyARCodeFileReader\r
 {\r
@@ -58,9 +56,9 @@ class NyARCodeFileReader
                        StreamTokenizer st = new StreamTokenizer(new InputStreamReader(i_stream));\r
                        //GBRAで一度読みだす。\r
                        for (int h = 0; h < 4; h++) {\r
-                               assert o_raster[h].getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
+                               assert o_raster[h].isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                                final NyARRaster ra=o_raster[h];\r
-                               readBlock(st,ra.getWidth(),ra.getHeight(),(int[])ra.getBufferReader().getBuffer());\r
+                               readBlock(st,ra.getWidth(),ra.getHeight(),(int[])ra.getBuffer());\r
                        }\r
                } catch (Exception e) {\r
                        throw new NyARException(e);\r
@@ -77,11 +75,11 @@ class NyARCodeFileReader
        {\r
                int width=o_code.getWidth();\r
                int height=o_code.getHeight();\r
-               NyARRaster tmp_raster=new NyARRaster(new NyARIntSize(width,height),INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
+               NyARRaster tmp_raster=new NyARRaster(width,height,INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                //4個の要素をラスタにセットする。\r
                try {\r
                        StreamTokenizer st = new StreamTokenizer(new InputStreamReader(i_stream));\r
-                       int[] buf=(int[])tmp_raster.getBufferReader().getBuffer();\r
+                       int[] buf=(int[])tmp_raster.getBuffer();\r
                        //GBRAで一度読みだす。\r
                        for (int h = 0; h < 4; h++){\r
                                readBlock(st,width,height,buf);\r
index a012dc4..478751e 100644 (file)
@@ -1,13 +1,9 @@
 package jp.nyatla.nyartoolkit.core.analyzer.raster;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARRgbPixelReader_INT1D_X8R8G8B8_32;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.types.NyARHistgram;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
-import jp.nyatla.nyartoolkit.core.analyzer.histgram.*;\r
 /**\r
  * 画像のヒストグラムを計算します。\r
  * RGBの場合、(R+G+B)/3のヒストグラムを計算します。\r
@@ -33,23 +29,23 @@ public class NyARRasterAnalyzer_Histgram
        protected boolean initInstance(int i_raster_format,int i_vertical_interval)\r
        {\r
                switch (i_raster_format) {\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_BYTE1D_RGB_24();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_INT1D_GRAY_8();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_BYTE1D_B8G8R8X8_32();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_X8R8G8B8_32:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_X8R8G8B8_32:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_BYTE1D_X8R8G8B8_32();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_WORD1D_R5G6B5_16LE:\r
+               case INyARRaster.BUFFERFORMAT_WORD1D_R5G6B5_16LE:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_WORD1D_R5G6B5_16LE();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
                        this._histImpl = new NyARRasterThresholdAnalyzer_Histgram_INT1D_X8R8G8B8_32();\r
                        break;\r
                default:\r
@@ -88,19 +84,19 @@ public class NyARRasterAnalyzer_Histgram
                        h[i] = 0;\r
                }\r
                o_histgram.total_of_data=size.w*size.h/this._vertical_skip;\r
-               return this._histImpl.createHistgram(i_input.getBufferReader(), size,h,this._vertical_skip);            \r
+               return this._histImpl.createHistgram(i_input, size,h,this._vertical_skip);              \r
        }\r
        \r
        interface ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip);\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip);\r
        }\r
 \r
        class NyARRasterThresholdAnalyzer_Histgram_INT1D_GRAY_8 implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
-                       assert (i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        final int[] input=(int[]) i_reader.getBuffer();\r
                        for (int y = i_size.h-1; y >=0 ; y-=i_skip){\r
                                int pt=y*i_size.w;\r
@@ -114,9 +110,9 @@ public class NyARRasterAnalyzer_Histgram
        }\r
        class NyARRasterThresholdAnalyzer_Histgram_INT1D_X8R8G8B8_32 implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
-                       assert (i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32));\r
+                       assert (i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32));\r
                        final int[] input=(int[]) i_reader.getBuffer();\r
                        for (int y = i_size.h-1; y >=0 ; y-=i_skip){\r
                                int pt=y*i_size.w;\r
@@ -133,11 +129,11 @@ public class NyARRasterAnalyzer_Histgram
        \r
        class NyARRasterThresholdAnalyzer_Histgram_BYTE1D_RGB_24 implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
                        assert (\r
-                                       i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24)||\r
-                                       i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24));\r
+                                       i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24)||\r
+                                       i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24));\r
                        final byte[] input=(byte[]) i_reader.getBuffer();\r
                        final int pix_count=i_size.w;\r
                        final int pix_mod_part=pix_count-(pix_count%8);\r
@@ -176,9 +172,9 @@ public class NyARRasterAnalyzer_Histgram
 \r
        class NyARRasterThresholdAnalyzer_Histgram_BYTE1D_B8G8R8X8_32 implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
-               assert(i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32));\r
+               assert(i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32));\r
                byte[] input = (byte[])i_reader.getBuffer();\r
                int pix_count = i_size.w;\r
                int pix_mod_part = pix_count - (pix_count % 8);\r
@@ -220,9 +216,9 @@ public class NyARRasterAnalyzer_Histgram
 \r
        class NyARRasterThresholdAnalyzer_Histgram_BYTE1D_X8R8G8B8_32 implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
-               assert(i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_X8R8G8B8_32));\r
+               assert(i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_X8R8G8B8_32));\r
                byte[] input = (byte[])i_reader.getBuffer();\r
                int pix_count = i_size.w;\r
                int pix_mod_part = pix_count - (pix_count % 8);\r
@@ -264,9 +260,9 @@ public class NyARRasterAnalyzer_Histgram
 \r
        class NyARRasterThresholdAnalyzer_Histgram_WORD1D_R5G6B5_16LE implements ICreateHistgramImpl\r
        {\r
-               public int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
+               public int createHistgram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histgram,int i_skip)\r
                {\r
-               assert(i_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_WORD1D_R5G6B5_16LE));\r
+               assert(i_reader.isEqualBufferType(INyARRaster.BUFFERFORMAT_WORD1D_R5G6B5_16LE));\r
                short[] input = (short[])i_reader.getBuffer();\r
                int pix_count = i_size.w;\r
                int pix_mod_part = pix_count - (pix_count % 8);\r
index 02ad8d7..39731ea 100644 (file)
@@ -32,8 +32,6 @@ package jp.nyatla.nyartoolkit.core.labeling.artoolkit;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 /**\r
@@ -41,28 +39,35 @@ import jp.nyatla.nyartoolkit.core.types.*;
  */\r
 public class NyARLabelingImage extends NyARRaster_BasicClass\r
 {\r
-       private final static int MAX_LABELS = 1024*32;  \r
+       private final static int MAX_LABELS = 1024*32;\r
+\r
        protected int[] _ref_buf;\r
-       private INyARBufferReader _buffer_reader;\r
        protected NyARLabelingLabelStack _label_list;\r
        protected int[] _index_table;\r
        protected boolean _is_index_table_enable;\r
        public NyARLabelingImage(int i_width, int i_height) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D);\r
                this._ref_buf =new int[i_height*i_width];\r
                this._label_list = new NyARLabelingLabelStack(MAX_LABELS);\r
                this._index_table=new int[MAX_LABELS];\r
                this._is_index_table_enable=false;\r
-               this._buffer_reader=new NyARBufferReader(this._ref_buf,INyARBufferReader.BUFFERFORMAT_INT1D);\r
                //生成時に枠を書きます。\r
                drawFrameEdge();\r
                return;\r
        }\r
-       public INyARBufferReader getBufferReader()\r
+       public Object getBuffer()\r
+       {\r
+               return this._ref_buf;\r
+       }\r
+       public boolean hasBuffer()\r
        {\r
-               return this._buffer_reader;\r
+               return this._ref_buf!=null;\r
        }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }       \r
        /**\r
         * エッジを書きます。\r
         */\r
@@ -133,5 +138,5 @@ public class NyARLabelingImage extends NyARRaster_BasicClass
                }\r
                //あれ?見つからないよ?\r
                throw new NyARException();\r
-       }\r
+       }       \r
 }\r
index de61db2..3cd7bff 100644 (file)
@@ -32,7 +32,6 @@ package jp.nyatla.nyartoolkit.core.labeling.artoolkit;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 /**\r
@@ -55,7 +54,7 @@ final public class NyARLabeling_ARToolKit
         */\r
        public int labeling(NyARBinRaster i_raster,NyARLabelingImage o_destination) throws NyARException\r
        {\r
-               assert(i_raster.getBufferReader().getBufferType()==INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
+               assert(i_raster.getBufferType()==INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
                int label_img_ptr1, label_pixel;\r
                int i, j;\r
                int n, k; /* work */\r
@@ -66,7 +65,7 @@ final public class NyARLabeling_ARToolKit
 \r
                final int lxsize = in_size.w;// lxsize = arUtil_c.arImXsize;\r
                final int lysize = in_size.h;// lysize = arUtil_c.arImYsize;\r
-               final int[] label_img = (int[]) o_destination.getBufferReader().getBuffer();\r
+               final int[] label_img = (int[]) o_destination.getBuffer();\r
 \r
                // 枠作成はインスタンスを作った直後にやってしまう。\r
 \r
@@ -74,7 +73,7 @@ final public class NyARLabeling_ARToolKit
                o_destination.reset(true);\r
 \r
                int[] label_idxtbl = o_destination.getIndexArray();\r
-               int[] raster_buf = (int[]) i_raster.getBufferReader().getBuffer();\r
+               int[] raster_buf = (int[]) i_raster.getBuffer();\r
 \r
                int[] work2_pt;\r
                int wk_max = 0;\r
index 50a1962..fc0d1b1 100644 (file)
@@ -26,7 +26,6 @@ package jp.nyatla.nyartoolkit.core.labeling.rlelabeling;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.stack.NyObjectStack;\r
 \r
 class RleInfoStack extends NyObjectStack<RleInfoStack.RleInfo>\r
@@ -205,7 +204,7 @@ public class NyARLabeling_Rle
         */\r
        public int labeling(NyARBinRaster i_bin_raster, int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
        {\r
-               assert(i_bin_raster.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+               assert(i_bin_raster.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                return this.imple_labeling(i_bin_raster,0,i_top,i_bottom,o_stack);\r
        }\r
        /**\r
@@ -221,7 +220,7 @@ public class NyARLabeling_Rle
         */\r
        public int labeling(NyARGrayscaleRaster i_gs_raster,int i_th, int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
        {\r
-               assert(i_gs_raster.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert(i_gs_raster.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                return this.imple_labeling(i_gs_raster,i_th,i_top,i_bottom,o_stack);\r
        }\r
        private int imple_labeling(INyARRaster i_raster,int i_th,int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
@@ -236,7 +235,7 @@ public class NyARLabeling_Rle
                int len_prev = 0;\r
                int len_current = 0;\r
                final int width = i_raster.getWidth();\r
-               int[] in_buf = (int[]) i_raster.getBufferReader().getBuffer();\r
+               int[] in_buf = (int[]) i_raster.getBuffer();\r
 \r
                int id_max = 0;\r
                int label_count=0;\r
index 0edc28f..f947ef9 100644 (file)
@@ -70,7 +70,7 @@ public class NyARMatchPattDeviationBlackWhiteData
                int ave;//<PV/>\r
                int rgb;//<PV/>\r
                final int[] linput=this._data;//<PV/>\r
-               final int[] buf=(int[])i_raster.getBufferReader().getBuffer();\r
+               final int[] buf=(int[])i_raster.getBuffer();\r
 \r
                // input配列のサイズとwhも更新// input=new int[height][width][3];\r
                final int number_of_pixels=this._number_of_pixels;\r
index 3557ee6..0e9b85e 100644 (file)
@@ -71,10 +71,10 @@ public class NyARMatchPattDeviationColorData
        public void setRaster(INyARRaster i_raster)\r
        {\r
                //画素フォーマット、サイズ制限\r
-               assert i_raster.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
+               assert i_raster.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                assert i_raster.getSize().isEqualSize(i_raster.getSize());\r
 \r
-               final int[] buf=(int[])i_raster.getBufferReader().getBuffer();\r
+               final int[] buf=(int[])i_raster.getBuffer();\r
                //i_buffer[XRGB]→差分[R,G,B]変換                  \r
                int i;\r
                int ave;//<PV/>\r
index 7f2a356..c63ca69 100644 (file)
@@ -35,6 +35,8 @@ import jp.nyatla.nyartoolkit.core.NyARMat;
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
+\r
 /**\r
  * 24ビットカラーのマーカーを保持するために使うクラスです。 このクラスは、ARToolkitのパターンと、ラスタから取得したパターンを保持します。\r
  * 演算順序以外の最適化をしたもの\r
@@ -43,9 +45,8 @@ import jp.nyatla.nyartoolkit.core.types.*;
 public class NyARColorPatt_O1 implements INyARColorPatt\r
 {\r
        private static final int AR_PATT_SAMPLE_NUM = 64;\r
-       \r
+       private static final int BUFFER_FORMAT=INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32;\r
        private int[] _patdata;\r
-       private NyARBufferReader _buf_reader;\r
        private NyARRgbPixelReader_INT1D_X8R8G8B8_32 _pixelreader;\r
 \r
        private NyARIntSize _size;\r
@@ -57,7 +58,6 @@ public class NyARColorPatt_O1 implements INyARColorPatt
                \r
                this._size=new NyARIntSize(i_width,i_height);\r
                this._patdata = new int[i_height*i_width];\r
-               this._buf_reader=new NyARBufferReader(this._patdata,NyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                this._pixelreader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32(this._patdata,this._size);\r
                return;\r
        }\r
@@ -74,15 +74,30 @@ public class NyARColorPatt_O1 implements INyARColorPatt
        {\r
                return  this._size;\r
        }\r
-       public final INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buf_reader;\r
-       }\r
        public final INyARRgbPixelReader getRgbPixelReader()\r
        {\r
                return this._pixelreader;\r
        }\r
-\r
+       public Object getBuffer()\r
+       {\r
+               return this._patdata;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._patdata!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return BUFFER_FORMAT;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return BUFFER_FORMAT==i_type_value;\r
+       }\r
        private final NyARMat __get_cpara_a = new NyARMat(8, 8);\r
        private final NyARMat __get_cpara_b = new NyARMat(8, 1);\r
        private final static double[][] __get__cpara_world = {{ 100.0, 100.0 }, { 100.0 + 10.0, 100.0 }, { 100.0 + 10.0, 100.0 + 10.0 },{ 100.0, 100.0 + 10.0 } };\r
index 9546692..0225cf2 100644 (file)
@@ -35,6 +35,8 @@ import jp.nyatla.nyartoolkit.core.NyARMat;
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
+\r
 /**\r
  * 24ビットカラーのマーカーを保持するために使うクラスです。 このクラスは、ARToolkitのパターンと、ラスタから取得したパターンを保持します。\r
  * 演算順序を含む最適化をしたもの\r
@@ -43,9 +45,9 @@ import jp.nyatla.nyartoolkit.core.types.*;
 public class NyARColorPatt_O3 implements INyARColorPatt\r
 {\r
        private static final int AR_PATT_SAMPLE_NUM = 64;\r
+       private static final int BUFFER_FORMAT=INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32;\r
 \r
        private int[] _patdata;\r
-       private NyARBufferReader _buf_reader;\r
        private NyARIntSize _size;\r
        private NyARRgbPixelReader_INT1D_X8R8G8B8_32 _pixelreader;\r
        \r
@@ -53,7 +55,6 @@ public class NyARColorPatt_O3 implements INyARColorPatt
        {\r
                this._size=new NyARIntSize(i_width,i_height);\r
                this._patdata = new int[i_height*i_width];\r
-               this._buf_reader=new NyARBufferReader(this._patdata,NyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                this._pixelreader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32(this._patdata,this._size);\r
        }\r
        public int getWidth()\r
@@ -68,14 +69,30 @@ public class NyARColorPatt_O3 implements INyARColorPatt
        {\r
                return  this._size;\r
        }\r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buf_reader;\r
-       }\r
        public INyARRgbPixelReader getRgbPixelReader()\r
        {\r
                return this._pixelreader;\r
        }\r
+       public Object getBuffer()\r
+       {\r
+               return this._patdata;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._patdata!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return BUFFER_FORMAT;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return BUFFER_FORMAT==i_type_value;\r
+       }\r
        private final NyARMat wk_get_cpara_a = new NyARMat(8, 8);\r
        private final NyARMat wk_get_cpara_b = new NyARMat(8, 1);\r
        private final NyARMat wk_pickFromRaster_cpara = new NyARMat(8, 1);\r
index e3f9ae8..5d00f41 100644 (file)
@@ -26,6 +26,7 @@ package jp.nyatla.nyartoolkit.core.pickup;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.core.utils.NyARPerspectiveParamGenerator_O1;\r
@@ -41,11 +42,11 @@ public class NyARColorPatt_Perspective implements INyARColorPatt
        protected int[] _patdata;\r
        protected NyARIntPoint2d _pickup_lt=new NyARIntPoint2d();       \r
        protected int _resolution;\r
-       protected NyARBufferReader _buf_reader;\r
        protected NyARIntSize _size;\r
        protected NyARPerspectiveParamGenerator_O1 _perspective_gen;\r
        private NyARRgbPixelReader_INT1D_X8R8G8B8_32 _pixelreader;\r
        private static final int LOCAL_LT=1;\r
+       private static final int BUFFER_FORMAT=INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32;\r
        \r
        private void initializeInstance(int i_width, int i_height,int i_point_per_pix)\r
        {\r
@@ -53,7 +54,6 @@ public class NyARColorPatt_Perspective implements INyARColorPatt
                this._resolution=i_point_per_pix;       \r
                this._size=new NyARIntSize(i_width,i_height);\r
                this._patdata = new int[i_height*i_width];\r
-               this._buf_reader=new NyARBufferReader(this._patdata,INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                this._pixelreader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32(this._patdata,this._size);\r
                return;         \r
        }\r
@@ -134,14 +134,30 @@ public class NyARColorPatt_Perspective implements INyARColorPatt
        {\r
                return  this._size;\r
        }\r
-       public final INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buf_reader;\r
-       }\r
        public final INyARRgbPixelReader getRgbPixelReader()\r
        {\r
                return this._pixelreader;\r
        }\r
+       public Object getBuffer()\r
+       {\r
+               return this._patdata;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._patdata!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return BUFFER_FORMAT;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return BUFFER_FORMAT==i_type_value;\r
+       }\r
        private final int[] __pickFromRaster_rgb_tmp = new int[3];\r
        protected final double[] __pickFromRaster_cpara=new double[8];\r
        \r
index e46aebf..7e30847 100644 (file)
@@ -30,6 +30,7 @@ import jp.nyatla.nyartoolkit.core.raster.rgb.*;
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.core.types.matrix.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 \r
 \r
 \r
@@ -41,9 +42,9 @@ import jp.nyatla.nyartoolkit.core.types.matrix.*;
 public class NyARColorPatt_PseudoAffine implements INyARColorPatt\r
 {\r
        private int[] _patdata;\r
-       private NyARBufferReader _buf_reader;\r
        private NyARRgbPixelReader_INT1D_X8R8G8B8_32 _pixelreader;\r
        private NyARIntSize _size;\r
+       private static final int BUFFER_FORMAT=INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32;\r
                \r
        public final int getWidth()\r
        {\r
@@ -59,16 +60,30 @@ public class NyARColorPatt_PseudoAffine implements INyARColorPatt
        {\r
                return  this._size;\r
        }\r
-       \r
-       public final INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buf_reader;\r
-       }\r
-       \r
        public final INyARRgbPixelReader getRgbPixelReader()\r
        {\r
                return this._pixelreader;\r
        }\r
+       public Object getBuffer()\r
+       {\r
+               return this._patdata;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._patdata!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }\r
+       final public int getBufferType()\r
+       {\r
+               return BUFFER_FORMAT;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return BUFFER_FORMAT==i_type_value;\r
+       }       \r
        NyARDoubleMatrix44 _invmat=new NyARDoubleMatrix44();\r
        /**\r
         * @param i_width\r
@@ -78,7 +93,6 @@ public class NyARColorPatt_PseudoAffine implements INyARColorPatt
        {               \r
                this._size=new NyARIntSize(i_width,i_height);\r
                this._patdata = new int[i_height*i_width];\r
-               this._buf_reader=new NyARBufferReader(this._patdata,NyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
                this._pixelreader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32(this._patdata,this._size);\r
                //疑似アフィン変換のパラメタマトリクスを計算します。\r
                //長方形から計算すると、有効要素がm00,m01,m02,m03,m10,m11,m20,m23,m30になります。\r
index 5604dbe..df0e630 100644 (file)
 package jp.nyatla.nyartoolkit.core.raster;\r
 \r
 \r
+import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
+\r
 \r
 public interface INyARRaster\r
 {\r
-       public int getWidth();\r
+       public static final int BYTE1D =0x00010000;\r
+       public static final int INT2D  =0x00020000;\r
+       public static final int SHORT1D=0x00030000;\r
+       public static final int INT1D  =0x00040000;\r
+       public static final int OBJECT =0x00100000;\r
+       public static final int USER   =0x00FF0000;\r
+       //  24-31(8)予約\r
+       //  16-27(8)型ID\r
+       //      00:無効/01:byte[]/02:int[][]/03:short[]\r
+       //  08-15(8)ビットフォーマットID\r
+       //      00:24bit/01:32bit/02:16bit\r
+       //  00-07(8)型番号\r
+       //\r
+       /**\r
+        * RGB24フォーマットで、全ての画素が0\r
+        */\r
+       public static final int BUFFERFORMAT_NULL_ALLZERO = 0x00000001;\r
+       /**\r
+        * USER - USER+0xFFFFはユーザー定義型。実験用に。\r
+        */\r
+       public static final int BUFFERFORMAT_USER         = USER;\r
 \r
-       public int getHeight();\r
+       /**\r
+        * byte[]で、R8G8B8の24ビットで画素が格納されている。\r
+        */\r
+       public static final int BUFFERFORMAT_BYTE1D_R8G8B8_24   = BYTE1D|0x0001;\r
+       /**\r
+        * byte[]で、B8G8R8の24ビットで画素が格納されている。\r
+        */\r
+       public static final int BUFFERFORMAT_BYTE1D_B8G8R8_24   = BYTE1D|0x0002;\r
+       /**\r
+        * byte[]で、R8G8B8X8の32ビットで画素が格納されている。\r
+        */\r
+       public static final int BUFFERFORMAT_BYTE1D_B8G8R8X8_32 = BYTE1D|0x0101;\r
+       /**\r
+        * byte[]で、X8R8G8B8の32ビットで画素が格納されている。\r
+        */\r
+       public static final int BUFFERFORMAT_BYTE1D_X8R8G8B8_32 = BYTE1D|0x0102;\r
+\r
+       /**\r
+        * byte[]で、RGB565の16ビット(little/big endian)で画素が格納されている。\r
+        */\r
+       public static final int BUFFERFORMAT_BYTE1D_R5G6B5_16LE = BYTE1D|0x0201;\r
+    public static final int BUFFERFORMAT_BYTE1D_R5G6B5_16BE = BYTE1D|0x0202;\r
+       /**\r
+        * short[]で、RGB565の16ビット(little/big endian)で画素が格納されている。\r
+        */     \r
+    public static final int BUFFERFORMAT_WORD1D_R5G6B5_16LE = SHORT1D|0x0201;\r
+    public static final int BUFFERFORMAT_WORD1D_R5G6B5_16BE = SHORT1D|0x0202;\r
+\r
+       \r
+       /**\r
+        * int[][]で特に値範囲を定めない\r
+        */\r
+       public static final int BUFFERFORMAT_INT2D        = INT2D|0x0000;\r
+       /**\r
+        * int[][]で0-255のグレイスケール画像\r
+        */\r
+       public static final int BUFFERFORMAT_INT2D_GRAY_8 = INT2D|0x0001;\r
+       /**\r
+        * int[][]で0/1の2値画像\r
+        * これは、階調値1bitのBUFFERFORMAT_INT2D_GRAY_1と同じです。\r
+        */\r
+       public static final int BUFFERFORMAT_INT2D_BIN_8  = INT2D|0x0002;\r
 \r
+       /**\r
+        * int[]で特に値範囲を定めない\r
+        */\r
+       public static final int BUFFERFORMAT_INT1D        = INT1D|0x0000;\r
+       /**\r
+        * int[]で0-255のグレイスケール画像\r
+        */\r
+       public static final int BUFFERFORMAT_INT1D_GRAY_8 = INT1D|0x0001;\r
+       /**\r
+        * int[]で0/1の2値画像\r
+        * これは、階調1bitのBUFFERFORMAT_INT1D_GRAY_1と同じです。\r
+        */\r
+       public static final int BUFFERFORMAT_INT1D_BIN_8  = INT1D|0x0002;\r
+       \r
+       \r
+       /**\r
+        * int[]で、XRGB32の32ビットで画素が格納されている。\r
+        */     \r
+    public static final int BUFFERFORMAT_INT1D_X8R8G8B8_32=INT1D|0x0102;\r
+\r
+       /**\r
+        * H:9bit(0-359),S:8bit(0-255),V(0-255)\r
+        */\r
+       public static final int BUFFERFORMAT_INT1D_X7H9S8V8_32=INT1D|0x0103;\r
+    \r
+\r
+       \r
+       /**\r
+        * JavaのBufferedImageを格納するラスタ\r
+        */\r
+       public static final int BUFFERFORMAT_OBJECT_Java= OBJECT|0x0100;\r
+       public static final int BUFFERFORMAT_OBJECT_Java_BufferedImage= BUFFERFORMAT_OBJECT_Java|0x01;\r
+       \r
+       /**\r
+        * C#のBufferedImageを格納するラスタ\r
+        */\r
+       public static final int BUFFERFORMAT_OBJECT_CS= OBJECT|0x0200;\r
+       \r
+       /**\r
+        * ActionScript3のBitmapDataを格納するラスタ\r
+        */\r
+       public static final int BUFFERFORMAT_OBJECT_AS3= OBJECT|0x0300;\r
+       public static final int BUFFERFORMAT_OBJECT_AS3_BitmapData= BUFFERFORMAT_OBJECT_AS3|0x01;\r
+\r
+       \r
+       \r
+       \r
+       \r
+       \r
+       public int getWidth();\r
+       public int getHeight();\r
        public NyARIntSize getSize();\r
-       public INyARBufferReader getBufferReader();\r
+       /**\r
+        * バッファオブジェクトを返します。\r
+        * @return\r
+        */\r
+       public Object getBuffer();\r
+       /**\r
+        * バッファオブジェクトのタイプを返します。\r
+        * @return\r
+        */\r
+       public int getBufferType();\r
+       /**\r
+        * バッファのタイプがi_type_valueであるか、チェックします。\r
+        * @param i_type_value\r
+        * @return\r
+        */\r
+       public boolean isEqualBufferType(int i_type_value);\r
+       /**\r
+        * getBufferがオブジェクトを返せるかの真偽値です。\r
+        * @return\r
+        */\r
+       public boolean hasBuffer();\r
+       /**\r
+        * i_ref_bufをラップします。できる限り整合性チェックを行います。\r
+        * バッファの再ラッピングが可能な関数のみ、この関数を実装してください。\r
+        * @param i_ref_buf\r
+        */\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException;\r
 }
\ No newline at end of file
index b46582e..a336ff8 100644 (file)
  */\r
 package jp.nyatla.nyartoolkit.core.raster;\r
 \r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.*;\r
 \r
 public class NyARBinRaster extends NyARRaster_BasicClass\r
 {\r
        protected Object _buf;\r
-       protected INyARBufferReader _buffer_reader;\r
-\r
-       public NyARBinRaster(int i_width, int i_height,int i_raster_type) throws NyARException\r
+       /**\r
+        * バッファオブジェクトがアタッチされていればtrue\r
+        */\r
+       protected boolean _is_attached_buffer;\r
+       public NyARBinRaster(int i_width, int i_height,int i_raster_type,boolean i_is_alloc) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               if(!initInstance(this._size,i_raster_type)){\r
+               super(new NyARIntSize(i_width,i_height),i_raster_type);\r
+               if(!initInstance(this._size,i_raster_type,i_is_alloc)){\r
+                       throw new NyARException();\r
+               }\r
+       }\r
+       public NyARBinRaster(int i_width, int i_height,boolean i_is_alloc) throws NyARException\r
+       {\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
+               if(!initInstance(this._size,INyARRaster.BUFFERFORMAT_INT1D_BIN_8,i_is_alloc)){\r
                        throw new NyARException();\r
                }\r
        }\r
        public NyARBinRaster(int i_width, int i_height) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               if(!initInstance(this._size,INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8)){\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
+               if(!initInstance(this._size,INyARRaster.BUFFERFORMAT_INT1D_BIN_8,true)){\r
                        throw new NyARException();\r
                }\r
        }       \r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buffer_reader;\r
-       }\r
-       protected boolean initInstance(NyARIntSize i_size,int i_buf_type)\r
+       protected boolean initInstance(NyARIntSize i_size,int i_buf_type,boolean i_is_alloc)\r
        {\r
                switch(i_buf_type)\r
                {\r
-                       case INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8:\r
-                               this._buf = new int[i_size.w*i_size.h];\r
-                               this._buffer_reader=new NyARBufferReader(this._buf,INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
+                       case INyARRaster.BUFFERFORMAT_INT1D_BIN_8:\r
+                               this._buf = i_is_alloc?new int[i_size.w*i_size.h]:null;\r
                                break;\r
                        default:\r
                                return false;\r
                }\r
-               this._buffer_reader=new NyARBufferReader(this._buf,i_buf_type);\r
+               this._is_attached_buffer=i_is_alloc;\r
                return true;\r
+       }\r
+       public Object getBuffer()\r
+       {\r
+               return this._buf;\r
+       }\r
+       /**\r
+        * インスタンスがバッファを所有するかを返します。\r
+        * コンストラクタでi_is_allocをfalseにしてラスタを作成した場合、\r
+        * バッファにアクセスするまえに、バッファの有無をこの関数でチェックしてください。\r
+        * @return\r
+        */     \r
+       public boolean hasBuffer()\r
+       {\r
+               return this._buf!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf)\r
+       {\r
+               assert(!this._is_attached_buffer);//バッファがアタッチされていたら機能しない。\r
+               this._buf=i_ref_buf;\r
        }       \r
 }\r
index 21258c4..920d77d 100644 (file)
 package jp.nyatla.nyartoolkit.core.raster;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 public final class NyARGrayscaleRaster extends NyARRaster_BasicClass\r
 {\r
 \r
        protected Object _buf;\r
-       protected INyARBufferReader _buffer_reader;\r
+       /**\r
+        * バッファオブジェクトがアタッチされていればtrue\r
+        */\r
+       protected boolean _is_attached_buffer;\r
+\r
        public NyARGrayscaleRaster(int i_width, int i_height) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               if(!initInstance(this._size,INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8)){\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
+               if(!initInstance(this._size,INyARRaster.BUFFERFORMAT_INT1D_GRAY_8,true)){\r
                        throw new NyARException();\r
                }\r
        }       \r
-       public NyARGrayscaleRaster(int i_width, int i_height,int i_raster_type) throws NyARException\r
+       public NyARGrayscaleRaster(int i_width, int i_height,boolean i_is_alloc) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               if(!initInstance(this._size,i_raster_type)){\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
+               if(!initInstance(this._size,INyARRaster.BUFFERFORMAT_INT1D_GRAY_8,i_is_alloc)){\r
                        throw new NyARException();\r
                }\r
-       }\r
-       public INyARBufferReader getBufferReader()\r
+       }       \r
+       public NyARGrayscaleRaster(int i_width, int i_height,int i_raster_type,boolean i_is_alloc) throws NyARException\r
        {\r
-               return this._buffer_reader;\r
+               super(new NyARIntSize(i_width,i_height),i_raster_type);\r
+               if(!initInstance(this._size,i_raster_type,i_is_alloc)){\r
+                       throw new NyARException();\r
+               }\r
        }\r
-       protected boolean initInstance(NyARIntSize i_size,int i_buf_type)\r
+       protected boolean initInstance(NyARIntSize i_size,int i_buf_type,boolean i_is_alloc)\r
        {\r
                switch(i_buf_type)\r
                {\r
-                       case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
-                               this._buf = new int[i_size.w*i_size.h];\r
+                       case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
+                               this._buf =i_is_alloc?new int[i_size.w*i_size.h]:null;\r
                                break;\r
                        default:\r
                                return false;\r
                }\r
-               this._buffer_reader=new NyARBufferReader(this._buf,i_buf_type);\r
+               this._is_attached_buffer=i_is_alloc;\r
                return true;\r
        }\r
+       public Object getBuffer()\r
+       {\r
+               return this._buf;\r
+       }\r
+       /**\r
+        * インスタンスがバッファを所有するかを返します。\r
+        * コンストラクタでi_is_allocをfalseにしてラスタを作成した場合、\r
+        * バッファにアクセスするまえに、バッファの有無をこの関数でチェックしてください。\r
+        * @return\r
+        */\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._buf!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf)\r
+       {\r
+               assert(!this._is_attached_buffer);//バッファがアタッチされていたら機能しない。\r
+               this._buf=i_ref_buf;\r
+       }       \r
 }\r
index 632b2f8..6bb4386 100644 (file)
  */\r
 package jp.nyatla.nyartoolkit.core.raster;\r
 \r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARBufferReader;\r
+import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 public final class NyARHsvRaster extends NyARRaster_BasicClass\r
 {\r
 \r
        protected int[] _ref_buf;\r
-       private INyARBufferReader _buffer_reader;\r
        \r
        public NyARHsvRaster(int i_width, int i_height)\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
+               //このクラスは外部参照バッファ/形式多重化が使えない簡易実装です。\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_INT1D_X7H9S8V8_32);\r
                this._ref_buf = new int[i_height*i_width];\r
-               this._buffer_reader=new NyARBufferReader(this._ref_buf,INyARBufferReader.BUFFERFORMAT_INT1D_X7H9S8V8_32);\r
        }\r
-       public INyARBufferReader getBufferReader()\r
+       public Object getBuffer()\r
        {\r
-               return this._buffer_reader;\r
+               return this._ref_buf;\r
        }\r
+       public boolean hasBuffer()\r
+       {\r
+               return true;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               NyARException.notImplement();\r
+       }       \r
 }\r
index 540a3bb..98f74cd 100644 (file)
@@ -39,32 +39,67 @@ import jp.nyatla.nyartoolkit.core.types.*;
  */\r
 public final class NyARRaster extends NyARRaster_BasicClass\r
 {\r
-       protected NyARBufferReader _reader;\r
        protected Object _buf;\r
-       \r
-       public NyARRaster(NyARIntSize i_size,int i_buf_type) throws NyARException\r
+       protected int _buf_type;\r
+       /**\r
+        * バッファオブジェクトがアタッチされていればtrue\r
+        */\r
+       protected boolean _is_attached_buffer;\r
+       /**\r
+        * 指定したバッファタイプのラスタを作成します。\r
+        * @param i_width\r
+        * @param i_height\r
+        * @param i_buffer_type\r
+        * @param i_is_alloc\r
+        * @throws NyARException\r
+        */\r
+       public NyARRaster(int i_width, int i_height,int i_buffer_type,boolean i_is_alloc) throws NyARException\r
        {\r
-               super(i_size);\r
-               if(!initInstance(i_size,i_buf_type)){\r
+               super(new NyARIntSize(i_width,i_height),i_buffer_type);\r
+               if(!initInstance(this._size,i_buffer_type,i_is_alloc)){\r
                        throw new NyARException();\r
                }\r
                return;\r
-       }\r
-       protected boolean initInstance(NyARIntSize i_size,int i_buf_type)\r
+       }       \r
+\r
+       public NyARRaster(int i_width, int i_height,int i_buffer_type) throws NyARException\r
+       {\r
+               super(new NyARIntSize(i_width,i_height),i_buffer_type);\r
+               if(!initInstance(this._size,i_buffer_type,true)){\r
+                       throw new NyARException();\r
+               }\r
+               return;\r
+       }       \r
+       protected boolean initInstance(NyARIntSize i_size,int i_buf_type,boolean i_is_alloc)\r
        {\r
                switch(i_buf_type)\r
                {\r
-                       case INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
-                               this._buf=new int[i_size.w*i_size.h];\r
+                       case INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
+                               this._buf=i_is_alloc?new int[i_size.w*i_size.h]:null;\r
                                break;\r
                        default:\r
                                return false;\r
                }\r
-               this._reader=new NyARBufferReader(this._buf,i_buf_type);\r
+               this._is_attached_buffer=i_is_alloc;\r
                return true;\r
        }\r
-       public INyARBufferReader getBufferReader()\r
+       public Object getBuffer()\r
        {\r
-               return this._reader;\r
-       }       \r
+               return this._buf;\r
+       }\r
+       /**\r
+        * インスタンスがバッファを所有するかを返します。\r
+        * コンストラクタでi_is_allocをfalseにしてラスタを作成した場合、\r
+        * バッファにアクセスするまえに、バッファの有無をこの関数でチェックしてください。\r
+        * @return\r
+        */     \r
+       public boolean hasBuffer()\r
+       {\r
+               return this._buf!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               assert(!this._is_attached_buffer);//バッファがアタッチされていたら機能しない。\r
+               this._buf=i_ref_buf;\r
+       }\r
 }
\ No newline at end of file
index 6f027cc..56397d4 100644 (file)
@@ -34,10 +34,12 @@ import jp.nyatla.nyartoolkit.core.types.*;
 \r
 public abstract class NyARRaster_BasicClass implements INyARRaster\r
 {\r
-       final protected NyARIntSize _size;\r
-       protected NyARRaster_BasicClass(final NyARIntSize i_size)\r
+       protected NyARIntSize _size;\r
+       private int _buffer_type;\r
+       protected NyARRaster_BasicClass(final NyARIntSize i_size,int i_buffer_type)\r
        {\r
                this._size= i_size;\r
+               this._buffer_type=i_buffer_type;\r
        }\r
 \r
        final public int getWidth()\r
@@ -54,4 +56,12 @@ public abstract class NyARRaster_BasicClass implements INyARRaster
        {\r
                return this._size;\r
        }\r
+       final public int getBufferType()\r
+       {\r
+               return _buffer_type;\r
+       }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return this._buffer_type==i_type_value;\r
+       }\r
 }\r
index 87133f7..f0013f5 100644 (file)
@@ -3,40 +3,69 @@ package jp.nyatla.nyartoolkit.core.raster.rgb;
 import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 \r
 public class NyARRgbRaster extends NyARRgbRaster_BasicClass\r
 {\r
        protected Object _buf;\r
        protected INyARRgbPixelReader _reader;\r
-       protected INyARBufferReader _buffer_reader;\r
-       public NyARRgbRaster(NyARIntSize i_size,int i_raster_type) throws NyARException\r
+       /**\r
+        * バッファオブジェクトがアタッチされていればtrue\r
+        */\r
+       protected boolean _is_attached_buffer;\r
+       public NyARRgbRaster(int i_width, int i_height,int i_raster_type,boolean i_is_alloc) throws NyARException\r
        {\r
-               super(i_size);\r
-               if(!initInstance(i_size,i_raster_type)){\r
+               super(new NyARIntSize(i_width,i_height),i_raster_type);\r
+               if(!initInstance(this._size,i_raster_type,i_is_alloc)){\r
                        throw new NyARException();\r
                }\r
-               return;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader()\r
+       public NyARRgbRaster(int i_width, int i_height,int i_raster_type) throws NyARException\r
        {\r
-               return this._reader;\r
-       }\r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buffer_reader;\r
+               super(new NyARIntSize(i_width,i_height),i_raster_type);\r
+               if(!initInstance(this._size,i_raster_type,true)){\r
+                       throw new NyARException();\r
+               }\r
        }\r
-       protected boolean initInstance(NyARIntSize i_size,int i_raster_type)\r
+       protected boolean initInstance(NyARIntSize i_size,int i_raster_type,boolean i_is_alloc)\r
        {\r
                switch(i_raster_type)\r
                {\r
-                       case INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
-                               this._buf=new int[i_size.w*i_size.h];\r
+                       case INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
+                               this._buf=i_is_alloc?new int[i_size.w*i_size.h]:null;\r
                                this._reader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32((int[])this._buf,i_size);\r
                                break;\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
+                               this._buf=i_is_alloc?new byte[i_size.w*i_size.h*4]:null;\r
+                               this._reader=new NyARRgbPixelReader_BYTE1D_B8G8R8X8_32((byte[])this._buf,i_size);\r
+                               break;\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+                               this._buf=i_is_alloc?new byte[i_size.w*i_size.h*3]:null;\r
+                               this._reader=new NyARRgbPixelReader_BYTE1D_R8G8B8_24((byte[])this._buf,i_size);\r
+                               break;\r
                        default:\r
                                return false;\r
                }\r
-               this._buffer_reader=new NyARBufferReader(this._buf,i_raster_type);\r
+               this._is_attached_buffer=i_is_alloc;\r
                return true;\r
-       }       \r
+       }\r
+       public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
+       {\r
+               return this._reader;\r
+       }\r
+       public Object getBuffer()\r
+       {\r
+               return this._buf;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return this._buf!=null;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
+       {\r
+               assert(!this._is_attached_buffer);//バッファがアタッチされていたら機能しない。\r
+               this._buf=i_ref_buf;\r
+               //ピクセルリーダーの参照バッファを切り替える。\r
+               this._reader.switchBuffer(i_ref_buf);\r
+       }\r
 }\r
index 56b1e6c..62d7d8f 100644 (file)
 package jp.nyatla.nyartoolkit.core.raster.rgb;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
-import jp.nyatla.nyartoolkit.core.types.*;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 \r
-public class NyARRgbRaster_BGRA extends NyARRgbRaster_BasicClass implements INyARRgbRaster\r
+public class NyARRgbRaster_BGRA extends NyARRgbRaster\r
 {\r
-       private class PixelReader implements INyARRgbPixelReader\r
+       public NyARRgbRaster_BGRA(int i_width, int i_height,Boolean i_is_alloc) throws NyARException\r
        {\r
-               private NyARRgbRaster_BGRA _parent;\r
-\r
-               public PixelReader(NyARRgbRaster_BGRA i_parent)\r
-               {\r
-                       this._parent = i_parent;\r
-               }\r
-\r
-               public void getPixel(int i_x, int i_y, int[] o_rgb)\r
-               {\r
-                       final byte[] ref_buf = this._parent._ref_buf;\r
-                       final int bp = (i_x + i_y * this._parent._size.w) * 4;\r
-                       o_rgb[0] = (ref_buf[bp + 2] & 0xff);// R\r
-                       o_rgb[1] = (ref_buf[bp + 1] & 0xff);// G\r
-                       o_rgb[2] = (ref_buf[bp + 0] & 0xff);// B\r
-                       return;\r
-               }\r
-\r
-               public void getPixelSet(int[] i_x, int[] i_y, int i_num, int[] o_rgb)\r
-               {\r
-                       int bp;\r
-                       final int width = _parent._size.w;\r
-                       final byte[] ref_buf = _parent._ref_buf;\r
-                       for (int i = i_num - 1; i >= 0; i--) {\r
-                               bp = (i_x[i] + i_y[i] * width) * 4;\r
-                               o_rgb[i * 3 + 0] = (ref_buf[bp + 2] & 0xff);// R\r
-                               o_rgb[i * 3 + 1] = (ref_buf[bp + 1] & 0xff);// G\r
-                               o_rgb[i * 3 + 2] = (ref_buf[bp + 0] & 0xff);// B\r
-                       }\r
-                       return;\r
-               }\r
-               public void setPixel(int i_x, int i_y, int[] i_rgb) throws NyARException\r
-               {\r
-                       final byte[] ref_buf = this._parent._ref_buf;\r
-                       final int bp = (i_x + i_y * this._parent._size.w) * 4;\r
-                       ref_buf[bp+0] = (byte)i_rgb[0];// R\r
-                       ref_buf[bp+1] = (byte)i_rgb[1];// G\r
-                       ref_buf[bp+2] = (byte)i_rgb[2];// B     \r
-               }\r
-               public void setPixels(int[] i_x, int[] i_y, int i_num, int[] i_intrgb) throws NyARException\r
-               {\r
-                       NyARException.notImplement();           \r
-               }\r
-               \r
-       }\r
-\r
-       private INyARRgbPixelReader _rgb_reader;\r
-       private INyARBufferReader _buffer_reader;\r
-       private byte[] _ref_buf;\r
-\r
-       public static NyARRgbRaster_BGRA wrap(byte[] i_buffer, int i_width, int i_height)\r
-       {\r
-               return new NyARRgbRaster_BGRA(i_buffer, i_width, i_height);\r
-       }\r
-\r
-       private NyARRgbRaster_BGRA(byte[] i_ref_buffer, int i_width, int i_height)\r
-       {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               this._ref_buf = i_ref_buffer;\r
-               this._rgb_reader = new PixelReader(this);\r
-               this._buffer_reader=new NyARBufferReader(i_ref_buffer,INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32);\r
-               return;\r
-       }\r
-       public NyARRgbRaster_BGRA(int i_width, int i_height)\r
+               super(i_width,i_height,INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32,i_is_alloc);\r
+       }       \r
+       public NyARRgbRaster_BGRA(int i_width, int i_height) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               this._ref_buf = new byte[i_width*i_height*4];\r
-               this._rgb_reader = new PixelReader(this);\r
-               this._buffer_reader=new NyARBufferReader(this._ref_buf,INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32);\r
+               super(i_width,i_height,INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32);\r
                return;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader()\r
-       {\r
-               return this._rgb_reader;\r
-       }\r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buffer_reader;\r
-       }\r
 }\r
index 218bb7b..cc898e0 100644 (file)
@@ -30,8 +30,6 @@
  */\r
 package jp.nyatla.nyartoolkit.core.raster.rgb;\r
 \r
-import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARRgbPixelReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -42,11 +40,17 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
 public abstract class NyARRgbRaster_BasicClass implements INyARRgbRaster\r
 {\r
        final protected NyARIntSize _size;\r
+       private int _buffer_type;\r
+       \r
+       protected NyARRgbRaster_BasicClass(final NyARIntSize i_size,int i_buffer_type)\r
+       {\r
+               this._size= i_size;\r
+               this._buffer_type=i_buffer_type;\r
+       }\r
        final public int getWidth()\r
        {\r
                return this._size.w;\r
        }\r
-\r
        final public int getHeight()\r
        {\r
                return this._size.h;\r
@@ -55,14 +59,13 @@ public abstract class NyARRgbRaster_BasicClass implements INyARRgbRaster
        final public NyARIntSize getSize()\r
        {\r
                return this._size;\r
-       }       \r
-       protected NyARRgbRaster_BasicClass(final NyARIntSize i_size)\r
-       {\r
-               this._size= i_size;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
+       final public int getBufferType()\r
        {\r
-               NyARException.notImplement();\r
-               return null;\r
+               return _buffer_type;\r
        }\r
+       final public boolean isEqualBufferType(int i_type_value)\r
+       {\r
+               return this._buffer_type==i_type_value;\r
+       }       \r
 }\r
index b82894d..f1e2b49 100644 (file)
 package jp.nyatla.nyartoolkit.core.raster.rgb;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.rasterreader.INyARRgbPixelReader;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.NyARBufferReader;\r
-import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
+import jp.nyatla.nyartoolkit.core.types.*;\r
 \r
 /*\r
  * 真っ黒の矩形を定義する。\r
@@ -68,25 +67,35 @@ public class NyARRgbRaster_Blank extends NyARRgbRaster_BasicClass
                {\r
                        NyARException.notImplement();           \r
                }\r
+               public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+               {\r
+                       NyARException.notImplement();           \r
+               }               \r
                \r
        }\r
 \r
        private INyARRgbPixelReader _reader;\r
-       private INyARBufferReader _buffer_reader;\r
        \r
        public NyARRgbRaster_Blank(int i_width, int i_height)\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
+               super(new NyARIntSize(i_width,i_height),INyARRaster.BUFFERFORMAT_NULL_ALLZERO);\r
                this._reader = new PixelReader();\r
-               this._buffer_reader=new NyARBufferReader(null,INyARBufferReader.BUFFERFORMAT_NULL_ALLZERO);\r
                return;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader()\r
+       public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
        {\r
                return this._reader;\r
        }\r
-       public INyARBufferReader getBufferReader()\r
+       public Object getBuffer()\r
+       {\r
+               return null;\r
+       }\r
+       public boolean hasBuffer()\r
+       {\r
+               return false;\r
+       }\r
+       public void wrapBuffer(Object i_ref_buf) throws NyARException\r
        {\r
-               return this._buffer_reader;\r
+               NyARException.notImplement();\r
        }\r
 }\r
index e7eb964..7290f2e 100644 (file)
  */\r
 package jp.nyatla.nyartoolkit.core.raster.rgb;\r
 \r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
-import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
+import jp.nyatla.nyartoolkit.NyARException;\r
+import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
 \r
-public class NyARRgbRaster_RGB extends NyARRgbRaster_BasicClass\r
+public class NyARRgbRaster_RGB extends NyARRgbRaster\r
 {\r
-       protected byte[] _ref_buf;\r
-\r
-       private NyARRgbPixelReader_RGB24 _reader;\r
-       private INyARBufferReader _buffer_reader;\r
-       \r
-       public static NyARRgbRaster_RGB wrap(byte[] i_buffer, int i_width, int i_height)\r
+       public NyARRgbRaster_RGB(int i_width, int i_height,Boolean i_is_alloc) throws NyARException\r
        {\r
-               return new NyARRgbRaster_RGB(i_buffer, i_width, i_height);\r
+               super(i_width,i_height,INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24,i_is_alloc);\r
        }\r
 \r
-       private NyARRgbRaster_RGB(byte[] i_ref_buffer, int i_width, int i_height)\r
+       public NyARRgbRaster_RGB(int i_width, int i_height) throws NyARException\r
        {\r
-               super(new NyARIntSize(i_width,i_height));\r
-               this._ref_buf = i_ref_buffer;\r
-               this._reader = new NyARRgbPixelReader_RGB24(i_ref_buffer, this._size);\r
-               this._buffer_reader=new NyARBufferReader(i_ref_buffer,INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24);\r
+               super(i_width,i_height,INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24);\r
                return;\r
        }\r
-       public INyARRgbPixelReader getRgbPixelReader()\r
-       {\r
-               return this._reader;\r
-       }\r
-       public INyARBufferReader getBufferReader()\r
-       {\r
-               return this._buffer_reader;\r
-       }       \r
 }\r
index 9ec4926..d9ed34e 100644 (file)
@@ -26,7 +26,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -40,7 +39,7 @@ public class NyARRasterFilter_CustomToneTable implements INyARRasterFilter
        protected NyARRasterFilter_CustomToneTable(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._dofilterimpl=new IdoFilterImpl_INT1D_GRAY_8();\r
                        break;\r
                default:\r
@@ -51,20 +50,20 @@ public class NyARRasterFilter_CustomToneTable implements INyARRasterFilter
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._dofilterimpl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        private abstract class IdoFilterImpl\r
        {\r
                public int[] _table_ref;\r
-               public abstract void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public abstract void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
                \r
        }\r
        private class IdoFilterImpl_INT1D_GRAY_8 extends IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert(         i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(         i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        int[] in_buf = (int[]) i_input.getBuffer();\r
index c354d79..691c4bd 100644 (file)
@@ -26,7 +26,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 \r
@@ -41,7 +40,7 @@ public class NyARRasterFilter_GaussianSmooth implements INyARRasterFilter
        public NyARRasterFilter_GaussianSmooth(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._do_filter_impl=new IdoFilterImpl_GRAY_8();\r
                        break;\r
                default:\r
@@ -51,19 +50,19 @@ public class NyARRasterFilter_GaussianSmooth implements INyARRasterFilter
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
                assert (i_input!=i_output);\r
-               this._do_filter_impl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._do_filter_impl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_GRAY_8 implements IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert (i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] in_ptr =(int[])i_input.getBuffer();\r
                        int[] out_ptr=(int[])i_output.getBuffer();\r
                        int width=i_size.w;\r
index b792a42..159616b 100644 (file)
@@ -41,7 +41,7 @@ public class NyARRasterFilter_Reverse implements INyARRasterFilter
        public NyARRasterFilter_Reverse(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._do_filter_impl=new IdoFilterImpl_GRAY_8();\r
                        break;\r
                default:\r
@@ -50,19 +50,19 @@ public class NyARRasterFilter_Reverse implements INyARRasterFilter
        }\r
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
-               this._do_filter_impl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._do_filter_impl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_GRAY_8 implements IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert (i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] in_ptr =(int[])i_input.getBuffer();\r
                        int[] out_ptr=(int[])i_output.getBuffer();\r
 \r
index ce3f1c8..4c1b4c2 100644 (file)
@@ -2,7 +2,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -15,10 +14,10 @@ public class NyARRasterFilter_Rgb2Hsv implements INyARRasterFilter
        public NyARRasterFilter_Rgb2Hsv(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                        this._dofilterimpl=new IdoFilterImpl_BYTE1D_B8G8R8_24();\r
                        break;\r
-               case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+               case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                default:\r
                        throw new NyARException();\r
                }\r
@@ -26,19 +25,19 @@ public class NyARRasterFilter_Rgb2Hsv implements INyARRasterFilter
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._dofilterimpl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        abstract class IdoFilterImpl\r
        {\r
-               public abstract void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public abstract void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
                \r
        }\r
        class IdoFilterImpl_BYTE1D_B8G8R8_24 extends IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert(         i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_X7H9S8V8_32));\r
+                       assert(         i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_X7H9S8V8_32));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
index 7db0ea1..d918d4f 100644 (file)
@@ -26,7 +26,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -42,7 +41,7 @@ public class NyARRasterFilter_Roberts implements INyARRasterFilter
        public NyARRasterFilter_Roberts(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._do_filter_impl=new IdoFilterImpl_GRAY_8();\r
                        break;\r
                default:\r
@@ -51,19 +50,19 @@ public class NyARRasterFilter_Roberts implements INyARRasterFilter
        }\r
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
-               this._do_filter_impl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._do_filter_impl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_GRAY_8 implements IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert (i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] in_ptr =(int[])i_input.getBuffer();\r
                        int[] out_ptr=(int[])i_output.getBuffer();\r
                        int width=i_size.w;\r
index 39be984..c30646f 100644 (file)
@@ -26,7 +26,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.INyARRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 \r
@@ -41,7 +40,7 @@ public class NyARRasterFilter_SimpleSmooth implements INyARRasterFilter
        public NyARRasterFilter_SimpleSmooth(int i_raster_type) throws NyARException\r
        {\r
                switch (i_raster_type) {\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        this._do_filter_impl=new IdoFilterImpl_GRAY_8();\r
                        break;\r
                default:\r
@@ -51,19 +50,19 @@ public class NyARRasterFilter_SimpleSmooth implements INyARRasterFilter
        public void doFilter(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
        {\r
                assert (i_input!=i_output);\r
-               this._do_filter_impl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._do_filter_impl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_GRAY_8 implements IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert (i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] in_ptr =(int[])i_input.getBuffer();\r
                        int[] out_ptr=(int[])i_output.getBuffer();\r
                        /* 画像端は捨てる。\r
@@ -1,18 +1,17 @@
 package jp.nyatla.nyartoolkit.core.rasterfilter.gs2bin;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.raster.NyARBinRaster;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.NyARGrayscaleRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
-public class NyARRasterFilter_ConstantThrshold implements INyARRasterFilter_Gs2Bin\r
+public class NyARRasterFilter_ConstantThreshold implements INyARRasterFilter_Gs2Bin\r
 {\r
        public int _threshold;\r
-       public NyARRasterFilter_ConstantThrshold(int i_initial_threshold,int i_in_raster_type,int i_out_raster_type) throws NyARException\r
+       public NyARRasterFilter_ConstantThreshold(int i_initial_threshold,int i_in_raster_type,int i_out_raster_type) throws NyARException\r
        {\r
-               assert(i_in_raster_type==INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8);\r
-               assert(i_out_raster_type==INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
+               assert(i_in_raster_type==INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
+               assert(i_out_raster_type==INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
                //初期化\r
                this._threshold=i_initial_threshold;\r
                \r
@@ -22,7 +21,7 @@ public class NyARRasterFilter_ConstantThrshold implements INyARRasterFilter_Gs2B
         * 暗点<=th<明点となります。\r
         * @throws NyARException\r
         */\r
-       public NyARRasterFilter_ConstantThrshold() throws NyARException\r
+       public NyARRasterFilter_ConstantThreshold() throws NyARException\r
        {\r
                this._threshold=0;\r
        }\r
@@ -34,10 +33,10 @@ public class NyARRasterFilter_ConstantThrshold implements INyARRasterFilter_Gs2B
        }\r
        public void doFilter(NyARGrayscaleRaster i_input, NyARBinRaster i_output) throws NyARException\r
        {\r
-               assert(i_input.getBufferReader().getBufferType()==INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8);\r
-               assert(i_output.getBufferReader().getBufferType()==INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
-               int[] out_buf = (int[]) i_output.getBufferReader().getBuffer();\r
-               int[] in_buf = (int[]) i_input.getBufferReader().getBuffer();\r
+               assert(i_input.getBufferType()==INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
+               assert(i_output.getBufferType()==INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
+               int[] out_buf = (int[]) i_output.getBuffer();\r
+               int[] in_buf = (int[]) i_input.getBuffer();\r
                NyARIntSize s=i_input.getSize();\r
                \r
                final int th=this._threshold;\r
@@ -35,7 +35,7 @@ import jp.nyatla.nyartoolkit.NyARException;
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
 \r
-public interface INyARRasterFilter_RgbToBin\r
+public interface INyARRasterFilter_Rgb2Bin\r
 {\r
        public void doFilter(INyARRgbRaster i_input, NyARBinRaster i_output) throws NyARException;\r
 }\r
index e60c29b..47863cc 100644 (file)
@@ -3,7 +3,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 \r
@@ -12,14 +11,14 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
  * 定数閾値による2値化をする。\r
  * \r
  */\r
-public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_RgbToBin\r
+public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rgb2Bin\r
 {\r
        protected int _threshold;\r
        private IdoThFilterImpl _do_threshold_impl;\r
 \r
        public NyARRasterFilter_ARToolkitThreshold(int i_threshold,int i_in_raster_type) throws NyARException\r
        {\r
-               if(!initInstance(i_threshold,i_in_raster_type,INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8)){\r
+               if(!initInstance(i_threshold,i_in_raster_type,INyARRaster.BUFFERFORMAT_INT1D_BIN_8)){\r
                        throw new NyARException();\r
                }\r
        }\r
@@ -32,22 +31,22 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
        protected boolean initInstance(int i_threshold,int i_in_raster_type,int i_out_raster_type)\r
        {\r
                switch(i_out_raster_type){\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_BIN_8:\r
                        switch (i_in_raster_type){\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                                this._do_threshold_impl=new doThFilterImpl_BUFFERFORMAT_BYTE1D_RGB_24();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
                                this._do_threshold_impl=new doThFilterImpl_BUFFERFORMAT_BYTE1D_B8G8R8X8_32();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_X8R8G8B8_32:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_X8R8G8B8_32:\r
                                this._do_threshold_impl=new doThFilterImpl_BUFFERFORMAT_BYTE1D_X8R8G8B8_32();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
+                       case INyARRaster.BUFFERFORMAT_INT1D_X8R8G8B8_32:\r
                                this._do_threshold_impl=new doThFilterImpl_BUFFERFORMAT_INT1D_X8R8G8B8_32();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_WORD1D_R5G6B5_16LE:\r
+                       case INyARRaster.BUFFERFORMAT_WORD1D_R5G6B5_16LE:\r
                                this._do_threshold_impl=new doThFilterImpl_BUFFERFORMAT_WORD1D_R5G6B5_16LE();\r
                                break;\r
                        default:\r
@@ -72,11 +71,9 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
 \r
        public void doFilter(INyARRgbRaster i_input, NyARBinRaster i_output) throws NyARException\r
        {\r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader();\r
 \r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._do_threshold_impl.doThFilter(in_buffer_reader,out_buffer_reader,i_output.getSize(), this._threshold);\r
+               this._do_threshold_impl.doThFilter(i_input,i_output,i_output.getSize(), this._threshold);\r
                return;\r
        }\r
        /*\r
@@ -84,13 +81,13 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
         */\r
        interface IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold);\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold);\r
        }\r
        class doThFilterImpl_BUFFERFORMAT_BYTE1D_RGB_24 implements IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold)\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)\r
                {\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
@@ -147,10 +144,10 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
        }\r
        class doThFilterImpl_BUFFERFORMAT_BYTE1D_B8G8R8X8_32 implements IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold)\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)\r
                {\r
-                       assert (i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32));\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+                       assert (i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
@@ -206,9 +203,9 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
        \r
        class doThFilterImpl_BUFFERFORMAT_BYTE1D_X8R8G8B8_32 implements IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold)\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)\r
                {\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
@@ -266,9 +263,9 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
        \r
        class doThFilterImpl_BUFFERFORMAT_INT1D_X8R8G8B8_32 implements IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold)\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)\r
                {\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        int[] in_buf = (int[]) i_input.getBuffer();\r
@@ -315,9 +312,9 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
        \r
        class doThFilterImpl_BUFFERFORMAT_WORD1D_R5G6B5_16LE implements IdoThFilterImpl\r
        {\r
-               public void doThFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size,int i_threshold)\r
+               public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)\r
                {\r
-                       assert (i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+                       assert (i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        short[] in_buf = (short[]) i_input.getBuffer();\r
@@ -38,7 +38,7 @@ import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;
  * このインタフェイスは、RGBラスタをグレースケールラスタに変換します。\r
  *\r
  */\r
-public interface INyARRasterFilter_RgbToGs\r
+public interface INyARRasterFilter_Rgb2Gs\r
 {\r
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException;\r
 }\r
index 4d2df26..661774a 100644 (file)
@@ -33,7 +33,6 @@ package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
@@ -41,7 +40,7 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
  * このフィルタは、RGB値の平均値を、(R+G+B)/3で算出します。\r
  *\r
  */\r
-public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs\r
+public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_Rgb2Gs\r
 {\r
        IdoThFilterImpl _do_filter_impl;\r
        public NyARRasterFilter_Rgb2Gs_AveAdd(int i_in_raster_type,int i_out_raster_type) throws NyARException\r
@@ -53,7 +52,7 @@ public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs
        }\r
        public NyARRasterFilter_Rgb2Gs_AveAdd(int i_in_raster_type) throws NyARException\r
        {\r
-               if(!initInstance(i_in_raster_type,INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8))\r
+               if(!initInstance(i_in_raster_type,INyARRaster.BUFFERFORMAT_INT1D_GRAY_8))\r
                {\r
                        throw new NyARException();\r
                }\r
@@ -61,13 +60,13 @@ public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs
        protected boolean initInstance(int i_in_raster_type,int i_out_raster_type)\r
        {\r
                switch(i_out_raster_type){\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        switch (i_in_raster_type){\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                                this._do_filter_impl=new doThFilterImpl_BYTE1D_B8G8R8_24();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8X8_32:\r
                                this._do_filter_impl=new doThFilterImpl_BYTE1D_B8G8R8X8_32();\r
                                break;\r
                        default:\r
@@ -82,10 +81,8 @@ public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs
        \r
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
-               INyARBufferReader in_buffer_reader=i_input.getBufferReader();   \r
-               INyARBufferReader out_buffer_reader=i_output.getBufferReader(); \r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._do_filter_impl.doFilter(in_buffer_reader,out_buffer_reader,i_input.getSize());\r
+               this._do_filter_impl.doFilter(i_input,i_output,i_input.getSize());\r
                return;\r
        }\r
        \r
@@ -95,13 +92,13 @@ public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs
         */\r
        interface IdoThFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size);\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size);\r
        }\r
        class doThFilterImpl_BYTE1D_B8G8R8_24 implements IdoThFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size)\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)\r
                {\r
-                       assert(i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
                        \r
@@ -117,9 +114,9 @@ public class NyARRasterFilter_Rgb2Gs_AveAdd implements INyARRasterFilter_RgbToGs
        }\r
        class doThFilterImpl_BYTE1D_B8G8R8X8_32 implements IdoThFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size)\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)\r
                {\r
-                       assert(i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
 \r
index 7c88855..b05b012 100644 (file)
@@ -33,8 +33,7 @@ package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs;
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_Rgb2Gs;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 \r
@@ -45,12 +44,12 @@ import jp.nyatla.nyartoolkit.core.types.NyARIntSize;
  * この値は、RGB成分の作る立方体の体積を0-255スケールにした値です。\r
  *\r
  */\r
-public class NyARRasterFilter_Rgb2Gs_RgbCube implements INyARRasterFilter_RgbToGs\r
+public class NyARRasterFilter_Rgb2Gs_RgbCube implements INyARRasterFilter_Rgb2Gs\r
 {\r
        private IdoFilterImpl _dofilterimpl;\r
        public NyARRasterFilter_Rgb2Gs_RgbCube(int i_in_raster_type) throws NyARException\r
        {\r
-               if(!initInstance(i_in_raster_type,INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8))\r
+               if(!initInstance(i_in_raster_type,INyARRaster.BUFFERFORMAT_INT1D_GRAY_8))\r
                {\r
                        throw new NyARException();\r
                }\r
@@ -65,10 +64,10 @@ public class NyARRasterFilter_Rgb2Gs_RgbCube implements INyARRasterFilter_RgbToG
        protected boolean initInstance(int i_in_raster_type,int i_out_raster_type)\r
        {\r
                switch(i_out_raster_type){\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        switch (i_in_raster_type) {\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                                this._dofilterimpl=new IdoFilterImpl_BYTE1D_B8G8R8_24();\r
                                break;\r
                        default:\r
@@ -85,23 +84,23 @@ public class NyARRasterFilter_Rgb2Gs_RgbCube implements INyARRasterFilter_RgbToG
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._dofilterimpl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_BYTE1D_B8G8R8_24 implements IdoFilterImpl\r
        {\r
                /**\r
                 * This function is not optimized.\r
                 */\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert(         i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24)\r
-                                       ||      i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24));\r
-                       assert(i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert(         i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24)\r
+                                       ||      i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24));\r
+                       assert(i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
index 1077340..b8bb1ae 100644 (file)
 package jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
-import jp.nyatla.nyartoolkit.core.raster.NyARGrayscaleRaster;\r
+import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_RgbToGs;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2gs.INyARRasterFilter_Rgb2Gs;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
 \r
 /**\r
  * YCbCr変換して、Y成分のグレースケールの値を計算します。\r
  * 変換式は、http://www.tyre.gotdns.org/を参考にしました。\r
  */\r
-public class NyARRasterFilter_Rgb2Gs_YCbCr implements INyARRasterFilter_RgbToGs\r
+public class NyARRasterFilter_Rgb2Gs_YCbCr implements INyARRasterFilter_Rgb2Gs\r
 {\r
        private IdoFilterImpl _dofilterimpl;\r
        public NyARRasterFilter_Rgb2Gs_YCbCr(int i_in_raster_type) throws NyARException\r
        {\r
-               if(!initInstance(i_in_raster_type,INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8))\r
+               if(!initInstance(i_in_raster_type,INyARRaster.BUFFERFORMAT_INT1D_GRAY_8))\r
                {\r
                        throw new NyARException();\r
                }\r
@@ -55,12 +54,12 @@ public class NyARRasterFilter_Rgb2Gs_YCbCr implements INyARRasterFilter_RgbToGs
        protected boolean initInstance(int i_in_raster_type,int i_out_raster_type)\r
        {\r
                switch(i_out_raster_type){\r
-               case INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8:\r
+               case INyARRaster.BUFFERFORMAT_INT1D_GRAY_8:\r
                        switch (i_in_raster_type) {\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24:\r
                                this._dofilterimpl=new IdoFilterImpl_BYTE1D_B8G8R8_24();\r
                                break;\r
-                       case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
+                       case INyARRaster.BUFFERFORMAT_BYTE1D_R8G8B8_24:\r
                        default:\r
                                return false;\r
                        }\r
@@ -74,22 +73,22 @@ public class NyARRasterFilter_Rgb2Gs_YCbCr implements INyARRasterFilter_RgbToGs
        public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARException\r
        {\r
                assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);\r
-               this._dofilterimpl.doFilter(i_input.getBufferReader(),i_output.getBufferReader(),i_input.getSize());\r
+               this._dofilterimpl.doFilter(i_input,i_output,i_input.getSize());\r
        }\r
        \r
        interface IdoFilterImpl\r
        {\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException;\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException;\r
        }\r
        class IdoFilterImpl_BYTE1D_B8G8R8_24 implements IdoFilterImpl\r
        {\r
                /**\r
                 * This function is not optimized.\r
                 */\r
-               public void doFilter(INyARBufferReader i_input, INyARBufferReader i_output,NyARIntSize i_size) throws NyARException\r
+               public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size) throws NyARException\r
                {\r
-                       assert( i_input.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24));\r
-                       assert(i_output.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+                       assert( i_input.isEqualBufferType(INyARRaster.BUFFERFORMAT_BYTE1D_B8G8R8_24));\r
+                       assert(i_output.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                        \r
                        int[] out_buf = (int[]) i_output.getBuffer();\r
                        byte[] in_buf = (byte[]) i_input.getBuffer();\r
diff --git a/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/INyARBufferReader.java b/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/INyARBufferReader.java
deleted file mode 100644 (file)
index ebf3e7f..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\r
- * This work is based on the original ARToolKit developed by\r
- *   Hirokazu Kato\r
- *   Mark Billinghurst\r
- *   HITLab, University of Washington, Seattle\r
- * http://www.hitl.washington.edu/artoolkit/\r
- *\r
- * The NyARToolkit is Java edition ARToolKit class library.\r
- * Copyright (C)2008-2009 Ryo Iizuka\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- * \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- * \r
- * For further information please contact.\r
- *     http://nyatla.jp/nyatoolkit/\r
- *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.nyartoolkit.core.rasterreader;\r
-/**\r
- * このインタフェイスは、画素データを格納するバッファオブジェクト\r
- * へのアクセス方法と、その形式を定義します。\r
- *\r
- */\r
-public interface INyARBufferReader\r
-{\r
-       public static final int BYTE1D =0x00010000;\r
-       public static final int INT2D  =0x00020000;\r
-       public static final int SHORT1D=0x00030000;\r
-       public static final int INT1D  =0x00040000;\r
-       public static final int OBJECT =0x00100000;    //  ID規約\r
-       //  24-31(8)予約\r
-       //  16-27(8)型ID\r
-       //      00:無効/01:byte[]/02:int[][]/03:short[]\r
-       //  08-15(8)ビットフォーマットID\r
-       //      00:24bit/01:32bit/02:16bit\r
-       //  00-07(8)型番号\r
-       //\r
-       /**\r
-        * RGB24フォーマットで、全ての画素が0\r
-        */\r
-       public static final int BUFFERFORMAT_NULL_ALLZERO = 0x00000001;\r
-\r
-       /**\r
-        * byte[]で、R8G8B8の24ビットで画素が格納されている。\r
-        */\r
-       public static final int BUFFERFORMAT_BYTE1D_R8G8B8_24   = BYTE1D|0x0001;\r
-       /**\r
-        * byte[]で、B8G8R8の24ビットで画素が格納されている。\r
-        */\r
-       public static final int BUFFERFORMAT_BYTE1D_B8G8R8_24   = BYTE1D|0x0002;\r
-       /**\r
-        * byte[]で、R8G8B8X8の32ビットで画素が格納されている。\r
-        */\r
-       public static final int BUFFERFORMAT_BYTE1D_B8G8R8X8_32 = BYTE1D|0x0101;\r
-       /**\r
-        * byte[]で、X8R8G8B8の32ビットで画素が格納されている。\r
-        */\r
-       public static final int BUFFERFORMAT_BYTE1D_X8R8G8B8_32 = BYTE1D|0x0102;\r
-\r
-       /**\r
-        * byte[]で、RGB565の16ビット(little/big endian)で画素が格納されている。\r
-        */\r
-       public static final int BUFFERFORMAT_BYTE1D_R5G6B5_16LE = BYTE1D|0x0201;\r
-    public static final int BUFFERFORMAT_BYTE1D_R5G6B5_16BE = BYTE1D|0x0202;\r
-       /**\r
-        * short[]で、RGB565の16ビット(little/big endian)で画素が格納されている。\r
-        */     \r
-    public static final int BUFFERFORMAT_WORD1D_R5G6B5_16LE = SHORT1D|0x0201;\r
-    public static final int BUFFERFORMAT_WORD1D_R5G6B5_16BE = SHORT1D|0x0202;\r
-\r
-       \r
-       /**\r
-        * int[][]で特に値範囲を定めない\r
-        */\r
-       public static final int BUFFERFORMAT_INT2D        = INT2D|0x0000;\r
-       /**\r
-        * int[][]で0-255のグレイスケール画像\r
-        */\r
-       public static final int BUFFERFORMAT_INT2D_GRAY_8 = INT2D|0x0001;\r
-       /**\r
-        * int[][]で0/1の2値画像\r
-        * これは、階調値1bitのBUFFERFORMAT_INT2D_GRAY_1と同じです。\r
-        */\r
-       public static final int BUFFERFORMAT_INT2D_BIN_8  = INT2D|0x0002;\r
-\r
-       /**\r
-        * int[]で特に値範囲を定めない\r
-        */\r
-       public static final int BUFFERFORMAT_INT1D        = INT1D|0x0000;\r
-       /**\r
-        * int[]で0-255のグレイスケール画像\r
-        */\r
-       public static final int BUFFERFORMAT_INT1D_GRAY_8 = INT1D|0x0001;\r
-       /**\r
-        * int[]で0/1の2値画像\r
-        * これは、階調1bitのBUFFERFORMAT_INT1D_GRAY_1と同じです。\r
-        */\r
-       public static final int BUFFERFORMAT_INT1D_BIN_8  = INT1D|0x0002;\r
-       \r
-       \r
-       /**\r
-        * int[]で、XRGB32の32ビットで画素が格納されている。\r
-        */     \r
-    public static final int BUFFERFORMAT_INT1D_X8R8G8B8_32=INT1D|0x0102;\r
-\r
-       /**\r
-        * H:9bit(0-359),S:8bit(0-255),V(0-255)\r
-        */\r
-       public static final int BUFFERFORMAT_INT1D_X7H9S8V8_32=INT1D|0x0103;\r
-    \r
-       public static final int BUFFERFORMAT_OBJECT_Java= OBJECT|0x0100;\r
-       public static final int BUFFERFORMAT_OBJECT_CS= OBJECT|0x0200;\r
-       public static final int BUFFERFORMAT_OBJECT_AS3= OBJECT|0x0300;\r
-\r
-       \r
-       /**\r
-        * JavaのBufferedImageを格納するラスタ\r
-        */\r
-       public static final int BUFFERFORMAT_OBJECT_Java_BufferedImage= BUFFERFORMAT_OBJECT_Java|0x01;\r
-\r
-       /**\r
-        * ActionScript3のBitmapDataを格納するラスタ\r
-        */\r
-\r
-       public static final int BUFFERFORMAT_OBJECT_AS3_BitmapData= BUFFERFORMAT_OBJECT_AS3|0x01;\r
-\r
-       \r
-       \r
-       /**\r
-        * バッファオブジェクトを返します。\r
-        * @return\r
-        */\r
-       public Object getBuffer();\r
-       /**\r
-        * バッファオブジェクトの形式を返します。\r
-        * @return\r
-        */\r
-       public int getBufferType();\r
-       /**\r
-        * バッファオブジェクトの形式が、i_type_valueにが一致するか返します。\r
-        * @param i_type_value\r
-        * @return\r
-        */\r
-       public boolean isEqualBufferType(int i_type_value);\r
-}\r
index 42c1098..0b8deef 100644 (file)
@@ -75,5 +75,11 @@ public interface INyARRgbPixelReader
         * @throws NyARException\r
         */\r
        public void setPixels(int[] i_x, int[] i_y, int i_num, int[] i_intrgb) throws NyARException;\r
-       \r
+       /**\r
+        * 参照しているバッファをi_ref_bufferへ切り替えます。\r
+        * 内部パラメータのチェックは、実装依存です。\r
+        * @param i_ref_buffer\r
+        * @throws NyARException\r
+        */\r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException;\r
 }\r
diff --git a/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARBufferReader.java b/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARBufferReader.java
deleted file mode 100644 (file)
index 5cfa583..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* \r
- * PROJECT: NyARToolkit\r
- * --------------------------------------------------------------------------------\r
- * This work is based on the original ARToolKit developed by\r
- *   Hirokazu Kato\r
- *   Mark Billinghurst\r
- *   HITLab, University of Washington, Seattle\r
- * http://www.hitl.washington.edu/artoolkit/\r
- *\r
- * The NyARToolkit is Java edition ARToolKit class library.\r
- * Copyright (C)2008-2009 Ryo Iizuka\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- * \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- * \r
- * For further information please contact.\r
- *     http://nyatla.jp/nyatoolkit/\r
- *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.nyartoolkit.core.rasterreader;\r
-\r
-public final class NyARBufferReader implements INyARBufferReader\r
-{\r
-       private Object _buffer;\r
-       private int _buffer_type;\r
-       public NyARBufferReader(Object i_buffer,int i_buffer_type)\r
-       {\r
-               this._buffer=i_buffer;\r
-               this._buffer_type=i_buffer_type;\r
-               return;\r
-       }\r
-       public Object getBuffer()\r
-       {\r
-               return this._buffer;\r
-       }\r
-       public int getBufferType()\r
-       {\r
-               return _buffer_type;\r
-       }\r
-       public boolean isEqualBufferType(int i_type_value)\r
-       {\r
-               return this._buffer_type==i_type_value;\r
-       }\r
-}\r
diff --git a/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_BYTE1D_B8G8R8X8_32.java b/trunk/src/jp/nyatla/nyartoolkit/core/rasterreader/NyARRgbPixelReader_BYTE1D_B8G8R8X8_32.java
new file mode 100644 (file)
index 0000000..c2f1e7a
--- /dev/null
@@ -0,0 +1,57 @@
+package jp.nyatla.nyartoolkit.core.rasterreader;\r
+\r
+import jp.nyatla.nyartoolkit.NyARException;\r
+import jp.nyatla.nyartoolkit.core.types.NyARIntSize;\r
+\r
+public class NyARRgbPixelReader_BYTE1D_B8G8R8X8_32 implements INyARRgbPixelReader\r
+{\r
+       protected byte[] _ref_buf;\r
+       private NyARIntSize _ref_size;\r
+\r
+       public NyARRgbPixelReader_BYTE1D_B8G8R8X8_32(byte[] i_ref_buf, NyARIntSize i_size)\r
+       {\r
+               this._ref_buf=i_ref_buf;\r
+               this._ref_size = i_size;\r
+       }\r
+\r
+       public void getPixel(int i_x, int i_y, int[] o_rgb)\r
+       {\r
+               final byte[] ref_buf =this._ref_buf;\r
+               final int bp = (i_x + i_y * this._ref_size.w) * 4;\r
+               o_rgb[0] = (ref_buf[bp + 2] & 0xff);// R\r
+               o_rgb[1] = (ref_buf[bp + 1] & 0xff);// G\r
+               o_rgb[2] = (ref_buf[bp + 0] & 0xff);// B\r
+               return;\r
+       }\r
+\r
+       public void getPixelSet(int[] i_x, int[] i_y, int i_num, int[] o_rgb)\r
+       {\r
+               int bp;\r
+               final int width = this._ref_size.w;\r
+               final byte[] ref_buf =this._ref_buf;\r
+               for (int i = i_num - 1; i >= 0; i--) {\r
+                       bp = (i_x[i] + i_y[i] * width) * 4;\r
+                       o_rgb[i * 3 + 0] = (ref_buf[bp + 2] & 0xff);// R\r
+                       o_rgb[i * 3 + 1] = (ref_buf[bp + 1] & 0xff);// G\r
+                       o_rgb[i * 3 + 2] = (ref_buf[bp + 0] & 0xff);// B\r
+               }\r
+               return;\r
+       }\r
+       public void setPixel(int i_x, int i_y, int[] i_rgb) throws NyARException\r
+       {\r
+               final byte[] ref_buf =this._ref_buf;\r
+               final int bp = (i_x + i_y * this._ref_size.w) * 4;\r
+               ref_buf[bp+0] = (byte)i_rgb[0];// R\r
+               ref_buf[bp+1] = (byte)i_rgb[1];// G\r
+               ref_buf[bp+2] = (byte)i_rgb[2];// B     \r
+       }\r
+       public void setPixels(int[] i_x, int[] i_y, int i_num, int[] i_intrgb) throws NyARException\r
+       {\r
+               NyARException.notImplement();           \r
+       }\r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+       {\r
+               assert(((byte[])i_ref_buffer).length>=this._ref_size.w*this._ref_size.h*4);\r
+               this._ref_buf=(byte[])i_ref_buffer;\r
+       }               \r
+}
\ No newline at end of file
@@ -37,13 +37,13 @@ import jp.nyatla.nyartoolkit.core.types.*;
  * バッファに使用できるピクセルリーダー\r
  *\r
  */\r
-public class NyARRgbPixelReader_RGB24 implements INyARRgbPixelReader\r
+public class NyARRgbPixelReader_BYTE1D_R8G8B8_24 implements INyARRgbPixelReader\r
 {\r
        protected byte[] _ref_buf;\r
 \r
        private NyARIntSize _size;\r
 \r
-       public NyARRgbPixelReader_RGB24(byte[] i_buf, NyARIntSize i_size)\r
+       public NyARRgbPixelReader_BYTE1D_R8G8B8_24(byte[] i_buf, NyARIntSize i_size)\r
        {\r
                this._ref_buf = i_buf;\r
                this._size = i_size;\r
@@ -80,5 +80,9 @@ public class NyARRgbPixelReader_RGB24 implements INyARRgbPixelReader
        {\r
                NyARException.notImplement();           \r
        }\r
-       \r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+       {\r
+               assert(((byte[])i_ref_buffer).length>=this._size.w*this._size.h*3);\r
+               this._ref_buf=(byte[])i_ref_buffer;\r
+       }       \r
 }
\ No newline at end of file
index ddd297a..2c2cf11 100644 (file)
@@ -80,5 +80,9 @@ public class NyARRgbPixelReader_BYTE1D_X8R8G8B8_32 implements INyARRgbPixelReade
        {\r
                NyARException.notImplement();           \r
        }\r
-       \r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+       {\r
+               assert(((byte[])i_ref_buffer).length>=this._size.w*this._size.h*4);\r
+               this._ref_buf=(byte[])i_ref_buffer;\r
+       }\r
 }
\ No newline at end of file
index 7cfb165..083fc53 100644 (file)
@@ -68,5 +68,9 @@ public class NyARRgbPixelReader_INT1D_GRAY_8 implements INyARRgbPixelReader
        {\r
                NyARException.notImplement();           \r
        }\r
-       \r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+       {\r
+               assert(((int[])i_ref_buffer).length>=this._size.w*this._size.h);\r
+               this._ref_buf=(int[])i_ref_buffer;\r
+       }       \r
 }\r
index a96b9ec..d6e5d75 100644 (file)
@@ -74,5 +74,9 @@ public class NyARRgbPixelReader_INT1D_X8R8G8B8_32 implements INyARRgbPixelReader
        {\r
                NyARException.notImplement();           \r
        }\r
-       \r
+       public void switchBuffer(Object i_ref_buffer) throws NyARException\r
+       {\r
+               assert(((int[])i_ref_buffer).length>=this._size.w*this._size.h);\r
+               this._ref_buf=(int[])i_ref_buffer;\r
+       }       \r
 }\r
index 41ea65a..6b45a14 100644 (file)
@@ -34,8 +34,8 @@ public        class NyARVectorReader_INT1D_GRAY_8
        private NyARIntSize _ref_size;\r
        public NyARVectorReader_INT1D_GRAY_8(INyARRaster i_ref_raster)\r
        {\r
-               assert(i_ref_raster.getBufferReader().getBufferType()==INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8);\r
-               this._ref_buf=(int[])(i_ref_raster.getBufferReader().getBuffer());\r
+               assert(i_ref_raster.getBufferType()==INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
+               this._ref_buf=(int[])(i_ref_raster.getBuffer());\r
                this._ref_size=i_ref_raster.getSize();\r
        }\r
        /**\r
index 1f56368..42fb463 100644 (file)
@@ -32,7 +32,6 @@ package jp.nyatla.nyartoolkit.core.squaredetect;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.INyARBufferReader;\r
 import jp.nyatla.nyartoolkit.core.labeling.artoolkit.*;\r
 \r
 /**\r
@@ -47,7 +46,7 @@ public class ContourPickup
        protected final static int[] _getContour_ydir = {-1,-1, 0, 1, 1, 1, 0,-1 ,-1,-1, 0, 1, 1, 1, 0};\r
        public int getContour(NyARBinRaster i_raster,int i_entry_x,int i_entry_y,int i_array_size,int[] o_coord_x,int[] o_coord_y) throws NyARException\r
        {\r
-               assert(i_raster.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8));\r
+               assert(i_raster.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8));\r
                return impl_getContour(i_raster,0,i_entry_x,i_entry_y,i_array_size,o_coord_x,o_coord_y);\r
        }\r
        /**\r
@@ -66,7 +65,7 @@ public class ContourPickup
         */\r
        public int getContour(NyARGrayscaleRaster i_raster,int i_th,int i_entry_x,int i_entry_y,int i_array_size,int[] o_coord_x,int[] o_coord_y) throws NyARException\r
        {\r
-               assert(i_raster.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8));\r
+               assert(i_raster.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8));\r
                return impl_getContour(i_raster,i_th,i_entry_x,i_entry_y,i_array_size,o_coord_x,o_coord_y);\r
        }\r
 \r
@@ -89,7 +88,7 @@ public class ContourPickup
                final int[] xdir = _getContour_xdir;// static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};\r
                final int[] ydir = _getContour_ydir;// static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1};\r
 \r
-               final int[] i_buf=(int[])i_raster.getBufferReader().getBuffer();\r
+               final int[] i_buf=(int[])i_raster.getBuffer();\r
                final int width=i_raster.getWidth();\r
                final int height=i_raster.getHeight();\r
                //クリップ領域の上端に接しているポイントを得る。\r
@@ -196,7 +195,7 @@ public class ContourPickup
                final int[] xdir = _getContour_xdir;// static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};\r
                final int[] ydir = _getContour_ydir;// static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1};\r
 \r
-               final int[] i_buf=(int[])i_raster.getBufferReader().getBuffer();\r
+               final int[] i_buf=(int[])i_raster.getBuffer();\r
                final int width=i_raster.getWidth();\r
                final int height=i_raster.getHeight();\r
                //クリップ領域の上端に接しているポイントを得る。\r
index 232104b..6e8c111 100644 (file)
@@ -256,16 +256,6 @@ public class NyAREquationSolver
                }\r
        }\r
        /**\r
-        * 3乗根を求められないシステムで、3乗根を求めます。\r
-        * http://aoki2.si.gunma-u.ac.jp/JavaScript/src/3jisiki.html\r
-        * @param i_in\r
-        * @return\r
-        */\r
-       private static double cuberoot(double i_in) {\r
-               double res = Math.pow(Math.abs(i_in), 1.0 / 3.0);\r
-               return (i_in >= 0) ? res : -res;\r
-       }\r
-       /**\r
         * 3次方程式の実根を1個だけ求める。\r
         * 4字方程式で使う。\r
         * @param i_b\r
@@ -296,7 +286,7 @@ public class NyAREquationSolver
                        return tmp * Math.cos(t / 3) - b;\r
                }\r
        }               \r
-\r
+/*\r
        public static void main(String[] args)\r
        {\r
                NyAREquationSolver n = new NyAREquationSolver();\r
@@ -308,5 +298,5 @@ public class NyAREquationSolver
                        e.printStackTrace();\r
                }\r
                System.out.println(l);\r
-       }\r
+       }*/\r
 }\r
index 4a260dd..01b2036 100644 (file)
@@ -37,6 +37,16 @@ public class NyARMath
                z=i_p2.z-i_p1.z;\r
                return x*x+y*y+z*z;\r
        }\r
-\r
+       /**\r
+        * 3乗根を求められないシステムで、3乗根を求めます。\r
+        * http://aoki2.si.gunma-u.ac.jp/JavaScript/src/3jisiki.html\r
+        * @param i_in\r
+        * @return\r
+        */\r
+       public static double cubeRoot(double i_in)\r
+       {\r
+               double res = Math.pow(Math.abs(i_in), 1.0 / 3.0);\r
+               return (i_in >= 0) ? res : -res;\r
+       }\r
 \r
 }\r
index 1037f93..0a5d5fb 100644 (file)
@@ -139,7 +139,7 @@ public class NyARCustomSingleDetectMarker
        protected INyARTransMat _transmat;\r
        //画処理用\r
        private NyARBinRaster _bin_raster;\r
-       protected INyARRasterFilter_RgbToBin _tobin_filter;\r
+       protected INyARRasterFilter_Rgb2Bin _tobin_filter;\r
        private DetectSquareCB _detect_cb;\r
        private NyARRectOffset _offset; \r
 \r
@@ -152,7 +152,7 @@ public class NyARCustomSingleDetectMarker
                INyARColorPatt i_patt_inst,\r
                INyARSquareContourDetector i_sqdetect_inst,\r
                INyARTransMat i_transmat_inst,\r
-               INyARRasterFilter_RgbToBin i_filter,\r
+               INyARRasterFilter_Rgb2Bin i_filter,\r
                NyARParam       i_ref_param,\r
                NyARCode        i_ref_code,\r
                double          i_marker_width) throws NyARException\r
index 4aeab43..43d2e7b 100644 (file)
@@ -247,7 +247,7 @@ public class NyARDetectMarker
        \r
        private NyARBinRaster _bin_raster;\r
 \r
-       private INyARRasterFilter_RgbToBin _tobin_filter;\r
+       private INyARRasterFilter_Rgb2Bin _tobin_filter;\r
 \r
        /**\r
         * i_imageにマーカー検出処理を実行し、結果を記録します。\r
index 7d3a55a..400f3f6 100644 (file)
@@ -126,9 +126,10 @@ public class NyIdTest
                byte[] buf = new byte[(int) f.length()];\r
                fs.read(buf);           \r
 \r
-        NyARRgbRaster_RGB ra = NyARRgbRaster_RGB.wrap(buf, 320, 240);\r
+        NyARRgbRaster_RGB ra = new NyARRgbRaster_RGB(320, 240,false);\r
+        ra.wrapBuffer(buf);\r
 \r
-        MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferReader().getBufferType());\r
+        MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferType());\r
         pr.detectMarker(ra);\r
         return;\r
     }\r
index dd231b0..866ccb6 100644 (file)
@@ -74,12 +74,13 @@ public class RawFileTest
                FileInputStream fs = new FileInputStream(data_file);\r
                byte[] buf = new byte[(int) f.length()];\r
                fs.read(buf);\r
-               INyARRgbRaster ra = NyARRgbRaster_BGRA.wrap(buf, 320, 240);\r
+               INyARRgbRaster ra = new NyARRgbRaster_BGRA(320, 240,false);\r
+               ra.wrapBuffer(buf);\r
                // Blank_Raster ra=new Blank_Raster(320, 240);\r
 \r
                // 1パターンのみを追跡するクラスを作成\r
                NyARSingleDetectMarker ar = new NyARSingleDetectMarker(\r
-                               ap, code, 80.0,ra.getBufferReader().getBufferType(),NyARSingleDetectMarker.PF_NYARTOOLKIT);\r
+                               ap, code, 80.0,ra.getBufferType(),NyARSingleDetectMarker.PF_NYARTOOLKIT);\r
                NyARTransMatResult result_mat = new NyARTransMatResult();\r
                ar.setContinueMode(false);\r
                ar.detectMarkerLite(ra, 100);\r
index fdfa0f1..edaed5f 100644 (file)
@@ -98,9 +98,10 @@ public class SingleARMarkerTest
                byte[] buf = new byte[(int) f.length()];\r
                fs.read(buf);           \r
 \r
-        NyARRgbRaster_BGRA ra = NyARRgbRaster_BGRA.wrap(buf, 320, 240);\r
+        NyARRgbRaster_BGRA ra = new NyARRgbRaster_BGRA(320, 240,false);\r
+        ra.wrapBuffer(buf);\r
 \r
-        MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferReader().getBufferType());\r
+        MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferType());\r
         NyARCode[] codes=new NyARCode[1];\r
         codes[0]=new NyARCode(16,16);\r
         codes[0].loadARPattFromFile(CARCODE_FILE);\r
index 0642dba..d533e84 100644 (file)
@@ -38,10 +38,8 @@ import java.awt.*;
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.types.*;\r
-import jp.nyatla.nyartoolkit.core.rasterreader.*;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
 import jp.nyatla.nyartoolkit.core.types.stack.*;\r
-import jp.nyatla.nyartoolkit.core.labeling.*;\r
 import jp.nyatla.nyartoolkit.core.labeling.artoolkit.NyARLabelingImage;\r
 import jp.nyatla.nyartoolkit.core.labeling.artoolkit.NyARLabelingLabel;\r
 \r
@@ -123,7 +121,7 @@ public class LabelingBufferdImage extends BufferedImage
 \r
        public void drawImage(NyARGrayscaleRaster i_raster) throws NyARException\r
        {\r
-               assert (i_raster.getBufferReader().getBufferType() == INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8);\r
+               assert (i_raster.getBufferType() == INyARRaster.BUFFERFORMAT_INT1D_GRAY_8);\r
 \r
                int w = this.getWidth();\r
                int h = this.getHeight();\r
@@ -135,7 +133,7 @@ public class LabelingBufferdImage extends BufferedImage
 \r
                int[] limg;\r
                // イメージの描画\r
-               limg = (int[]) i_raster.getBufferReader().getBuffer();\r
+               limg = (int[]) i_raster.getBuffer();\r
                for (int i = 0; i < h; i++) {\r
                        for (int i2 = 0; i2 < w; i2++) {\r
                                this.setRGB(i2, i,limg[i*w+i2]);\r
@@ -150,7 +148,7 @@ public class LabelingBufferdImage extends BufferedImage
         */\r
        public void drawImage(NyARBinRaster i_raster) throws NyARException\r
        {\r
-               assert (i_raster.getBufferReader().getBufferType() == INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8);\r
+               assert (i_raster.getBufferType() == INyARRaster.BUFFERFORMAT_INT1D_BIN_8);\r
 \r
                int w = this.getWidth();\r
                int h = this.getHeight();\r
@@ -162,7 +160,7 @@ public class LabelingBufferdImage extends BufferedImage
 \r
                int[] limg;\r
                // イメージの描画\r
-               limg = (int[]) i_raster.getBufferReader().getBuffer();\r
+               limg = (int[]) i_raster.getBuffer();\r
                for (int i = 0; i < h; i++) {\r
                        for (int i2 = 0; i2 < w; i2++) {\r
                                this.setRGB(i2, i, limg[i*w+i2] > 0 ? 255 : 0);\r
@@ -189,7 +187,7 @@ public class LabelingBufferdImage extends BufferedImage
 \r
                int[] limg;\r
                // イメージの描画\r
-               limg = (int[]) i_image.getBufferReader().getBuffer();\r
+               limg = (int[]) i_image.getBuffer();\r
                for (int i = 0; i < h; i++) {\r
                        for (int i2 = 0; i2 < w; i2++) {\r
                                int t=limg[i*w+i2]-1;\r
index 739893e..7279a77 100644 (file)
@@ -73,9 +73,9 @@ public class NyARRasterImageIO
        public static void copy(NyARGrayscaleRaster i_in,BufferedImage o_out) throws NyARException\r
        {\r
                assert i_in.getSize().isEqualSize(o_out.getWidth(), o_out.getHeight());\r
-               if(i_in.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GRAY_8))\r
+               if(i_in.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_GRAY_8))\r
                {\r
-                       final int[] buf=(int[])i_in.getBufferReader().getBuffer();\r
+                       final int[] buf=(int[])i_in.getBuffer();\r
                        final int w=o_out.getWidth();\r
                        final int h=o_out.getHeight();\r
                        for(int y=h-1;y>=0;y--){\r
@@ -95,9 +95,9 @@ public class NyARRasterImageIO
        public static void copy(INyARRaster i_in,BufferedImage o_out) throws NyARException\r
        {\r
                assert i_in.getSize().isEqualSize(o_out.getWidth(), o_out.getHeight());\r
-               if(i_in.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8))\r
+               if(i_in.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8))\r
                {\r
-                       final int[] buf=(int[])i_in.getBufferReader().getBuffer();\r
+                       final int[] buf=(int[])i_in.getBuffer();\r
                        final int w=o_out.getWidth();\r
                        final int h=o_out.getHeight();\r
                        for(int y=h-1;y>=0;y--){\r
@@ -162,9 +162,9 @@ public class NyARRasterImageIO
        public static void copy(BufferedImage i_in,INyARRaster o_out) throws NyARException\r
        {\r
                assert o_out.getSize().isEqualSize(i_in.getWidth(), i_in.getHeight());\r
-               if(o_out.getBufferReader().isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_BIN_8))\r
+               if(o_out.isEqualBufferType(INyARRaster.BUFFERFORMAT_INT1D_BIN_8))\r
                {\r
-                       final int[] buf=(int[])o_out.getBufferReader().getBuffer();\r
+                       final int[] buf=(int[])o_out.getBuffer();\r
                        final int w=i_in.getWidth();\r
                        final int h=i_in.getHeight();\r
                        for(int y=h-1;y>=0;y--){\r
diff --git a/trunk/test/.classpath b/trunk/test/.classpath
new file mode 100644 (file)
index 0000000..5661774
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" path=""/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolKit"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.jmf"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.utils.jogl"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/NyARToolkit.sandbox"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/JMF2.1.1e/lib/jmf.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/jre6/lib/ext/gluegen-rt.jar"/>\r
+       <classpathentry kind="lib" path="C:/Program Files (x86)/Java/jre6/lib/ext/jogl.jar"/>\r
+       <classpathentry kind="output" path=""/>\r
+</classpath>\r
diff --git a/trunk/test/.project b/trunk/test/.project
new file mode 100644 (file)
index 0000000..fc17a6d
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>Test</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
index 3a4947f..8924170 100644 (file)
@@ -36,7 +36,7 @@ public class LabelingTest extends Frame
                NyARRasterFilterBuilder_RgbToBin filter = new NyARRasterFilterBuilder_RgbToBin(110, ra.getBufferReader().getBufferType());\r
                NyARBinRaster bin = new NyARBinRaster(W,240);\r
                filter.doFilter(ra, bin);\r
-               int[] t = (int[]) bin.getBufferReader().getBuffer();\r
+               int[] t = (int[]) bin.getBuffer();\r
                int[] s = {\r
                                1,1,1,1,1,1,1,1,1,1,\r
 \r
@@ -168,7 +168,7 @@ public class LabelingTest extends Frame
                {\r
                        final int width = this._width;\r
                        final int height = this._height;\r
-                       int[] in_buf = (int[]) i_bin_raster.getBufferReader().getBuffer();\r
+                       int[] in_buf = (int[]) i_bin_raster.getBuffer();\r
 \r
                        short current = 0;\r
                        short r = -1;\r
index b9f9f8a..beeefc6 100644 (file)
@@ -161,7 +161,7 @@ public class OptimizeCompareTest implements GLEventListener
                Frame frame = new Frame("["+i_pf+"]");\r
 \r
                // NyARToolkitの準備\r
-               this._nya = new NyARSingleDetectMarker(this._ar_param, i_program._ar_code, 80.0,i_program._cap_image.getBufferReader().getBufferType(),i_pf);\r
+               this._nya = new NyARSingleDetectMarker(this._ar_param, i_program._ar_code, 80.0,i_program._cap_image.getBufferType(),i_pf);\r
                this._nya.setContinueMode(true);// ここをtrueにすると、transMatContinueモード(History計算)になります。\r
                \r
                // 3Dを描画するコンポーネント\r
index 28a3a6a..6d3b94f 100644 (file)
@@ -78,7 +78,7 @@ public class PattPickupTest extends Frame implements JmfCaptureListener
                NyARCode code = new NyARCode(16, 16);\r
                code.loadARPattFromFile(CARCODE_FILE);\r
                this._capraster = new JmfNyARRaster_RGB(W, H, this._capture.getCaptureFormat());\r
-               this.detect = new NyARSingleDetectMarker(ar_param, code, 80, this._capraster.getBufferReader().getBufferType());\r
+               this.detect = new NyARSingleDetectMarker(ar_param, code, 80, this._capraster.getBufferType());\r
                this._capture.setOnCapture(this);\r
                this._bin_raster = new NyARBinRaster(W, H);\r
                this._param = ar_param;\r
@@ -112,7 +112,7 @@ public class PattPickupTest extends Frame implements JmfCaptureListener
 \r
                        {// ピックアップ画像の表示\r
                                // 矩形抽出\r
-                               INyARRasterFilter_Bin to_binfilter = new NyARRasterFilterBuilder_RgbToBin(110, i_raster.getBufferReader().getBufferType());\r
+                               INyARRasterFilter_Bin to_binfilter = new NyARRasterFilterBuilder_RgbToBin(110, i_raster.getBufferType());\r
                                to_binfilter.doFilter(i_raster, this._bin_raster);\r
                                if (this.detect.detectMarkerLite(i_raster, 100)) {\r
 \r
index bf199a0..dd6fb32 100644 (file)
@@ -18,7 +18,7 @@ import jp.nyatla.nyartoolkit.core.param.NyARPerspectiveProjectionMatrix;
 import jp.nyatla.nyartoolkit.core.pickup.INyARColorPatt;\r
 import jp.nyatla.nyartoolkit.core.raster.NyARBinRaster;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
-import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin.INyARRasterFilter_RgbToBin;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin.INyARRasterFilter_Rgb2Bin;\r
 \r
 \r
 \r
@@ -253,7 +253,7 @@ public class MarkerTracking_3dTrans
        protected INyARTransMat _transmat;\r
        //画処理用\r
        private NyARBinRaster _bin_raster;\r
-       protected INyARRasterFilter_RgbToBin _tobin_filter;\r
+       protected INyARRasterFilter_Rgb2Bin _tobin_filter;\r
        private DetectSquareCB _detect_cb;\r
        \r
        public IntRectStack _next_marker;\r
@@ -268,7 +268,7 @@ public class MarkerTracking_3dTrans
                INyARColorPatt i_patt_inst,\r
                INyARSquareContourDetector i_sqdetect_inst,\r
                INyARTransMat i_transmat_inst,\r
-               INyARRasterFilter_RgbToBin i_filter,\r
+               INyARRasterFilter_Rgb2Bin i_filter,\r
                NyARParam       i_ref_param,\r
                NyARCode        i_ref_code,\r
                double          i_marker_width) throws NyARException\r
index 2d54cee..07c1363 100644 (file)
@@ -89,7 +89,7 @@ public class TrTest extends Frame implements JmfCaptureListener,MouseMotionListe
                this._capture.setOnCapture(this);\r
 \r
                addMouseMotionListener(this);\r
-               this._tr=new Tracking(ar_param,code,80,this._capraster.getBufferReader().getBufferType());\r
+               this._tr=new Tracking(ar_param,code,80,this._capraster.getBufferType());\r
                this._trm=new TransMat2MarkerRect(ar_param);\r
                return;\r
        }\r