📄 cpp1.cpp
字号:
/*
* Cleanup.
*/
SelectObject(hdcTargetAND16, hbmTargetAND16Old);
DeleteObject(hbmTargetAND16);
DeleteDC(hdcTargetAND16);
SelectObject(hdcClipAND16, hbmClipAND16Old);
DeleteObject(hbmClipAND16);
DeleteDC(hdcClipAND16);
SelectObject(hdcClipAND, hbmClipANDOld);
DeleteObject(hbmClipAND);
DeleteDC(hdcClipAND);
GlobalUnlock(hClipData);
}
/*
* Get the clipboard bitmap into a DC.
*/
hdcClip = CreateCompatibleDC(ghdcImage);
hbmClipOld = SelectObject(hdcClip, hbmClip);
/*
* Create the target bitmap.
*/
hdcTarget = CreateCompatibleDC(ghdcImage);
hbmTarget = MyCreateBitmap(ghdcImage, cxTarget, cyTarget, 16);
hbmTargetOld = SelectObject(hdcTarget, hbmTarget);
/*
* StretchBlt the bitmap onto the target.
*/
SetStretchBltMode(hdcTarget, COLORONCOLOR);
SetStretchBltMode(hdcClip, COLORONCOLOR); //
StretchBlt(hdcTarget, 0, 0, cxTarget, cyTarget, hdcClip, 0, 0,
cxSource, cySource, SRCCOPY);
/*
* Handle some special cases.
*/
if (giType == FT_BITMAP || !fIEFormatFound) {
/*
* The image we are pasting into is either a bitmap, or
* there does not exist an AND mask in the clipboard.
*/
if (gnColors == 2) {
/*
* We are pasting to a mono image. We must convert the
* colors in the clipboard bitmap into monochrome.
*/
ImageDCMonoBlt(hdcTarget, cxTarget, cyTarget);
}
}
else {
/*
* We are pasting into an icon or cursor image and we have
* available an AND mask. Is the current image monochrome?
*/
if (gnColors == 2) {
/*
* Remove the old screen/inverse colors from the image,
* convert it to monochrome, then put back in the
* current screen/inverse colors.
*/
ImageDCSeparate(hdcTarget, cxTarget, cyTarget, hdcTargetAND,
rgbClipScreen);
ImageDCMonoBlt(hdcTarget, cxTarget, cyTarget);
ImageDCCombine(hdcTarget, cxTarget, cyTarget, hdcTargetAND);
}
/*
* Does the screen color specified in the clipboard
* differ from the current screen color?
*/
else if (rgbClipScreen != grgbScreen) {
/*
* Remove the old screen/inverse colors, then put back
* in the current ones.
*/
ImageDCSeparate(hdcTarget, cxTarget, cyTarget, hdcTargetAND,
rgbClipScreen);
ImageDCCombine(hdcTarget, cxTarget, cyTarget, hdcTargetAND);
}
}
/*
* Blt the clipboard image to the proper rectangle in the current image.
*/
BitBlt(ghdcImage, grcPick.left, grcPick.top,
cxTarget, cyTarget, hdcTarget, 0, 0, SRCCOPY);
/*
* If the current image is an icon or cursor, we must take care
* of the AND mask also.
*/
if (giType != FT_BITMAP) {
/*
* Is there an AND mask in the clipboard to use?
*/
if (fIEFormatFound) {
/*
* Blt it into the current image's AND mask.
*/
BitBlt(ghdcANDMask, grcPick.left, grcPick.top,
cxTarget, cyTarget, hdcTargetAND, 0, 0, SRCCOPY);
}
else {
/*
* Make the AND mask opaque, because there is no
* screen color information.
*/
PatBlt(ghdcANDMask, grcPick.left, grcPick.top,
cxTarget, cyTarget, BLACKNESS);
}
}
/*
* Cleanup.
*/
SelectObject(hdcTarget, hbmTargetOld);
DeleteObject(hbmTarget);
DeleteDC(hdcTarget);
if (giType != FT_BITMAP && fIEFormatFound) {
SelectObject(hdcTargetAND, hbmTargetANDOld);
DeleteObject(hbmTargetAND);
DeleteDC(hdcTargetAND);
}
SelectObject(hdcClip, hbmClipOld);
DeleteDC(hdcClip);
CloseClipboard();
/*
* Update the View and workspace windows.
*/
ViewUpdate();
/*
* Reset pick rectangle to cover entire image.
*/
PickSetRect(0, 0, gcxImage - 1, gcyImage - 1);
fImageDirty = TRUE;
SetCursor(hcurOld);
return TRUE;
Error2:
CloseClipboard();
Error1:
SetCursor(hcurOld);
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -