Click to See Complete Forum and Search --> : FlipBlt
gwdash
Aug 12th, 2000, 07:57 PM
Is there a way to flip an image upside down using BitBlt or StretchBlt. I know it says you can do it with strech blit, but the result is horible,Scrambled lines, etc.
Sam Finch
Aug 12th, 2000, 08:13 PM
mine come out fine, what are you using?
(I do this)
Option Explicit
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click()
Call StretchBlt( _
Picture2.hdc, _
0, 0, _
Picture1.ScaleX(Picture1.ScaleWidth, Picture1.ScaleMode, vbPixels), Picture1.ScaleY(Picture1.ScaleHeight, Picture1.ScaleMode, vbPixels), _
Picture1.hdc, _
0, ScaleY(Picture1.ScaleHeight, Picture1.ScaleMode, vbPixels), _
Picture1.ScaleX(Picture1.ScaleWidth, Picture1.ScaleMode, vbPixels), -Picture1.ScaleY(Picture1.ScaleHeight, Picture1.ScaleMode, vbPixels), _
vbSrcCopy _
)
End Sub
gwdash
Aug 12th, 2000, 08:38 PM
I see what i did wrong! Thank you Sam! I didn't set the top of the Dest to the top of the form!!!
You can use PaintPicture as well.
Me.PaintPicture Picture1.Picture, 0, Picture1.Height, Picture1.Width, -1 * Picture1.Height
parksie
Aug 13th, 2000, 11:24 AM
As long as we don't get into another holy war on the relative speed of BitBlt/PaintPicture.
gwdash
Aug 13th, 2000, 11:26 AM
after i finished reading "How does VB strech a Image" thread, and saw StretchBlt and PaintPicture in this thread, i got a little nervious!
parksie
Aug 13th, 2000, 11:28 AM
AFAICS, there isn't much difference, so to sum up on about 3 different threads, use whichever one you prefer.
rino_2
Aug 13th, 2000, 02:23 PM
I created a small algorithm that would enable me to do it with the GetPixel and SetPixel APIs. It was very slow though.
rino_2: I wouldn't recommend using SetPixel and GetPixel to flip images. StretchBlt and PaintPicture are both noticably faster.
Sam Finch
Aug 13th, 2000, 03:27 PM
If you need an algorithm to manipulate a bitmap use Get/Set Bitmap bits (or Get/Set DIBits but I've never got the hang of them) it's a lot faster as you only have to refresh the DC once, rather than once for each pixel as with Get/Set Pixel
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.