Color.FromValues(Single[], Uri) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new Color structure by using the specified color channel values and color profile.
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
Parameters
- values
- Single[]
A collection of values that specify the color channels for the new color. These values map to the profileUri
.
- profileUri
- Uri
The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color.
Returns
A Color structure with the specified values and an alpha channel value of 1.
Examples
The following example shows how to use the FromValues method to create a Color structure.
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
Remarks
A International Color Consortium (ICC) or Image Color Management (ICM) color profile contains a color system profile for a particular application or device such as a color printer. This profile is matched to a common profile that in turn can be mapped to the individual profiles of other devices. This allows the color system used by one computer device to match the colors from other applications and devices on the same or other computer systems.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기