MagSetColorEffect function

Sets the color transformation matrix for a magnifier control.

Syntax


BOOL MagSetColorEffect(
  _In_  HWND hwnd,
  _In_  PMAGCOLOREFFECT pEffect
);

Parameters

hwnd [in]

Type: HWND

The magnification window.

pEffect [in]

Type: PMAGCOLOREFFECT

The color transformation matrix, or NULL to remove the current color effect, if any.

Return value

Type: BOOL

Returns TRUE if successful, or FALSE otherwise.

Remarks

The magnifier control uses the color transformation matrix to apply a color effect to the entire magnifier window. If the function is called multiple times, the most recent color transform is used.

This function requires Windows Display Driver Model (WDDM)-capable video cards.

Examples

The following example sets a color transformation matrix that converts the colors displayed in the magnifier to grayscale.


// Description:
//   Converts the colors displayed in the magnifier window to grayscale, or
//   returns the colors to normal.
// Parameters:
//   hwndMag - Handle of the magnifier control.
//   fInvert - TRUE to convert to grayscale, or FALSE for normal colors.
//
BOOL ConvertToGrayscale(HWND hwndMag, BOOL fConvert)
{
    // Convert the screen colors in the magnifier window.
    if (fConvert)
    {
        MAGCOLOREFFECT magEffectGrayscale = 
            {{ // MagEffectGrayscale
                {  0.3f,  0.3f,  0.3f,  0.0f,  0.0f },
                {  0.6f,  0.6f,  0.6f,  0.0f,  0.0f },
                {  0.1f,  0.1f,  0.1f,  0.0f,  0.0f },
                {  0.0f,  0.0f,  0.0f,  1.0f,  0.0f },
                {  0.0f,  0.0f,  0.0f,  0.0f,  1.0f } 
            }};

        return MagSetColorEffect(hwndMag, &magEffectGrayscale);
    }

    // Return the colors to normal.
    else
    {
        return MagSetColorEffect(hwndMag, NULL);
    }
}


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Magnification.h

Library

Magnification.lib

DLL

Magnification.dll

See also

MagGetColorEffect

 

 

Community Additions

ADD
Show:
© 2014 Microsoft