Re: Draw pixel



On 16 Mar, 15:25, "Nigel Bufton" <n...@xxxxxxxxxx> wrote:

Given that pixel manipulation is time consuming
are there any data regarding the relative
performances of . . .

.. . . by the way, in amplification of my last response, there are
circumstances where SetPixel/GetPixel is more than 10 per cent faster
than the native VB methods, but it is never "blindingly" faster. A lot
depends on whether you are drawing to a Picture Box or to a Form, and
whether Autoredraw is True or not. As far as drawing individual pixels
is concverned, in the case which displays the greatest speed
difference (usually when drawing to an Autoredraw Form) the API is up
to twice as fast as native VB and perhaps only one and a half times as
fast when drawing to an Autoredraw Picture Box. But then Autoredraw
causes VB to temporarily "go off checking other things" each time you
use one of its native drawing methods (which of course the API does
not need to do), so you would expect it to be slower when setting
individual pixels. But with Autoredraw set to False there is only
about the 10 per cent speed difference which I mentioned in my
previous response. In all cases, when dealing with a large block of
pixels on a "pixel by pixel" basis it is always orders of magnitude
faster to use the method I suggested earlier and deal with the pixel
data in a standard VB array. By the way, there was a time (before VB5
SP3 I think, but I'm not sure) when there was a problem with Pset
which slowed it down a lot, but that problem was later fixed and so
you'll only notice it if you are using a very old and out of date copy
of VB. I only mention all of the above stuff really to point out that
you've always got to be a bit careful when testing the speed of
graphics code and you've got to make sure that you are taking
everything into account. For example, if you are drawing a very large
number of connected lines then a single call to the PolyLine API is
usually orders of magnitude faster than multiple calls to the LineTo
API to draw each line individually. However, under certain conditions
the speed difference is nowhere near as great, and under some
conditions the PolyLine API is actually slower than multiple calls to
the LineTo API.

Mike




.



Relevant Pages

  • Re: Positioning ouput on printed pages
    ... > appropriate values from GetDeviceCaps and then setting the Printer Object's ... > when using native VB printer object drawing methods, because the API ... > Private Const PHYSICALOFFSETX As Long = 112 ...
    (microsoft.public.vb.general.discussion)
  • Re: Problem with SavePicture, and a question on new versions
    ... > mode does not have to be in pixels. ... 500 pixels then the picture box will also be 700 x 500 pixels. ... and the bitmap shows ... to be *smaller* than the scale units that the BitBlt API is using ...
    (comp.lang.basic.visual.misc)
  • Re: Fast 2D Raster Rendering with GUI
    ... am stuck on what graphics API to use. ... I started looking at PyGame but realize that I need to integrate a GUI ... extensions for drawing and image manipulation. ...
    (comp.lang.python)
  • Re: Apple II VGA Video Generator Card Project
    ... of the frame buffer, so all line drawing will take longer. ... 1.- It takes n times longer to draw n*x pixels as it takes to draw x ... that provide either more resolution or more color depth or both. ...
    (comp.sys.apple2)
  • Re: drawings
    ... equivalent value in pixels. ... the API equivalent of a VB User Scalemode. ... Private Declare Function SetViewportOrgEx Lib "gdi32" _ ... Dim OldWindowExt As POINTAPI ...
    (microsoft.public.vb.general.discussion)