当前位置: 首页>>代码示例>>C#>>正文


C# INyARGrayscaleRaster.getBufferType方法代码示例

本文整理汇总了C#中INyARGrayscaleRaster.getBufferType方法的典型用法代码示例。如果您正苦于以下问题:C# INyARGrayscaleRaster.getBufferType方法的具体用法?C# INyARGrayscaleRaster.getBufferType怎么用?C# INyARGrayscaleRaster.getBufferType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INyARGrayscaleRaster的用法示例。


在下文中一共展示了INyARGrayscaleRaster.getBufferType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDriver

 /**
  * この関数は、i_rasterを操作するピクセルドライバインスタンスを生成します。
  * @param i_raster
  * @return
  * @throws NyARException
  */
 public static INyARGsRasterGraphics CreateDriver(INyARGrayscaleRaster i_raster)
 {
     switch (i_raster.getBufferType()) {
     case NyARBufferType.INT1D_GRAY_8:
       return new NyARGsRasterGraphics_GS_INT8(i_raster);
     default:
       break;
       }
       throw new NyARException();
 }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:16,代码来源:NyARGsRasterGraphicsFactory.cs

示例2: copyTo

 public void copyTo(int i_left, int i_top, int i_skip, INyARGrayscaleRaster o_output)
 {
     Debug.Assert(this._raster.getSize().isInnerSize(i_left + o_output.getWidth() * i_skip, i_top + o_output.getHeight() * i_skip));
     int[] input = (int[])this._raster.getBuffer();
     switch (o_output.getBufferType())
     {
         case NyARBufferType.INT1D_GRAY_8:
             int[] output = (int[])o_output.getBuffer();
             NyARIntSize dest_size = o_output.getSize();
             NyARIntSize src_size = this._raster.getSize();
             int skip_src_y = (src_size.w - dest_size.w * i_skip) + src_size.w * (i_skip - 1);
             int pix_count = dest_size.w;
             int pix_mod_part = pix_count - (pix_count % 8);
             // 左上から1行づつ走査していく
             int pt_dst = 0;
             int pt_src = (i_top * src_size.w + i_left);
             for (int y = dest_size.h - 1; y >= 0; y -= 1)
             {
                 int x;
                 for (x = pix_count - 1; x >= pix_mod_part; x--)
                 {
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                 }
                 for (; x >= 0; x -= 8)
                 {
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                     output[pt_dst++] = input[pt_src];
                     pt_src += i_skip;
                 }
                 // スキップ
                 pt_src += skip_src_y;
             }
             return;
         default:
             throw new NyARException();
     }
 }
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:51,代码来源:NyARGsRasterGraphicsFactory.cs

示例3: createDriver

 public static IRasterDriver createDriver(INyARGrayscaleRaster i_ref_raster)
 {
     switch (i_ref_raster.getBufferType())
     {
         case NyARBufferType.INT1D_GRAY_8:
         case NyARBufferType.INT1D_BIN_8:
             return new NyARContourPickup_BIN_GS8(i_ref_raster);
         default:
             if (i_ref_raster is NyARContourPickup_GsReader)
             {
                 return new NyARContourPickup_GsReader((INyARGrayscaleRaster)i_ref_raster);
             }
             break;
     }
     throw new NyARException();
 }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:16,代码来源:NyARContourPickup.cs

示例4: createInstance

        public static INyARHistogramFromRaster createInstance(INyARGrayscaleRaster i_raster) 
	{
		switch(i_raster.getBufferType()){
		case NyARBufferType.INT1D_GRAY_8:
		case NyARBufferType.INT1D_BIN_8:
			return new NyARHistogramFromRaster_INTGS8(i_raster);
		default:
			if(i_raster is INyARGrayscaleRaster){
				return new NyARHistogramFromRaster_AnyGs((INyARGrayscaleRaster)i_raster);
			}
            if (i_raster is INyARRgbRaster)
            {
				return new NyARHistogramFromRaster_AnyRgb((INyARRgbRaster)i_raster);
			}
            break;
		}
		throw new NyARException();
	}
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:18,代码来源:NyARHistogramFromRasterFactory.cs

