Sprache

Color.FromValues(Single[], Uri) Methode

Definition

Erstellt eine neue Color Struktur mithilfe der angegebenen Farbkanalwerte und des Farbprofils.

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

Parameter

values
Single[]

Eine Auflistung von Werten, die die Farbkanäle für die neue Farbe angeben. Diese Werte sind dem profileUri.

profileUri
Uri

Das International Color Consortium (ICC) oder das ICM-Farbprofil (Image Color Management) für die neue Farbe.

Gibt zurück

Eine Color Struktur mit den angegebenen Werten und einem Alphakanalwert von 1.

Beispiele

Das folgende Beispiel zeigt, wie sie die FromValues Methode zum Erstellen einer Color Struktur verwenden.

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

Hinweise

Ein Farbprofil des International Color Consortium (ICC) oder des Farbmanagements (Image Color Management, ICM) enthält ein Farbsystemprofil für eine bestimmte Anwendung oder ein bestimmtes Gerät, z. B. einen Farbdrucker. Dieses Profil wird mit einem gemeinsamen Profil abgeglichen, das wiederum den einzelnen Profilen anderer Geräte zugeordnet werden kann. Auf diese Weise kann das Farbsystem, das von einem Computergerät verwendet wird, mit den Farben anderer Anwendungen und Geräte auf demselben oder anderen Computersystem übereinstimmen.

Gilt für: