|
-
Apr 16th, 2015, 04:48 AM
#1
[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.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Apr 16th, 2015, 08:38 AM
#2
Re: Flip image in SetDIBitsToDevice
Does changing the bitmapinfo .biHeight to -.biHeight work?
See your other thread here
-
Apr 17th, 2015, 03:10 AM
#3
Re: Flip image in SetDIBitsToDevice
 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
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|