示例5: createDriver

 /**
  * ラスタから画素ドライバを構築します。構築したラスタドライバには、i_ref_rasterをセットします。
  * @param i_ref_raster
  * @return
  * @
  */
 public static INyARGsPixelDriver createDriver(INyARGrayscaleRaster i_ref_raster)
 {
     INyARGsPixelDriver ret;
     switch (i_ref_raster.getBufferType())
     {
         case NyARBufferType.INT1D_GRAY_8:
         case NyARBufferType.INT1D_BIN_8:
             ret = new NyARGsPixelDriver_INT1D_GRAY_8();
             break;
         default:
             //RGBRasterインタフェイスがある場合
             if (i_ref_raster is INyARRgbRaster)
             {
                 ret = new NyARGsPixelDriver_RGBX((INyARRgbRaster)i_ref_raster);
                 break;
             }
             throw new NyARException();
     }
     ret.switchRaster(i_ref_raster);
     return ret;
 }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:27,代码来源:NyARGsPixelDriverFactory.cs

示例6: convertRect

        public void convertRect(int l, int t, int w, int h, INyARGrayscaleRaster o_raster)
        {
            byte[] work = this._work;
            BitmapData bm = this._ref_raster.lockBitmap();
            NyARIntSize size = this._ref_raster.getSize();
            int bp = (l + t * size.w) * 4 + (int)bm.Scan0;
            int b = t + h;
            int row_padding_dst = (size.w - w);
            int row_padding_src = row_padding_dst * 4;
            int pix_count = w;
            int pix_mod_part = pix_count - (pix_count % 8);
            int dst_ptr = t * size.w + l;
            // in_buf = (byte[])this._ref_raster.getBuffer();
            switch (o_raster.getBufferType())
            {
                case NyARBufferType.INT1D_GRAY_8:
                    int[] out_buf = (int[])o_raster.getBuffer();
                    for (int y = t; y < b; y++)
                    {

                        int x = 0;
                        for (x = pix_count - 1; x >= pix_mod_part; x--)
                        {
                            int p = Marshal.ReadInt32((IntPtr)bp);
                            out_buf[dst_ptr++] = (((p >> 16) & 0xff) + ((p >> 8) & 0xff) + (p & 0xff)) / 3;
                            bp += 4;
                        }
                        for (; x >= 0; x -= 8)
                        {
                            Marshal.Copy((IntPtr)bp, work, 0, 32);
                            out_buf[dst_ptr++] = (work[0] + work[1] + work[2]) / 3;
                            out_buf[dst_ptr++] = (work[4] + work[5] + work[6]) / 3;
                            out_buf[dst_ptr++] = (work[8] + work[9] + work[10]) / 3;
                            out_buf[dst_ptr++] = (work[12] + work[13] + work[14]) / 3;
                            out_buf[dst_ptr++] = (work[16] + work[17] + work[18]) / 3;
                            out_buf[dst_ptr++] = (work[20] + work[21] + work[22]) / 3;
                            out_buf[dst_ptr++] = (work[24] + work[25] + work[26]) / 3;
                            out_buf[dst_ptr++] = (work[28] + work[29] + work[30]) / 3;
                            bp += 32;
                        }
                        bp += row_padding_src;
                        dst_ptr += row_padding_dst;
                    }
                    this._ref_raster.unlockBitmap();
                    return;
                default:
                    INyARGsPixelDriver out_drv = o_raster.getGsPixelDriver();
                    for (int y = t; y < b; y++)
                    {
                        for (int x = 0; x < pix_count; x++)
                        {
                            int p = Marshal.ReadInt32((IntPtr)bp);
                            out_drv.setPixel(x, y, (((p >> 16) & 0xff) + ((p >> 8) & 0xff) + (p & 0xff)) / 3);
                            bp += 4;
                        }
                        bp += row_padding_src;
                    }
                    this._ref_raster.unlockBitmap();
                    return;
            }
        }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:61,代码来源:NyARBitmapRaster.cs

示例7: convertRect

        public void convertRect(int l, int t, int w, int h, INyARGrayscaleRaster o_raster)
        {
			Color32[] c=(Color32[])(this._ref_raster.getBuffer());
            NyARIntSize size = this._ref_raster.getSize();
            int src = (l + t * size.w) * 4;
            int b = t + h;
            int row_padding_dst = (size.w - w);
            int row_padding_src = row_padding_dst * 4;
            int pix_count = w;
            int pix_mod_part = pix_count - (pix_count % 8);
            
            // in_buf = (byte[])this._ref_raster.getBuffer();
            switch (o_raster.getBufferType())
            {
                case NyARBufferType.INT1D_GRAY_8:
                    int[] out_buf = (int[])o_raster.getBuffer();
					int dst_ptr;
					if(this._is_inverse){
						dst_ptr=(h-1-t) * size.w + l;
						row_padding_dst-=size.w*2;
					}else{
						dst_ptr=t * size.w + l;
					}
                    for (int y = t; y < b; y++)
                    {						
                        int x = 0;
						Color32 p;
                        for (x = pix_count - 1; x >= pix_mod_part; x--)
                        {
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
                        }
                        for (; x >= 0; x -= 8)
                        {
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
							p=c[src++];
                            out_buf[dst_ptr++] = (p.r+p.g+p.b) / 3;
                        }
						dst_ptr+=row_padding_dst;
                        src += row_padding_src;
                    }
                    return;
                default:
                    INyARGsPixelDriver out_drv = o_raster.getGsPixelDriver();
                    for (int y = t; y < b; y++)
                    {
                        for (int x = 0; x < pix_count; x++)
                        {
                            Color32 p = c[src++];
                            out_drv.setPixel(x, y,(p.r+p.g+p.b) / 3);
                        }
                        src += row_padding_src;
                    }
                    return;
            }

        }
