* Don't use Graphics, use RGBSurface.
* Pre-compute loop limits. Don't do:
> for y = 0 to c1.height
> for x = 0 to c1.width
but
y1=c1.height
x1=c1.width
for y = 0 to y1
for x = 0 to x1
HTH
--
dda
http://sungnyemun.org/
RBDeveloper Columnist, "Beyond the Limits"
http://rbdeveloper.com
Liste Française Solutions RB
http://www.solutionsrb.com/
On 9/30/05, Jules <rb dot shareware at gmail dot com> wrote:
> Hi,
>
>
> Any ideas how I can speed up my image comparison code ?
> e.g. not using pixel(x,) ?
> I need diferences image.
>
> Heres my code...
>
> Window1.Canvas1.Paint:
>
> g.TextFont = "Arial"
> g.TextSize = 300
> g.DrawString "A",10,260
>
> Window1.Canvas2.Paint:
>
> g.TextFont = "Arial"
> g.TextSize = 300
> g.DrawString "B",150,260
> g.DrawString "A",10,260
>
> Window1.btnCompare.Action:
>
>
> dim c1 as graphics = canvas1.graphics
> dim c2 as graphics = canvas2.graphics
> dim x as double
> dim y as double
>
> 'dim pic as picture
> 'pic = newpicture(c1.height,c1.width,32)
>
> for y = 0 to c1.height
> for x = 0 to c1.width
> if c1.pixel(x,y) <> c2.pixel(x,y) then
> 'pic.graphics.pixel(x,y) = c2.pixel(x,y)
> canvas3.graphics.pixel(x,y) = c2.pixel(x,y)
> end if
> next x
> next y
>
> 'canvas3.graphics.drawpicture pic,0,0
> canvas3.graphics.drawRect 0,0, canvas3.graphics.width,
> canvas3.graphics.height
>
> End Sub
>
> I've seen the "Component X Graphics, CXG_Difference" but it makes the
> difference image red
> I've also see a PictToString function which uses MacPictColumn, but that
> doesn't work for me, posible because of my RB 5.5 standard license.
>
> Thanks.
>
> Jules.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|