realbasic-nug
[Top] [All Lists]

Re: Image differences, pic1, pic2 = pic 3

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Image differences, pic1, pic2 = pic 3
From: dda <headspin at gmail dot com>
Date: Fri, 30 Sep 2005 17:55:38 +0900
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JhKy6ko8hR1qt3xryqF1wub+H1HkoQq/x3XYKc7oIpBef7GCcnh3GBMMnUnmKn+LY2SdiZvezIuZO7S0fbj9yQdlQ+sVbN1j5qTI3mQLaVdFpHwp/l3saS39a2S7OeA2BgxFZLu6TcxvKIk1RYM53P2Xa78NiOCyyb1GJOeEYfQ=
References: <512b410f0509300108h3c4b3d82g82db008b5876eff7 at mail dot gmail dot com>
* 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>

<Prev in Thread] Current Thread [Next in Thread>