Define the following global variables:
CWnd WndClient; /* current child window */
RGNXFORM XForm; /* Structure for transforming display coordinates */
RECT rClientArea; /* Client area of the current window */
RECT rRgnRect; /* Rectangle that defines the region */
LBitmapBase BitmapDst; /* Destination bitmap */
LBitmapBase BitmapSrc; /* Source bitmap */
L_INT XDst; /* Column offset of the destination */
L_INT YDst; /* Row offset of the destination */
L_INT XSize;/* Pixel width of the rectangle to combine */
L_INT YSize;/* Pixel height of the rectangle to combine */
L_INT XSrc; /* Column offset of the source */
L_INT YSrc; /* Column offset of the source */
Load two images as follows:
BitmapDst.Load(MAKE_IMAGE_PATH(TEXT("sample1.cmp")), 0, ORDER_BGR, NULL, NULL);
BitmapSrc.Load(MAKE_IMAGE_PATH(TEXT("sample2.cmp")), 0, ORDER_BGR, NULL, NULL);
Get the client area of the current child window as follows:
WndClient.GetClientRect(&rClientArea);
Set RGNXFORM fields, assuming that the display rectangle is the same as the client area of the current child window as follows:
XForm.uViewPerspective = TOP_LEFT;
XForm.nXScalarNum = BitmapDst.GetWidth();
XForm.nXScalarDen = rClientArea.right;
XForm.nYScalarNum = BitmapDst.GetHeight();
XForm.nYScalarDen = rClientArea.bottom;
XForm.nXOffset = 0;
XForm.nYOffset = 0;
Specify a rectangle to define the region and then create a rectangular region as follows:
SetRect(&rRgnRect, rClientArea.right/8, rClientArea.bottom/8, rClientArea.right/2, rClientArea.bottom/2);
LBitmapRgn bmpRegion(&BitmapDst);
bmpRegion.SetRgnRect(&rRgnRect);
bmpRegion.SetRgnXForm(&XForm);
Specify a position in the top left part of the displayed image and use the full size of the source bitmap as follows:
XDst = BitmapDst.GetWidth() / 8;
YDst = BitmapDst.GetHeight() / 8;
YSize = BitmapSrc.GetHeight();
XSize = BitmapSrc.GetWidth();
XSrc = 0;
YSrc = 0;
Combine BitmapDst with BitmapSrc, using flags for an ordinary paste, and save it as a new file:
BitmapDst.Combine(&BitmapSrc, XDst, YDst, XSize, YSize, XSrc, YSrc, CB_OP_ADD | CB_DST_0);
BitmapDst.Save(MAKE_IMAGE_PATH(TEXT("eye.gif")), FILE_BMP, 0, 2, 1, 0);
At the end you should free the rectangle:
bmpRegion.Free();
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.