Color.FromValues(Single[], Uri) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Skapar en ny Color struktur med hjälp av de angivna färgkanalvärdena och färgprofilen.
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
Parametrar
- values
- Single[]
En samling värden som anger färgkanalerna för den nya färgen. Dessa värden mappas profileUritill .
- profileUri
- Uri
Färgprofilen International Color Consortium (ICC) eller ICM (Image Color Management) för den nya färgen.
Returer
En Color struktur med de angivna värdena och ett alfakanalvärde på 1.
Exempel
I följande exempel visas hur du använder FromValues metoden för att skapa en Color struktur.
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
Kommentarer
En ICC-färgprofil (International Color Consortium) eller ICM-färgprofil (Image Color Management) innehåller en färgsystemprofil för ett visst program eller en viss enhet, till exempel en färgskrivare. Den här profilen matchas med en gemensam profil som i sin tur kan mappas till de enskilda profilerna för andra enheter. Detta gör att färgsystemet som används av en datorenhet matchar färgerna från andra program och enheter på samma eller andra datorsystem.