public static IReadOnlyList <DXGI_MODE_DESC> GetDisplayModeList(this IDXGIOutput output, DXGI_FORMAT format, DXGI_ENUM_MODES modes) { if (output == null) { throw new ArgumentNullException(nameof(output)); } // DXGI_FORMAT_R16G16B16A16_FLOAT // DXGI_FORMAT_R10G10B10A2_UNORM // DXGI_FORMAT_R8G8B8A8_UNORM // DXGI_FORMAT_R8G8B8A8_UNORM_SRGB // DXGI_FORMAT_B8G8R8A8_UNORM // DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM // DXGI_FORMAT_B8G8R8A8_UNORM_SRGB var list = new List <DXGI_MODE_DESC>(); uint num = 0; output.GetDisplayModeList(format, (uint)modes, ref num, null); if (num > 0) { var array = new DXGI_MODE_DESC[num]; output.GetDisplayModeList(format, (uint)modes, ref num, array); list.AddRange(array); } return(list); }
public static DXGI_MODE_DESC?FindClosestMatchingMode(this IDXGIOutput output, DXGI_MODE_DESC modeToMatch, object concernedDevice) { if (output == null) { throw new ArgumentNullException(nameof(output)); } var closest = new DXGI_MODE_DESC(); if (output.FindClosestMatchingMode(ref modeToMatch, out closest, ComObject.Unwrap(concernedDevice)).IsError) { return(null); } return(closest); }
public static DXGI_MODE_DESC?FindClosestMatchingMode(this ComObject <IDXGIOutput1> output, DXGI_MODE_DESC modeToMatch, object concernedDevice) => FindClosestMatchingMode(output?.Object, modeToMatch, concernedDevice);