Home > Software engineering >  Horizontal bars effects, according to the following is the code, you can give me a more detailed com
Horizontal bars effects, according to the following is the code, you can give me a more detailed com

Time:10-19


/* horizontal bars effects show */
Void CDynSplitView2: : OnShuipingshantiao ()
{
//refresh screen
The CDC * pDC=GetDC ();
,0,1000,1000 CRect the rect (0);
CBrush brush (RGB (255255255));
PDC - & gt; FillRect (& amp; The rect, & amp; Brush);
//copy image data
Clearmem ();
Int nscanline=8;//set the display orientation amount
Int k=0;
CDSplitDoc * pDoc=GetDocument ();
ASSERT_VALID (pDoc);
//horizontal bars special effects
if(! PDoc - & gt; Statedoc& & State2==1)
{
BYTE * pBitmapData=https://bbs.csdn.net/topics/CDibNew1-> GetData ();
LPBITMAPINFO pBitmapInfo=CDibNew1 - & gt; GetInfo ();
Int bitmapHeight=CDibNew1 - & gt; GetHeight ().
Int bitmapWidth=CDibNew1 - & gt; GetWidth ();
If (CDibNew1 - & gt; GetRGB ()//Has a color table
{
CPalette * hPalette=CreateBitmapPalette (CDibNew1);
CPalette * hOldPalette=
PDC - & gt; SelectPalette (hPalette, true);
PDC - & gt; RealizePalette ();
for(int i=0; i<=bitmapWidth; I++)
{
for(int j=0; J<=bitmapHeight; J=j + 2 * nscanline)
{
: : StretchDIBits (pDC - & gt; GetSafeHdc (), 0, j, I + 1, nscanline,
BitmapWidth -i bitmapHeight - j, I + 1, nscanline,
PBitmapData pBitmapInfo,
DIB_RGB_COLORS SRCCOPY);
K=j + nscanline;
: : StretchDIBits (pDC - & gt; GetSafeHdc (), bitmapWidth - I, k, I + 1, nscanline,
I + 1, 0, bitmapHeight - k, nscanline,
PBitmapData pBitmapInfo,
DIB_RGB_COLORS SRCCOPY);
}
}
PDC - & gt; SelectPalette (hOldPalette, true);
: : DeleteObject (hPalette);
}
The else
{
for(int i=0; i<=bitmapWidth; I++)
{
for(int j=0; J<=bitmapHeight; J=j + 2 * nscanline)
{
: : StretchDIBits (pDC - & gt; GetSafeHdc (), 0, j, I + 1, nscanline,
BitmapWidth -i bitmapHeight - j, I + 1, nscanline,
PBitmapData pBitmapInfo,
DIB_RGB_COLORS SRCCOPY);
K=j + nscanline;
: : StretchDIBits (pDC - & gt; GetSafeHdc (), bitmapWidth - I, k, I + 1, nscanline,
I + 1, 0, bitmapHeight - k, nscanline,
PBitmapData pBitmapInfo,
DIB_RGB_COLORS SRCCOPY);
}
}
}
}
Invalidate ().
}
  • Related