|
-
Aug 12th, 2000, 07:57 PM
#1
Thread Starter
Fanatic Member
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.
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 12th, 2000, 08:13 PM
#2
Frenzied Member
mine come out fine, what are you using?
(I do this)
Code:
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
-
Aug 12th, 2000, 08:38 PM
#3
Thread Starter
Fanatic Member
I see what i did wrong! Thank you Sam! I didn't set the top of the Dest to the top of the form!!!
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 13th, 2000, 08:27 AM
#4
You can use PaintPicture as well.
Code:
Me.PaintPicture Picture1.Picture, 0, Picture1.Height, Picture1.Width, -1 * Picture1.Height
-
Aug 13th, 2000, 11:24 AM
#5
Monday Morning Lunatic
As long as we don't get into another holy war on the relative speed of BitBlt/PaintPicture.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 13th, 2000, 11:26 AM
#6
Thread Starter
Fanatic Member
after i finished reading "How does VB strech a Image" thread, and saw StretchBlt and PaintPicture in this thread, i got a little nervious!
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 13th, 2000, 11:28 AM
#7
Monday Morning Lunatic
AFAICS, there isn't much difference, so to sum up on about 3 different threads, use whichever one you prefer.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 13th, 2000, 02:23 PM
#8
Hyperactive Member
I created a small algorithm that would enable me to do it with the GetPixel and SetPixel APIs. It was very slow though.
-
Aug 13th, 2000, 03:07 PM
#9
rino_2: I wouldn't recommend using SetPixel and GetPixel to flip images. StretchBlt and PaintPicture are both noticably faster.
-
Aug 13th, 2000, 03:27 PM
#10
Frenzied Member
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
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
|