Example #1
0
 /**
  * ARコードファイルからデータを読み込んでo_codeに格納します。
  * @param i_stream
  * @param o_code
  * @throws NyARException
  */
 public static void loadFromARToolKitFormFile(StreamReader i_stream, NyARCode o_code)
 {
     int width = o_code.getWidth();
     int height = o_code.getHeight();
     NyARRaster tmp_raster = new NyARRaster(width, height, NyARBufferType.INT1D_X8R8G8B8_32);
     //4個の要素をラスタにセットする。
     try
     {
         int[] buf = (int[])tmp_raster.getBuffer();
         string[] data = i_stream.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
         //GBRAで一度読みだす。
         int idx=0;
         for (int h = 0; h < 4; h++)
         {
             idx=readBlock(data,idx, width, height, buf);
             //ARCodeにセット(カラー)
             o_code.getColorData(h).setRaster(tmp_raster);
             o_code.getBlackWhiteData(h).setRaster(tmp_raster);
         }
     }
     catch (Exception e)
     {
         throw new NyARException(e);
     }
     tmp_raster = null;//ポイ
     return;
 }
Example #2
0
        /**
         * ARコードファイルからデータを読み込んでo_codeに格納します。
         * @param i_stream
         * @param o_code
         * @throws NyARException
         */
        public static void loadFromARToolKitFormFile(StreamReader i_stream, NyARCode o_code)
        {
            int        width      = o_code.getWidth();
            int        height     = o_code.getHeight();
            NyARRaster tmp_raster = new NyARRaster(width, height, NyARBufferType.INT1D_X8R8G8B8_32);

            //4個の要素をラスタにセットする。
            try
            {
                int[]    buf  = (int[])tmp_raster.getBuffer();
                string[] data = i_stream.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
                //GBRAで一度読みだす。
                int idx = 0;
                for (int h = 0; h < 4; h++)
                {
                    idx = readBlock(data, idx, width, height, buf);
                    //ARCodeにセット(カラー)
                    o_code.getColorData(h).setRaster(tmp_raster);
                    o_code.getBlackWhiteData(h).setRaster(tmp_raster);
                }
            }
            catch (Exception e)
            {
                throw new NyARException(e);
            }
            tmp_raster = null;//ポイ
            return;
        }
Example #3
0
 /**
  * ImputStreamからARToolKit形式のマーカデータを読み、o_raster[4]に格納します。
  * @param i_stream
  * 読出し元のストリームです。
  * @param o_raster
  * 出力先のラスタ配列です。
  * バッファ形式は形式はINT1D_X8R8G8B8_32であり、4要素、かつ全て同一なサイズである必要があります。
  * @
  */
 public static void loadFromARToolKitFormFile(Stream i_stream, NyARRaster[] o_raster)
 {
     Debug.Assert(o_raster.Length == 4);
     //4個の要素をラスタにセットする。
     try
     {
         using (StreamReader sr = new StreamReader(i_stream))
         {
             string[] data = sr.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
             //GBRAで一度読みだす。
             int idx = 0;
             for (int h = 0; h < 4; h++)
             {
                 Debug.Assert(o_raster[h].isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
                 NyARRaster ra = o_raster[h];
                 idx = readBlock(data, idx, ra.getWidth(), ra.getHeight(), (int[])ra.getBuffer());
             }
         }
     }
     catch (Exception e)
     {
         throw new NyARRuntimeException(e);
     }
     return;
 }
Example #4
0
 /**
  * ARコードファイルからデータを読み込んでo_raster[4]に格納します。
  * @param i_stream
  * @param o_raster
  * @throws NyARException
  */
 public static void loadFromARToolKitFormFile(StreamReader i_stream, NyARRaster[] o_raster)
 {
     Debug.Assert(o_raster.Length == 4);
     //4個の要素をラスタにセットする。
     try
     {
         string[] data = i_stream.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
         //GBRAで一度読みだす。
         int idx = 0;
         for (int h = 0; h < 4; h++)
         {
             Debug.Assert(o_raster[h].isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
             NyARRaster ra = o_raster[h];
             idx = readBlock(data, idx, ra.getWidth(), ra.getHeight(), (int[])ra.getBuffer());
         }
     }
     catch (Exception e)
     {
         throw new NyARException(e);
     }
     return;
 }
Example #5
0
 public void setRaster(NyARRaster[] i_raster)
 {
     Debug.Assert(i_raster.Length != 4);
     //ラスタにパターンをロードする。
     for (int i = 0; i < 4; i++)
     {
         this._color_pat[i].setRaster(i_raster[i]);
     }
     return;
 }