RGB strikes again. Problems.
Author |
Message |
TheZsterBunny
|
Posted: Sun Apr 04, 2004 9:30 pm Post subject: RGB strikes again. Problems. |
|
|
code: |
for i : 0 .. 256
for j : 0 .. 256
drawdot (i + 50, j + 50, RGB.AddColor (i / 256, i / 256, j / 256))
end for
end for
|
This code should draw a box 256x256 px, with a blue top-left corner, yellow bottom-right, white top-right, and black bottom-left colors. these colors should blend evenly.
However it gets really screwy after the first line.
Mom wrote: Looks like chipped marble. but drugged.
Why is turing doing this, and can I free colors?
-bunny |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Jodo Yodo
|
Posted: Sun Apr 04, 2004 9:34 pm Post subject: (No subject) |
|
|
Yeah you're right, that's really weird. Perhaps it's because you're only altering Red and Blue will always be the same, and so it's screwing up the colours. But that's a really nice effect. |
|
|
|
|
|
TheZsterBunny
|
Posted: Sun Apr 04, 2004 9:40 pm Post subject: (No subject) |
|
|
Hey Dave; WRONG.
what was happening was the number of colors created exceeded turing's maximum, therefore it was attempting to reuse existing colors in its place.
I have modified the code to correct this issue
code: |
var cclr : int := 0
for i : 0 .. 256
for j : 0 .. 256
RGB.SetColor (cclr, i / 256, i / 256, j / 256)
drawdot (i + 50, j + 50, cclr)
end for
end for
|
Nice try.
BTW. do you troll this, i posted 5 mins ago
-bunny
oh, and the compsci clock has not been adjusted for the spring foreward as of last evening. |
|
|
|
|
|
Jodo Yodo
|
Posted: Sun Apr 04, 2004 9:48 pm Post subject: (No subject) |
|
|
I just happened to get on now. And stop being so harsh. Jah. |
|
|
|
|
|
TheZsterBunny
|
Posted: Sun Apr 11, 2004 5:08 pm Post subject: Gradientatron |
|
|
code: |
var r, g, b : array - 1 .. 1 of real
var colr : int := 255
proc avgcolor (x1, y1, x2, y2 : int)
RGB.GetColor (whatdotcolor (x1, y1), r (-1), g (-1), b (-1))
RGB.GetColor (whatdotcolor (x2, y2), r (1), g (1), b (1))
for i : x1 .. x2
RGB.SetColor (colr, (r (-1) * (i - x1)) + (r (1) * (x2 - i)) / (x2 - x1), (g (-1) * (i - x1)) + (g (1) * (x2 - i)) / (x2 - x1), (b (-1) * (i - x1)) + (b (1) * (x2 - i)) / (x2 - x1))
drawdot (i, y1, colr)
end for
end avgcolor
drawfillbox (50, 0, 100, 50, brightgreen)
drawfillbox (0, 0, 50, 50, brightred)
drawfillbox (50, 50, 100, 100, yellow)
drawfillbox (0, 50, 50, 100, brightblue)
loop
exit when hasch
end loop
for q : 0 .. 150
avgcolor (0, q, 100, q)
end for
|
Seemingly, this is a program which takes colors and gradientizes it, but not so. I am having some trouble with averaging the color. This is espeically evident when no colors are selected and we still get black.
What am I doing wrong?
-bunny
(let record show: JY replies in 5 mins) |
|
|
|
|
|
|
|