int GetROP2(hdc) | |||||
HDC hdc; | /* handle of device context | */ |
The GetROP2 function retrieves the current drawing mode. The drawing mode specifies how the colors of the pen and the interior of filled objects are combined with the color already on the screen surface.
hdc
Identifies the device context.
The return value specifies the drawing mode if the function is successful.
The drawing mode is for raster devices only and does not apply to vector devices. It can be any of the following values:
Value | Meaning |
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 = (~screen pixel) | pen). |
R2_MASKPENNOT | Pixel is a combination of the colors common to both the pen and the inverse of the screen (final pixel = (~screen pixel) & pen). |
R2_MERGENOTPEN | Pixel is a combination of the screen color and the inverse of the pen color (final pixel = (~pen) | screen pixel). |
R2_MASKNOTPEN | Pixel is a combination of the colors common to both the screen and the inverse of the pen (final pixel = (~pen) & screen pixel). |
R2_MERGEPEN | Pixel is a combination of the pen color and the screen color (final pixel = pen | screen pixel). |
R2_NOTMERGEPEN | Pixel is the inverse of the R2_MERGEPEN color (final pixel = ~(pen | screen pixel)). |
R2_MASKPEN | Pixel is a combination of the colors common to both the pen and the screen (final pixel = pen & screen pixel). |
R2_NOTMASKPEN | Pixel is the inverse of the R2_MASKPEN color (final pixel = ~(pen & screen pixel)). |
R2_XORPEN | Pixel is a combination of the colors that are in the pen and in the screen, but not in both (final pixel = pen ^ screen pixel). |
R2_NOTXORPEN | Pixel is the inverse of the R2_XORPEN color (final pixel = ~(pen ^ screen pixel)). |
The following example uses the GetROP2 function to test whether the current drawing mode is R2_COPYPEN:
int nROP;
nROP = GetROP2(hdc);
if (nROP == R2_COPYPEN)
TextOut(hdc, 100, 100, "ROP is R2_COPYPEN.", 18);