[RESOLVED] Flip image in SetDIBitsToDevice
In the SetDIBitsToDevice API function,
Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal hdc As Long, ByVal XDest As Long, ByVal yDest As Long, ByVal dx As Long, ByVal dy As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long
xDest, yDest are the coordinates of the upper left corner of the destination rectangle whereas
xSrc, ySrc are the coordinates of the lower left corner of the source DIB.
Therefore the original image comes out with the Y axis flipped.
In order to restore the Y orientation, can I give different function parameters or do I have to switch the source rows? I'm using a 2 dimensional souce array.
Re: Flip image in SetDIBitsToDevice
Does changing the bitmapinfo .biHeight to -.biHeight work?
See your other thread here
Re: Flip image in SetDIBitsToDevice
Quote:
Originally Posted by
LaVolpe
So I had that same trouble a few years ago... Thanks for reminding me.
But setting the negative sign to .biHeight didn't work.
However this worked for me: right after SetDIBitsToDevice I included this statement and the final image was ok:
StretchBlt pic1.hdc, 0, 0, pic1.Width, pic1.Height, pic1.hdc, 0, pic1.Height, pic1.Width, -pic1.Height, vbSrcCopy