1

Is there any way to flip a Bitmap with function like BitBlt or StretchBlt. I'am getting really confused by the Cooridnates. Currenty i've tried some variation of this:

BitBlt(hdc,0,bmp.bmHeight,bmp.bmWidth,0,hdc,0,0,SRCCOPY);

Is it even possable with these functions?

Paul Sanders
  • 24,133
  • 4
  • 26
  • 48
Tomke
  • 35
  • 7

2 Answers2

2

BitBlt does not allow for transformations other than translation. StretchBlt will do this, though. Just specify a negative destination width or height (depending on which axis you want to flip around), and adjust the corresponding destination origin coordinate so that it refers to the other side. For instance, to flip a 200x100 image horizontally, you’d do

StretchBlt(
    dest, 
    200, 0, -200, 100,
    src,
    0, 0, 200, 100,
    SRCCOPY);
Sneftel
  • 40,271
  • 12
  • 71
  • 104
1

Use StretchBlt. From the manual

StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or if the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis.

john
  • 85,011
  • 4
  • 57
  • 81