Color.FromValues(Single[], Uri) Methode

Definition

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

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, mit denen die Farbkanäle für die neue Farbe angegeben werden. Diese Werte sind dem profileUri zugeordnet.

profileUri
Uri

Das Internationale Farbkonsortium (ICC) oder das Farbverwaltungsprofil (ICM) für die neue Farbe.

Gibt zurück

Color

Eine Color-Struktur mit den angegebenen Werten und dem Alphakanalwert 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 Internationales Farbkonsortium (ICC) oder Bildfarbverwaltungsprofil (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. Dadurch 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