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


C# BitmapBuffer.DiscardAlpha方法代码示例

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


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

示例1: UpdateSourceInternal

		FilterProgram UpdateSourceInternal(JobInfo job)
		{
			//no drawing actually happens. it's important not to begin drawing on a control
			if (!job.simulate)
			{
				GlobalWin.GLManager.Activate(CR_GraphicsControl);
			}

			IVideoProvider videoProvider = job.videoProvider;
			bool simulate = job.simulate;
			Size chain_outsize = job.chain_outsize;

			//simulate = true;
			
			int vw = videoProvider.BufferWidth;
			int vh = videoProvider.BufferHeight;

			if (Global.Config.DispFixAspectRatio)
			{
				if (Global.Config.DispManagerAR == Config.EDispManagerAR.System)
				{
					vw = videoProvider.VirtualWidth;
					vh = videoProvider.VirtualHeight;
				}
				if (Global.Config.DispManagerAR == Config.EDispManagerAR.Custom)
				{
					vw = Global.Config.DispCustomUserARWidth;
					vh = Global.Config.DispCustomUserARHeight;
				}
				if (Global.Config.DispManagerAR == Config.EDispManagerAR.CustomRatio)
				{
					FixRatio(Global.Config.DispCustomUserARX, Global.Config.DispCustomUserARY, videoProvider.BufferWidth, videoProvider.BufferHeight, out vw, out vh);
				}
			}

			var padding = CalculateCompleteContentPadding(true,false);
			vw += padding.Horizontal;
			vh += padding.Vertical;

			int[] videoBuffer = videoProvider.GetVideoBuffer();
			
			int bufferWidth = videoProvider.BufferWidth;
			int bufferHeight = videoProvider.BufferHeight;
			bool isGlTextureId = videoBuffer.Length == 1;

			BitmapBuffer bb = null;
			Texture2d videoTexture = null;
			if (!simulate)
			{
				if (isGlTextureId)
				{
					//FYI: this is a million years from happening on n64, since it's all geriatric non-FBO code
					//is it workable for saturn?
					videoTexture = GL.WrapGLTexture2d(new IntPtr(videoBuffer[0]), bufferWidth, bufferHeight);
				}
				else
				{
					//wrap the videoprovider data in a BitmapBuffer (no point to refactoring that many IVideoProviders)
					bb = new BitmapBuffer(bufferWidth, bufferHeight, videoBuffer);
					bb.DiscardAlpha();

					//now, acquire the data sent from the videoProvider into a texture
					videoTexture = VideoTextureFrugalizer.Get(bb);
					
					//lets not use this. lets define BizwareGL to make clamp by default (TBD: check opengl)
					//GL.SetTextureWrapMode(videoTexture, true);
				}
			}

			//record the size of what we received, since lua and stuff is gonna want to draw onto it
			currEmuWidth = bufferWidth;
			currEmuHeight = bufferHeight;

			//build the default filter chain and set it up with services filters will need
			Size chain_insize = new Size(bufferWidth, bufferHeight);

			var filterProgram = BuildDefaultChain(chain_insize, chain_outsize, job.includeOSD);
			filterProgram.GuiRenderer = Renderer;
			filterProgram.GL = GL;

			//setup the source image filter
			Filters.SourceImage fInput = filterProgram["input"] as Filters.SourceImage;
			fInput.Texture = videoTexture;
			
			//setup the final presentation filter
			Filters.FinalPresentation fPresent = filterProgram["presentation"] as Filters.FinalPresentation;
			fPresent.VirtualTextureSize = new Size(vw, vh);
			fPresent.TextureSize = new Size(bufferWidth, bufferHeight);
			fPresent.BackgroundColor = videoProvider.BackgroundColor;
			fPresent.GuiRenderer = Renderer;
			fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio;
			fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger;
			fPresent.Padding = ClientExtraPadding;

			fPresent.GL = GL;

			filterProgram.Compile("default", chain_insize, chain_outsize, !job.offscreen);

			if (simulate)
			{
//.........这里部分代码省略.........
开发者ID:zeromus,项目名称:BizHawk,代码行数:101,代码来源:DisplayManager.cs

示例2: MakeScreenshotImage

 private static unsafe BitmapBuffer MakeScreenshotImage()
 {
     var bb = new BitmapBuffer(Global.Emulator.VideoProvider().BufferWidth, Global.Emulator.VideoProvider().BufferHeight, Global.Emulator.VideoProvider().GetVideoBuffer());
     bb.DiscardAlpha();
     return bb;
 }
开发者ID:cas1993per,项目名称:bizhawk,代码行数:6,代码来源:MainForm.cs

示例3: UpdateSourceInternal

        FilterProgram UpdateSourceInternal(JobInfo job)
        {
            GlobalWin.GLManager.Activate(CR_GraphicsControl);

            IVideoProvider videoProvider = job.videoProvider;
            bool simulate = job.simulate;
            Size chain_outsize = job.chain_outsize;

            int vw = videoProvider.BufferWidth;
            int vh = videoProvider.BufferHeight;

            if (Global.Config.DispFixAspectRatio)
            {
                if (Global.Config.DispManagerAR == Config.EDispManagerAR.System)
                {
                    vw = videoProvider.VirtualWidth;
                    vh = videoProvider.VirtualHeight;
                }
                if (Global.Config.DispManagerAR == Config.EDispManagerAR.Custom)
                {
                    vw = Global.Config.DispCustomUserARWidth;
                    vh = Global.Config.DispCustomUserARHeight;
                }
            }

            int[] videoBuffer = videoProvider.GetVideoBuffer();

            TESTEROO:
            int bufferWidth = videoProvider.BufferWidth;
            int bufferHeight = videoProvider.BufferHeight;
            bool isGlTextureId = videoBuffer.Length == 1;

            //TODO - need to do some work here for GDI+ to repair gl texture ID importing
            BitmapBuffer bb = null;
            Texture2d videoTexture = null;
            if (!simulate)
            {
                //special codepath for GDI+
                //TODO - make for gdi+ only. maybe other codepath for d3d
                if (!(GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK))
                {
                    //wrap the videoprovider data in a BitmapBuffer (no point to refactoring that many IVideoProviders)
                    bb = new BitmapBuffer(bufferWidth, bufferHeight, videoBuffer);
                    bb.DiscardAlpha();

                    //now, acquire the data sent from the videoProvider into a texture
                    videoTexture = VideoTextureFrugalizer.Get(bb);
                    GL.SetTextureWrapMode(videoTexture, true);
                }
                else
                {
                    if (isGlTextureId)
                    {
                        videoTexture = GL.WrapGLTexture2d(new IntPtr(videoBuffer[0]), bufferWidth, bufferHeight);
                    }
                    else
                    {
                        //wrap the videoprovider data in a BitmapBuffer (no point to refactoring that many IVideoProviders)
                        bb = new BitmapBuffer(bufferWidth, bufferHeight, videoBuffer);

                        //now, acquire the data sent from the videoProvider into a texture
                        videoTexture = VideoTextureFrugalizer.Get(bb);
                        GL.SetTextureWrapMode(videoTexture, true);
                    }

                    //TEST (to be removed once we have an actual example of bring in a texture ID from opengl emu core):
                    if (!isGlTextureId)
                    {
                        videoBuffer = new int[1] { videoTexture.Id.ToInt32() };
                        goto TESTEROO;
                    }
                }
            }

            //record the size of what we received, since lua and stuff is gonna want to draw onto it
            currEmuWidth = bufferWidth;
            currEmuHeight = bufferHeight;

            //build the default filter chain and set it up with services filters will need
            Size chain_insize = new Size(bufferWidth, bufferHeight);

            var filterProgram = BuildDefaultChain(chain_insize, chain_outsize, job.includeOSD);
            filterProgram.GuiRenderer = Renderer;
            filterProgram.GL = GL;

            //setup the source image filter
            Filters.SourceImage fInput = filterProgram["input"] as Filters.SourceImage;
            fInput.Texture = videoTexture;

            //setup the final presentation filter
            Filters.FinalPresentation fPresent = filterProgram["presentation"] as Filters.FinalPresentation;
            fPresent.VirtualTextureSize = new Size(vw, vh);
            fPresent.TextureSize = new Size(bufferWidth, bufferHeight);
            fPresent.BackgroundColor = videoProvider.BackgroundColor;
            fPresent.GuiRenderer = Renderer;
            fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio;
            fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger;

            fPresent.GL = GL;

//.........这里部分代码省略.........
开发者ID:cas1993per,项目名称:bizhawk,代码行数:101,代码来源:DisplayManager.cs


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