Export (0) Print
Expand All

Color.FromAValues Method

Creates a new Color structure by using the specified alpha channel, color channel values, and color profile.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public static Color FromAValues(
	float a,
	float[] values,
	Uri profileUri


Type: System.Single
The alpha channel for the new color.
Type: System.Single[]
A collection of values that specify the color channels for the new color. These values map to the profileUri.
Type: System.Uri
The International Color Consortium (ICC) or Image Color Management (ICM) color profile for the new color.

Return Value

Type: System.Windows.Media.Color
A Color structure with the specified values.

A International Color Consortium (ICC) or Image Color Management (ICM) color profile contains a color system profile for a particular application or device such as a color printer. This profile is matched to a common profile that in turn can be mapped to the individual profiles of other devices. This allows the color system used by one computer device to match the colors from other applications and devices on the same or other computer systems.

The following example shows how to use the FromAValues method to create a Color structure.

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;

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft