Re: AntiAlias Line Optimization

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Just about finished here, but I'm getting an out of bounds error on the array.

BPP = Depth \ 8
ArrayDataPos = (X * BPP) + ((Height - 1) - (Y * ScanLine))

Assuming I'm using the right scanline equation????
(((inWidth * inDepth) + &H1F) And Not &H1F&) \ &H8

If I'm looking for the bytelocation of x,y coordinates 10,20 in a 24-bit 400x400 image:
My equation becomes

arraydatapos = (10 * 3) + ((400-1)-(20*1200 ))

The result is a negative number, which cannot be a valid location in the array.

The scan-line multiplication was in the wrong place, try this version instead:

'***
DataPos = (X * BPP) + (((Height - 1) - Y) * ScanLine)
'***

Also, depending on your (and your users) graphics drivers you may get performance increases by using a 32-bit DIB, which
the hardware is more optimised to deal with.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.