bisonguy2000
asked on
crop CImage bitmap to new Cimage
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:
CImage imgOriginal;
CImage imgCrop;
imgOriginal = LoadFromResource(AfxGetIns tanceHandl e(),BMP_ID ); //THIS WORKS FINE
imgCrop = LoadFromResource(AfxGetIns tanceHandl e(),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,SCR COPY);
imgCrop.releaseDC();
//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?
THANKS!
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:
CImage imgOriginal;
CImage imgCrop;
imgOriginal = LoadFromResource(AfxGetIns
imgCrop = LoadFromResource(AfxGetIns
HDC hdcCrop = imgCrop.getDC();
imgCrop = imgOriginal.BitBlt(hdcCrop
imgCrop.releaseDC();
//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?
THANKS!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This works fine !!
But if I use a PNG with textual content, cropping result is not with that text content.
Why is that?
Also, how can I apply trim after cropping image?
But if I use a PNG with textual content, cropping result is not with that text content.
Why is that?
Also, how can I apply trim after cropping image?
ASKER