Results 1 to 11 of 11

Thread: Quickest Pixel Methods

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341

    Quickest Pixel Methods

    hey,

    I have noticed around the following:

    GetPixel / Set Pixel
    GetPixelV / Set PixelV
    Point / PSet

    Which of these, or infact any other method the quickest for pixel operations within a picture box ?

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    There is no GetPixelV =). SetPixelV is the fastest, because it does not return the pixel value that was replaced.

    Z.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    What would the Quickes Get be then ?

    Zaei - You know what its for

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    GetPixel().

    Yep =).

    Z.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    hmmm darn thing doesnt apear to want to work on my picture box.

    i declared the API then did SetPixelV picmap.hdc, x, y, picmap.forecolor

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    balls.

    it doesnt draw coz the AutoRedraw method is on. if i turn that off it works but when the box goes off the screen it gets cleared which ent good!!

  7. #7
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Draw the pixel, then refresh.

    Z.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    Excellent.

    Speedy app here i come lol

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    lol, maybe not.

    Created a new project.
    Added a picture box (auto redraw = false)
    Added this codeChanged ScaleMode to Pixel

    Code:
    Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
    
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SetPixelV Picture1.hdc, X, Y, vbBlack
    Picture1.Refresh
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.Caption = X & "  " & Y
    SetPixelV Me.hdc, X, Y, vbBlack
    Me.Refresh
    End Sub
    And nowt, wudnt draw anything.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    got a way round it.

    MouseDown AutoRedraw = True

    Draw

    MouseUp AutoRedraw = False

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    okay, that works all very well.

    But. it only seems to take the vbWhite, vbBlack etc for the color and doesnt like it when i pass picLeft.BackColor

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