Results 1 to 10 of 10

Thread: FlipBlt

  1. #1

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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]

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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

  3. #3

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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]

  4. #4
    Guest
    You can use PaintPicture as well.
    Code:
    Me.PaintPicture Picture1.Picture, 0, Picture1.Height, Picture1.Width, -1 * Picture1.Height

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  6. #6

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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]

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  8. #8
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Smile

    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
    Visual Basic, HTML
    Please Visit my Site: Richard's VB Site

  9. #9
    Guest
    rino_2: I wouldn't recommend using SetPixel and GetPixel to flip images. StretchBlt and PaintPicture are both noticably faster.

  10. #10
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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
  •  



Click Here to Expand Forum to Full Width