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


C# Device.StretchRectangle方法代码示例

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


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

示例1: drawBackGround

 public void drawBackGround(Device i_dev)
 {
     //背景描画
     Surface dest_surface = i_dev.GetBackBuffer(0, BackBufferType.Mono);
     Viewport vp = i_dev.Viewport;
     i_dev.StretchRectangle(this._surface, this._src_rect, dest_surface, new Rectangle(vp.X, vp.Y, vp.Width, vp.Height), TextureFilter.None);
     return;
 }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:8,代码来源:D3dBackground.cs

示例2: copyBuffer

 private void copyBuffer(Device device, Surface bb)
 {
     device.StretchRectangle(bb, _renderTarget0, TextureFilter.Point);
     device.GetRenderTargetData(_renderTarget0, _renderTarget);
 }
开发者ID:stani,项目名称:GScreensTool,代码行数:5,代码来源:DXHookD3D9.cs

示例3: drawBackground

        /// <summary>
        /// バックグラウンドにラスタを描画します。
        /// </summary>
        /// <param name="i_gl"></param>
        /// <param name="i_bg_image"></param>
        public void drawBackground(Device i_dev, INyARRgbRaster i_bg_image)
	    {
            NyARIntSize s = i_bg_image.getSize();
            if(this._surface==null){
                this._surface = new NyARD3dSurface(i_dev,s.w,s.h);
            }else if(!this._surface.isEqualSize(i_bg_image.getSize())){
                //サーフェイスの再構築
                this._surface.Dispose();
                this._surface = new NyARD3dSurface(i_dev, this._screen_size.w, this._screen_size.h);
            }
            this._surface.setRaster(i_bg_image);
            Surface dest_surface = i_dev.GetBackBuffer(0, 0, BackBufferType.Mono);
            Rectangle rect = new Rectangle(0, 0, this._screen_size.w, this._screen_size.h);
            i_dev.StretchRectangle((Surface)this._surface, rect, dest_surface, rect, TextureFilter.None);
	    }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:20,代码来源:NyARD3dRender.cs

示例4: MeasureLuminance

        public void MeasureLuminance(Effect effect, Device device)
        {
            Surface OriginalRenderTarget = device.GetRenderTarget(0);
            Vector2[] sampleOffsets = new Vector2[16];
            Texture dest = ToneMapTex[nToneMapTex - 1];

            SurfaceDescription destDescr = dest.GetLevelDescription(0);
            SurfaceDescription sourceDescr = Renderer.Instance.RenderSurface.Description;

            GetSampleOffsets_DownScale2x2_Lum(sourceDescr.Width, sourceDescr.Height, destDescr.Width, destDescr.Height, ref sampleOffsets);
            effect.SetValue<Vector2>(new EffectHandle("g_avSampleOffsets"), sampleOffsets);
            effect.Technique = "DownScale2x2_Lum_RGBE8";

            Surface destSurface = dest.GetSurfaceLevel(0);
            device.SetRenderTarget(0, destSurface);
            Surface OriginalDS = device.DepthStencilSurface;
            device.DepthStencilSurface = Renderer.Instance.RenderDepthSurface;
            device.SetSamplerState(0, SamplerState.MagFilter, (int)TextureFilter.Linear);
            device.SetSamplerState(0, SamplerState.MinFilter, (int)TextureFilter.Linear);
            device.SetTexture(0, Renderer.Instance.RenderTexture);

            Renderer.Instance.DrawFullScreenQuad();
            device.SetTexture(0, null);

            effect.Technique = "DownScale3x3_RGBE8";
            for (int i = nToneMapTex - 1; i > 0; i--)
            {
                Surface source = ToneMapTex[i].GetSurfaceLevel(0);
                dest = ToneMapTex[i - 1];
                destSurface = dest.GetSurfaceLevel(0);
                GetSampleOffsetsets_DownScale3x3(destSurface.Description.Width, destSurface.Description.Height, ref sampleOffsets);
                effect.SetValue<Vector2>(new EffectHandle("g_avSampleOffsets"), sampleOffsets);

                device.SetRenderTarget(0, destSurface);
                device.SetTexture(0, ToneMapTex[i]);
                //device.SetSamplerState(0, SamplerStageStates.MagFilter, (int)TextureFilter.Point);
                //device.SetSamplerState(0, SamplerStageStates.MinFilter, (int)TextureFilter.Point);

                Renderer.Instance.DrawFullScreenQuad();

                device.SetTexture(0, null);
            }

            // Add calculated luminance to average
            if (CurrentAvgToneMap == -1)
            {
                Rectangle avgrect = new Rectangle(new Point(), new Size(1, 1));
                device.StretchRectangle(ToneMapTex[0].GetSurfaceLevel(0), avgrect, avgToneMap[0].GetSurfaceLevel(0), avgrect, TextureFilter.Point);

                CurrentAvgToneMap = 0;
            }
            else
            {
                effect.Technique = "CalcAvgLum_RGBE8";
                device.SetTexture(0, avgToneMap[CurrentAvgToneMap]); // "main" average
                int other = (CurrentAvgToneMap == 0 ? 1 : 0);
                device.SetTexture(1, ToneMapTex[0]); // new average to be added
                Surface surf = avgToneMap[other].GetSurfaceLevel(0);
                device.SetRenderTarget(0, surf); // unused "main" average texture used as rendertarget

                Renderer.Instance.DrawFullScreenQuad();

                device.SetTexture(0, null);
                device.SetTexture(1, null);
                CurrentAvgToneMap = other; // swap avgTonemap usage next frame
            }

            device.SetRenderTarget(0, OriginalRenderTarget);
            device.DepthStencilSurface = OriginalDS;

            // Read result
            device.GetRenderTargetData(AverageLum.GetSurfaceLevel(0), LockableAverage.GetSurfaceLevel(0));
            DataRectangle rect = LockableAverage.LockRectangle(0, LockFlags.ReadOnly);
            Color4 color = new Color4(rect.Data.Read<int>());
            LockableAverage.UnlockRectangle(0);

            // Revert LogLum encoding
            float invLogLumRange = 1.0f / (MaxLogLum + MinLogLum);
            float logLumOffset = MinLogLum * invLogLumRange;
            double avgLum = Math.Exp((color.Alpha) / (invLogLumRange + logLumOffset));
            effect.SetValue("avgLogLum", avgLum);
            //System.Console.WriteLine(avgLum);
        }
开发者ID:maesse,项目名称:CubeHags,代码行数:83,代码来源:ToneMap.cs


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