I've loaded a CBitmap object from a resource ID, and I'm now wanting to scale it to 50% its size in each dimension. How might I go about this?
+2
A:
- Select your CBitmap obj into a memDC A (using CDC::SelectObject())
- Create a new CBitmap with desired sized and select it into another MemDC B
- Use CDC::stretchblt(...) to stretch bmp in MemDC A into MemDC B
- Deselect your CBitmap objects (by selecting what was returned from the previous calls to SelectObject)
- Use your new CBitmap
SysAdmin
2010-05-05 05:42:31
I'm not really certain about how to use all of those functions; in which order, using which version of the function, and how a CDC becomes usable for a CBitmap. Could you please provide some code?
Smashery
2010-05-06 00:58:42
And which of the Raster Operation codes to use? http://msdn.microsoft.com/en-us/library/dd183370(v=VS.85).aspx
Smashery
2010-05-06 06:57:54
@Smashery - SRCCOPY would do fine
SysAdmin
2010-05-06 07:27:39
The problem was with Deselecting the CBitmap object. I've edited your answer to note this.
Smashery
2010-05-07 00:23:20