ColorF::ColorF(Enum knownColor, FLOAT)(Enum, FLOAT) constructor

Instantiates a new instance of the ColorF class from the specified known color name and an alpha value.

Syntax

ColorF(Enum knownColor, FLOAT)(
   Enum  knownColor,
   FLOAT a = 1.0
);

Parameters

  • knownColor
    Type: Enum

    A constant value, defined by the ColorF class, that indicates a known color. For example, D2D1::ColorF::Orange.

  • a
    Type: FLOAT

    The alpha value for the color to be constructed. An alpha channel value ranges from 0.0 to 1.0, where 0.0 represents a fully transparent color and 1.0 represents a fully opaque color. The default value is 1.0.

Remarks

For a complete list of predefined colors, see the Color constants section of the ColorF class.

Examples

The following example creates a predefined color and uses it to specify the color of an ID2D1SolidColorBrush.

hr = m_pRenderTarget->CreateSolidColorBrush(
    D2D1::ColorF(D2D1::ColorF::Black, 1.0f),
    &m_pBlackBrush
    );

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

D2D1

Header

D2d1helper.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ColorF

Brushes Overview