开发者ID:Carteor,项目名称:LensesAR-Unity3D,代码行数:70,代码来源:NyARUnityRaster.cs

示例8: doFilter

 public void doFilter(INyARGrayscaleRaster i_output)
 {
     int[] in_ptr = (int[])this._raster.getBuffer();
     int width = this._raster.getWidth();
     int height = this._raster.getHeight();
     int col0, col1, col2;
     int bptr = 0;
     switch (i_output.getBufferType())
     {
         case NyARBufferType.INT1D_GRAY_8:
             int[] out_ptr = (int[])i_output.getBuffer();
             bptr = 0;
             //1行目
             col1 = in_ptr[bptr] * 2 + in_ptr[bptr + width];
             col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr + width + 1];
             out_ptr[bptr] = (col1 * 2 + col2) / 9;
             bptr++;
             for (int x = 0; x < width - 2; x++)
             {
                 col0 = col1;
                 col1 = col2;
                 col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr + width + 1];
                 out_ptr[bptr] = (col0 + col1 * 2 + col2) / 12;
                 bptr++;
             }
             out_ptr[bptr] = (col1 + col2) / 9;
             bptr++;
             //2行目-末行-1
             for (int y = 0; y < height - 2; y++)
             {
                 //左端
                 col1 = in_ptr[bptr] * 2 + in_ptr[bptr - width] + in_ptr[bptr + width];
                 col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr - width + 1] + in_ptr[bptr + width + 1];
                 out_ptr[bptr] = (col1 + col2) / 12;
                 bptr++;
                 for (int x = 0; x < width - 2; x++)
                 {
                     col0 = col1;
                     col1 = col2;
                     col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr - width + 1] + in_ptr[bptr + width + 1];
                     out_ptr[bptr] = (col0 + col1 * 2 + col2) / 16;
                     bptr++;
                 }
                 //右端
                 out_ptr[bptr] = (col1 * 2 + col2) / 12;
                 bptr++;
             }
             //末行目
             col1 = in_ptr[bptr] * 2 + in_ptr[bptr - width];
             col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr - width + 1];
             out_ptr[bptr] = (col1 + col2) / 9;
             bptr++;
             for (int x = 0; x < width - 2; x++)
             {
                 col0 = col1;
                 col1 = col2;
                 col2 = in_ptr[bptr + 1] * 2 + in_ptr[bptr - width + 1];
                 out_ptr[bptr] = (col0 + col1 * 2 + col2) / 12;
                 bptr++;
             }
             out_ptr[bptr] = (col1 * 2 + col2) / 9;
             bptr++;
             return;
         default:
             throw new NyARException();
     }
 }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:67,代码来源:INyARGsGaussianSmoothFilter.cs

示例9: convertRect

 public void convertRect(int l, int t, int w, int h, INyARGrayscaleRaster o_raster)
 {
     int[] wk = this._wk;
     int b = t + h;
     int pix_count = w;
     switch (o_raster.getBufferType())
     {
         default:
             INyARGsPixelDriver out_drv = o_raster.getGsPixelDriver();
             INyARRgbPixelDriver in_drv = this._ref_raster.getRgbPixelDriver();
             for (int y = t; y < b; y++)
             {
                 for (int x = pix_count - 1; x >= 0; x--)
                 {
                     in_drv.getPixel(x, y, wk);
                     out_drv.setPixel(x, y, (306 * (wk[2] & 0xff) + 601 * (wk[1] & 0xff) + 117 * (wk[0] & 0xff)) >> 10);
                 }
             }
             return;
     }
 }
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:21,代码来源:NyARRgb2GsFilterFactory.cs


注:本文中的INyARGrayscaleRaster.getBufferType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。