Computer Science Canada

16 million colors, how?

Author:  Nitro [ Thu Jun 26, 2003 1:58 pm ]
Post subject:  16 million colors, how?

I know its possible to assign new colors using RGB values, but is it possible to turn Turing from 256 to 16 million colors?

Author:  Homer_simpson [ Thu Jun 26, 2003 2:06 pm ]
Post subject: 

yeah... well... u know when u use 16 million colors u dont really enter a number for the color that your using for example u dont say color(26626316)
you use RGB mode so you say color(15,100,1) so u get a color... so ya u can have a lotta colors in turing if you create the color that you want right when u wanna use it...

Author:  Nitro [ Thu Jun 26, 2003 3:15 pm ]
Post subject:  hmmmm

it seems to cut me off at a max of 1024 colors...odd. why only 2^10?

Author:  PaddyLong [ Thu Jun 26, 2003 3:38 pm ]
Post subject: 

something along the lines of this would probably do it...

code:

var pallete : flexible array 0 .. 0 of int
var count : int := 0

for r : 0 .. 255
    for g : 0 .. 255
        for b : 0 .. 255
            new pallete, count
            pallete (count) := RGB.AddColour (r / 255, g / 255, b / 255)
            count += 1
        end for
    end for
end for


unfortunately though, I don't think Turing can handle arrays of that size so maybe just do like ever second thing (just add by 2 to each of the for statements... ie for r : 0 .. 255 by 2)

Author:  Homer_simpson [ Thu Jun 26, 2003 3:41 pm ]
Post subject: 

hells no you can't declare all those colors and put the in an array... so just create the colors u need for example if you need light red just create a color with thse numbers(128,0,0)...

Author:  PaddyLong [ Thu Jun 26, 2003 3:42 pm ]
Post subject: 

yeah lol... not really practical to just store all those colours like that Very Happy but if you ever did want to... that would work ;D

Author:  Homer_simpson [ Thu Jun 26, 2003 3:53 pm ]
Post subject: 

here's an example :
code:
const size := 1
var clr : int
for j : 1 .. 400
    for i : 1 .. 600
        clr := RGB.AddColor (i / 600, j / 400, j / 100)
        drawfillbox ((i * size), (j * size), (i * size) + size, (j * size) + size, clr)
    end for
end for

wheee look at all those pretty colors...

Author:  Catalyst [ Thu Jun 26, 2003 4:14 pm ]
Post subject: 

mmm colors

code:

View.Set ("graphics:400;400,nobuttonbar,position:300;300")
function putRGB (r, g, b : real) : int
        RGB.SetColor (255, r, g, b)
        result 255
end putRGB
function Distance (x1, y1, x2, y2 : real) : real
        result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
end Distance
const mx := maxx div 2
const my := maxy div 2
var x, y : array 1 .. 3 of int
x (1) := mx-100
y (1) := my-100
x (2) := mx+100
y (2) := my-100
x (3) := mx
y (3) := my+141
const dist1 := Distance (x (1), y (1), maxx div 2, maxy div 2)
const dist2 := Distance (x (2), y (2), maxx div 2, maxy div 2)
const dist3 := Distance (x (3), y (3), maxx div 2, maxy div 2)
for i : 1 .. maxx
    for k : 1 .. maxy
        drawdot (i, k, putRGB ((Distance (i, k, x (2), y (2)) / dist2), (Distance (i, k, x (1), y (1)) / dist1), (Distance (i, k, x (3), y (3)) / dist3)))
    end for
end for

Author:  Nitro [ Thu Jun 26, 2003 9:40 pm ]
Post subject:  My purpose?

I wanted to find a way to create a transition between with 24bit bitmap images, one fading out while the other was fading in.

Author:  Asok [ Fri Jun 27, 2003 1:42 am ]
Post subject: 

that can be done with picMerge and masks I think. (use grey scale masks to fade in/out)


: