CDC::SetROP2

Sets the current drawing mode.

int SetROP2(
   int nDrawMode 
);

Parameters

  • nDrawMode
    Specifies the new drawing mode. It can be any of the following values:

    • R2_BLACK   Pixel is always black.

    • R2_WHITE   Pixel is always white.

    • R2_NOP   Pixel remains unchanged.

    • R2_NOT   Pixel is the inverse of the screen color.

    • R2_COPYPEN   Pixel is the pen color.

    • R2_NOTCOPYPEN   Pixel is the inverse of the pen color.

    • R2_MERGEPENNOT   Pixel is a combination of the pen color and the inverse of the screen color (final pixel = (NOT screen pixel) OR pen).

    • R2_MASKPENNOT   Pixel is a combination of the colors common to both the pen and the inverse of the screen (final pixel = (NOT screen pixel) AND pen).

    • R2_MERGENOTPEN   Pixel is a combination of the screen color and the inverse of the pen color (final pixel = (NOT pen) OR screen pixel).

    • R2_MASKNOTPEN   Pixel is a combination of the colors common to both the screen and the inverse of the pen (final pixel = (NOT pen) AND screen pixel).

    • R2_MERGEPEN   Pixel is a combination of the pen color and the screen color (final pixel = pen OR screen pixel).

    • R2_NOTMERGEPEN   Pixel is the inverse of the R2_MERGEPEN color (final pixel = NOT(pen OR screen pixel)).

    • R2_MASKPEN   Pixel is a combination of the colors common to both the pen and the screen (final pixel = pen AND screen pixel).

    • R2_NOTMASKPEN   Pixel is the inverse of the R2_MASKPEN color (final pixel = NOT(pen AND screen pixel)).

    • R2_XORPEN   Pixel is a combination of the colors that are in the pen or in the screen, but not in both (final pixel = pen XOR screen pixel).

    • R2_NOTXORPEN   Pixel is the inverse of the R2_XORPEN color (final pixel = NOT(pen XOR screen pixel)).

Return Value

The previous drawing mode.

It can be any of the values given in the Windows SDK.

Remarks

The drawing mode specifies how the colors of the pen and the interior of filled objects are combined with the color already on the display surface.

The drawing mode is for raster devices only; it does not apply to vector devices. Drawing modes are binary raster-operation codes representing all possible Boolean combinations of two variables, using the binary operators AND, OR, and XOR (exclusive OR), and the unary operation NOT.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::GetDeviceCaps

CDC::GetROP2

SetROP2

Other Resources

CDC Members