Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
alphablending
#1
I have two arrays, a smaller getter() array and a buffer() array. Curently this is my code to blend them

Code:
SUB alphaput(x as integer, y as integer, x2 as integer, y2 as integer, getarray() as integer, destinationarray() as integer)
   'this sub will place an image on the screen and blend it with the background
   'it will not draw or blend anything that is of colour 0
   FOR xx = x to x2
      y3 = 0
      for yy = y to y2
         b = POINT (x3, y3, getarray(0))
         IF b THEN
            a = point (xx, yy, destinationarray(0))
            r = (red(b) + red(a)) SHR 1
            g = (green(b) + green(a)) SHR 1
            b = (blue(b) + blue(a)) SHR 1
            pset destinationarray(0), (xx, yy), rgb(r,g,b)
         END IF
         y3 = y3 + 1
      next
      x3 = x3 + 1
   next
END SUB

FUNCTION red(colour as integer) as integer
   red = (colour SHR 16) mod 256
END FUNCTION

FUNCTION green(colour as integer) as integer
   green = (colour SHR 8) mod 256
END FUNCTION

FUNCTION blue(colour as integer) as integer
   blue = colour mod 256
END FUNCTION

Its painfully slow. Does anbody know of any way to improve it. I hope there is a lot that can be done.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply


Messages In This Thread
alphablending - by wallace - 11-10-2005, 12:59 AM
alphablending - by Z!re - 11-10-2005, 01:20 AM
alphablending - by wallace - 11-10-2005, 04:00 AM
alphablending - by d.j.peters - 11-10-2005, 04:26 AM
alphablending - by wallace - 11-10-2005, 06:02 AM
alphablending - by d.j.peters - 11-10-2005, 08:09 AM
alphablending - by wallace - 11-10-2005, 07:46 PM
alphablending - by lillo - 11-10-2005, 08:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)