
-----------------------------------
msimard8
Sat Oct 08, 2005 10:10 am

see through colors
-----------------------------------
Is there a way in turing where you  can draw a coloured box in which you can see through.

Thanks

-----------------------------------
Cervantes
Sat Oct 08, 2005 11:00 am


-----------------------------------
It won't actually be seethrough, but what you can do is average the RGB values of each pixel in the box with the RGB values of whatever is behind it.  You may need whatdotcolour for this, if you don't know the RGB values of what is behind the box.  
If you don't want a perfect 50% transparency, you'll have to do something different than simply average them.  You'd have to weight RGB values accordingly.

-----------------------------------
zylum
Sat Oct 08, 2005 9:09 pm


-----------------------------------
i would agree but the thing is, you would have to draw pixel by pixel... which means it will end up *very* slow...

View.Set ("graphics:250;250")
proc drawBox (x1, y1, x2, y2, c, a : int)
    var alpha1 : real := a / 100
    var alpha2 : real := 1 - alpha1
    var r1, g1, b1, r2, g2, b2 : real
    for x : x1 .. x2
        for y : y1 .. y2
            RGB.GetColor (c, r1, g1, b1)
            RGB.GetColor (whatdotcolor (x, y), r2, g2, b2)
            r1 := r1 * alpha1 + r2 * alpha2
            g1 := g1 * alpha1 + g2 * alpha2
            b1 := b1 * alpha1 + b2 * alpha2
            Draw.Dot (x, y, RGB.AddColor (r1, g1, b1))
        end for
    end for
end drawBox

for i : 1 .. 7
    Draw.FillBox (Rand.Int (1, maxx), Rand.Int (1, maxy), Rand.Int (1, maxx), Rand.Int (1, maxy), Rand.Int (1, maxcolor))
end for

drawBox (1, maxy div 2, maxx div 2, maxy, 7, 5)
drawBox (1, 1, maxx div 2, maxy div 2, 7, 25)
drawBox (maxx div 2, 1, maxx, maxy div 2, 7, 50)
drawBox (maxx div 2, maxy div 2, maxx, maxy, 7, 75)

-----------------------------------
Drakain Zeil
Mon Oct 10, 2005 10:15 am


-----------------------------------
kinda helpful:
http://www.fastgraph.com/help/alpha_blending.html
