Color.FromValues(Single[], Uri) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
利用指定的色彩通道值與色彩配置建立新 Color 結構。
public:
static System::Windows::Media::Color FromValues(cli::array <float> ^ values, Uri ^ profileUri);
public static System.Windows.Media.Color FromValues(float[] values, Uri profileUri);
static member FromValues : single[] * Uri -> System.Windows.Media.Color
Public Shared Function FromValues (values As Single(), profileUri As Uri) As Color
參數
- values
- Single[]
一組數值,用來指定新顏色的色彩通道。 這些值對應到 profileUri。
- profileUri
- Uri
國際色彩聯盟(ICC)或影像色彩管理(ICM)色彩規範用於新色彩。
傳回
一個 Color 具有指定值且 alpha 通道值為 1 的結構。
範例
以下範例展示了如何利用此 FromValues 方法建立 Color 結構。
private Color FromValuesExample()
{
// Create a brown color using the FromValues static method.
Color myValuesColor = new Color();
float[] colorValues = new float[4];
colorValues[0] = 0.0f;
colorValues[1] = 0.5f;
colorValues[2] = 0.5f;
colorValues[3] = 0.5f;
// Uri to sample color profile. This color profile is used to
// determine what the colors the colorValues map to.
Uri myIccUri = new Uri("C:\\sampleColorProfile.icc");
// The values given by the first parameter are used with the color
// profile specified by the second parameter to determine the color.
myValuesColor = Color.FromValues(colorValues, myIccUri);
return myValuesColor;
}
Private Function FromValuesExample() As Color
' Create a brown color using the FromValues static method.
Dim myValuesColor As New Color()
Dim colorValues(3) As Single
colorValues(0) = 0.0f
colorValues(1) = 0.5f
colorValues(2) = 0.5f
colorValues(3) = 0.5f
' Uri to sample color profile. This color profile is used to
' determine what the colors the colorValues map to.
Dim myIccUri As New Uri("C:\sampleColorProfile.icc")
' The values given by the first parameter are used with the color
' profile specified by the second parameter to determine the color.
myValuesColor = Color.FromValues(colorValues, myIccUri)
Return myValuesColor
End Function
備註
國際色彩聯盟(ICC)或影像色彩管理(ICM)色彩配置檔包含針對特定應用或裝置(如彩色印表機)的色彩系統配置檔。 這個設定檔會與一個共同設定檔配對,而該設定檔又可以映射到其他裝置的各個設定檔。 這使得單一電腦裝置使用的色彩系統能與同一或其他電腦系統上其他應用程式及裝置的顏色相匹配。