Color.FromValues(Single[], Uri) Metoda

Definicja

Tworzy nową Color strukturę przy użyciu określonych wartości kanału kolorów i profilu koloru.

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

Parametry

values
Single[]

Kolekcja wartości określających kanały kolorów dla nowego koloru. Te wartości są mapowania na wartość profileUri.

profileUri
Uri

Profil kolorów międzynarodowego konsorcjum (ICC) lub zarządzania kolorami obrazów (ICM) dla nowego koloru.

Zwraca

Color

Struktura Color z określonymi wartościami i wartością kanału alfa 1.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą FromValues metody utworzyć 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

Uwagi

Profil kolorów International Color Consortium (ICC) lub Image Color Management (ICM) zawiera profil systemu kolorów dla określonej aplikacji lub urządzenia, takiego jak drukarka kolorów. Ten profil jest dopasowany do wspólnego profilu, który z kolei można mapować na poszczególne profile innych urządzeń. Pozwala to systemowi kolorów używanemu przez jedno urządzenie komputerowe dopasować kolory z innych aplikacji i urządzeń w tych samych lub innych systemach komputerowych.

Dotyczy