Re: Draw pixel
- From: "Mike Williams" <gagamomo@xxxxxxxxxxx>
- Date: 16 Mar 2007 22:32:31 -0700
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
.
- Follow-Ups:
- Re: Draw pixel
- From: Dan
- Re: Draw pixel
- References:
- Draw pixel
- From: Dan
- Re: Draw pixel
- From: BeastFish
- Re: Draw pixel
- From: Nigel Bufton
- Draw pixel
- Prev by Date: Re: Remote Desktop Launcher
- Next by Date: Re: Draw pixel
- Previous by thread: Re: Draw pixel
- Next by thread: Re: Draw pixel
- Index(es):
Relevant Pages
|