2012年1月26日 星期四

MFC : SetROP2


        一般用 R2_NOT, 在畫第二次時就會把第一次畫的清為底色

afx_msg void OnMouseMove(UINT, CPoint point)
{
if (this == GetCapture() )
{
CClientDC aDC(this);
aDC.SetROP2(R2_NOT);

aShape->draw(aDC);
aShape->SetEndPoint(point);
aShape->draw(aDC, lcolor);
}
}




  • 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)).



沒有留言:

熱門文章