標籤

2013年7月15日 星期一

EDID 研究

延伸顯示能力識別

Extended display identification data,簡稱EDID)是指螢幕解析度的資料,包括廠商名稱與序號,一般EDID存在於顯示器的PROM (programmable read-only memory) 或是 EEPROM內。可用如 EDID Viewer 來檢視資料,目前找不到比較正確名數位元碼對應的參數說明資料,自行研究的結果如下。


資料位址

EDID 存在於機碼之中位置如下

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY\Default_Monitor\5&3a7255c5&0&11223344&01&00\Device Parameters

EDID_REG

15h:螢幕寬度物理大小,單位公分

16h:螢幕高度物理大小,單位公分

38h, 3Ah 高位:螢幕最佳寬度解析度

3Bh, 3Dh 高位:螢幕最佳高度解析度

 

AOC 19",1366*768

Max Horizontal Image Size : 410 mm

Max Vertical Image Size : 230 mm

Max Display Size : 18.5 Inches

Horizontal Active : 1366 pixels

Vertical Active : 768 lines

 

螢幕寬度為29h = 41 cm

螢幕高度為17h = 23 cm

螢幕最佳寬度解析 5 56h = 1366

螢幕最佳高度解析 3 00h = 768

 

CHIMEI 22GH,1680*1050


Max Horizontal Image Size : 470 mm

Max Vertical Image Size : 300 mm

Max Display Size : 22 Inches

Horizontal Active : 1680 pixels

Vertical Active : 1050 lines

 

螢幕寬度為2Fh = 47 cm

螢幕高度為1Eh = 30 cm

螢幕最佳寬度解析 6 90h = 1680

螢幕最佳高度解析 4 1Ah = 1050


C#程式碼

#region vesrion , ver 1.0
// ver 1.0 2013.07.16 取得面板名稱,進行查詢面板大小、解析資訊
#endregion

using Microsoft.Win32
;
using System
;
using System.Collections.Generic
;
using System.Drawing
;
using System.Linq
;
using System.Text
;
using System.Windows.Forms
;

namespace
ACH_SAY
{
public class
displayInfo
{
static Byte[] _EDID
;
static string _sDisplayPath = "SYSTEM\\CurrentControlSet\\Enum\\DISPLAY"
;

/// <summary>
/// 取得所有面板名稱
/// </summary>
static public string[] GetNames
()
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(_sDisplayPath
);
string[] DisplayNames = key.GetSubKeyNames
();
return DisplayNames
;
}

/// <summary>
/// 取得EDID資訊
/// </summary>
static public void LoadEDID(string DisplayName
)
{
StringBuilder sDir = new StringBuilder(_sDisplayPath
);

sDir.Append("\\").Append(DisplayName
);
RegistryKey key = Registry.LocalMachine.OpenSubKey(sDir.ToString
());
string[] Setting = key.GetSubKeyNames
();

sDir.Append("\\").Append(Setting[0]).Append("\\Device Parameters"
);
key = Registry.LocalMachine.OpenSubKey(sDir.ToString
());

_EDID = key.GetValue("EDID") as Byte
[];
}

/// <summary>
/// 取得螢幕實體大小(單位cm)
/// </summary>
/// <returns></returns>
static public Size GetSize
()
{
if (_EDID == null
)
{
return Size.Empty
;
}
return new Size(_EDID[21], _EDID[22
]);
}

/// <summary>
/// 取得螢幕最佳解析度
/// </summary>
/// <returns></returns>
static public Size GetBestResolution
()
{
if (_EDID == null
)
{
return Size.Empty
;
}
int Width = ((_EDID[58] & 0xF0) << 4) + _EDID[56
];
int Height = ((_EDID[61] & 0xF0) << 4) + _EDID[59
];
return new Size(Width, Height
);
}

/// <summary>
/// 取得螢幕大小(inch)
/// </summary>
/// <returns></returns>
static public double GetInch
()
{
if (_EDID == null
)
{
return Double.NaN
;
}
double Inch = Math.Sqrt(_EDID[21] * _EDID[21] + _EDID[22] * _EDID[22]) / 2.54
;
return Inch
;
}

/// <summary>
/// 設定是否為最佳解析度
/// </summary>
/// <returns></returns>
static public bool IsBestResoliton
()
{
Size ScreenSize = Screen.PrimaryScreen.Bounds.Size
;
Size bestSize = GetBestResolution
();
return bestSize.Equals(ScreenSize
);
}
}
}

沒有留言:

張貼留言