Click to See Complete Forum and Search --> : writing and reading a line of picture points
shaversm
Aug 20th, 2002, 01:29 PM
I have a program that reads a bmp picture file
manipulates it and writes it back out to the screen
I am using point and pset, which is very slow
I wrote a faster version that uses picture.line to write
(if the color is the same for consecutive points)
otherwise it uses pset
There must be a way to do a SINGLE operation to
read and write multiple picture points into an long array
i.e. a full line of points
I would think this would speed things up concerably
anybody have something that does this
Bitblt may do this with all the "proper setup"
Amithran
Aug 20th, 2002, 05:04 PM
Instead of pSet, use SetPixelV instead. It's much faster itself and will speed up the routine.
(also included getPixel)
'===================================================================
'SetPixel function used to set a pixel on an hDC.
'-------------------------------------------------------------------
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
'===================================================================
'GetPixel gets a pixel from hDC, generaly used for effects in this class
'-------------------------------------------------------------------
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long) As Long
'example, pixel plotting on the form:
SetPixel Me.hdc, 100, 100, RGB(255, 0, 0)
would set a pixel on the form at x = 100, y = 100, with red color.
simple and fast :)
Hope that helps.
Mushroom Realm
Aug 21st, 2002, 04:02 PM
which is faster/better setpixel or setpixelV currently i use setpixel
(what happened to setpixelII-IV
vinny
Aug 21st, 2002, 04:28 PM
why not just use bitblt to get areas of the picture you want it?
i find it faster then get/set pixel
Fox
Aug 21st, 2002, 06:09 PM
Because, when using BitBlt, you can't manipulate the pixels... the fastest method, however, would be to copy the picture into a Ayte array, manipulate, and copy it back.
Sastraxi
Aug 21st, 2002, 07:03 PM
SetPixelV stands for SetPixel that doesn't return the Value. :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.