views:

125

answers:

1

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: 
  1. Select your CBitmap obj into a memDC A (using CDC::SelectObject())
  2. Create a new CBitmap with desired sized and select it into another MemDC B
  3. Use CDC::stretchblt(...) to stretch bmp in MemDC A into MemDC B
  4. Deselect your CBitmap objects (by selecting what was returned from the previous calls to SelectObject)
  5. Use your new CBitmap
SysAdmin
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
And which of the Raster Operation codes to use? http://msdn.microsoft.com/en-us/library/dd183370(v=VS.85).aspx
Smashery
@Smashery - SRCCOPY would do fine
SysAdmin
The problem was with Deselecting the CBitmap object. I've edited your answer to note this.
Smashery