crop CImage bitmap to new Cimage
Posted on 2005-04-26
I have a CImage object that I need to extract a portion of the image to a new CImage.
I have been having trouble doing this, I saw another similar post, but there was not specific code for the solution, I am not an MFC BitBlt expert, so I really need a few lines of example code.
What I am trying to do is the following:
imgOriginal = LoadFromResource(AfxGetInstanceHandle(),BMP_ID); //THIS WORKS FINE
imgCrop = LoadFromResource(AfxGetInstanceHandle(),BMP_ID); // I do this just to initialize imgCrop with a valid bitmap, although it is not currently the correct bitmap
HDC hdcCrop = imgCrop.getDC();
imgCrop = imgOriginal.BitBlt(hdcCrop,50,50,SCRCOPY);
//I need imageCrop to contain a subset or in this case a shifted version of the original image, but I cant get it to work
What should I be doing in my code?