writing and reading a line of picture points
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"
There is probly a faster way, however,
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.