Color.FromAValues(Single, Single[], Uri) Metoda

Definicja

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

public:
 static System::Windows::Media::Color FromAValues(float a, cli::array <float> ^ values, Uri ^ profileUri);
public static System.Windows.Media.Color FromAValues (float a, float[] values, Uri profileUri);
static member FromAValues : single * single[] * Uri -> System.Windows.Media.Color
Public Shared Function FromAValues (a As Single, values As Single(), profileUri As Uri) As Color

Parametry

a
Single

Kanał alfa dla nowego koloru, wartość z zakresu od 0 do 1.

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.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą FromAValues metody utworzyć Color strukturę.

private Color FromAValuesExample()
{
    // Create a brown color using the FromAValues static method.
    Color myAValuesColor = 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 iccUri = new Uri("C:\\sampleColorProfile.icc");

    // The FromAValues method requires an explicit value for alpha
    // (first parameter). The values given by the second parameter are
    // used with the color profile specified by the third parameter to 
    // determine the color.
    myAValuesColor = Color.FromAValues(1.0f, colorValues, iccUri);
    return myAValuesColor;
}
Private Function FromAValuesExample() As Color
    ' Create a brown color using the FromAValues static method.
    Dim myAValuesColor 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 iccUri As New Uri("C:\sampleColorProfile.icc")

    ' The FromAValues method requires an explicit value for alpha
    ' (first parameter). The values given by the second parameter are
    ' used with the color profile specified by the third parameter to 
    ' determine the color.
    myAValuesColor = Color.FromAValues(1.0f, colorValues, iccUri)
    Return myAValuesColor
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