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

Definition

Skapar en ny Color struktur med hjälp av den angivna alfakanalen, färgkanalvärdena och färgprofilen.

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

Parametrar

a
Single

Alfakanalen för den nya färgen, ett värde mellan 0 och 1.

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.

Exempel

I följande exempel visas hur du använder FromAValues metoden för att skapa en 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

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.

Gäller för