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


C# Mode.CalcPixelBoundaries方法代码示例

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


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

示例1: Refresh

		public void Refresh(_BMDVideoOutputFlags flags)
		{
			WorkerThread.Singleton.PerformBlocking(() =>
			{
				foreach (var mode in FModes.Values)
					Marshal.ReleaseComObject(mode.DisplayModeHandle);
				FModes.Clear();

				DeviceRegister.Singleton.Refresh();
				foreach (var device in DeviceRegister.Singleton.Devices)
				{
					var output = (IDeckLinkOutput)device.DeviceHandle;
					if (output == null)
						throw (new Exception("Device has no outputs"));

					IDeckLinkDisplayModeIterator modeIterator;
					output.GetDisplayModeIterator(out modeIterator);

					while (true)
					{
						IDeckLinkDisplayMode mode;

						modeIterator.Next(out mode);
						if (mode == null)
							break;

						foreach (_BMDPixelFormat pixelFormat in Enum.GetValues(typeof(_BMDPixelFormat)))
						{
							if (true || SupportedFormats.Contains(pixelFormat))
							{
								try
								{
									_BMDDisplayModeSupport support;
									IDeckLinkDisplayMode displayMode;
									output.DoesSupportVideoMode(mode.GetDisplayMode(), pixelFormat, flags, out support, out displayMode);

									string modeString;
									mode.GetName(out modeString);
									int stripLength = "bmdFormat".Length;
									string pixelFormatString = pixelFormat.ToString();
									pixelFormatString = pixelFormatString.Substring(stripLength, pixelFormatString.Length - stripLength);

									modeString += " [" + pixelFormatString + "]";

									long duration, timescale;
									mode.GetFrameRate(out duration, out timescale);

									Mode inserter = new Mode()
									{
										DisplayModeHandle = mode,
										Flags = flags,
										PixelFormat = pixelFormat,
										Width = mode.GetWidth(),
										Height = mode.GetHeight(),
										FrameRate = (double)timescale / (double)duration
									};
									inserter.CalcPixelBoundaries();

									if (support == _BMDDisplayModeSupport.bmdDisplayModeSupported)
									{
										FModes.Add(modeString, inserter);
									}
									else if (support == _BMDDisplayModeSupport.bmdDisplayModeSupportedWithConversion)
									{
										modeString += " converted";
										FModes.Add(modeString, inserter);
									}
								}
								catch
								{
								}
							}
						}
					}
				}
			});
		}
开发者ID:kevinbs,项目名称:VVVV.Packs.Image,代码行数:77,代码来源:ModeRegister.cs


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