Computer Science Canada

Something about whatdotcolor

Author:  KukuriChan [ Mon Mar 15, 2004 7:41 pm ]
Post subject:  Something about whatdotcolor

I just want to know whether or not it is possible to use whatdotcolor with pictures. Say, for example, if you put your mouse over a red section in the picture, it'll tell you that the colour is red.

Author:  Paul [ Mon Mar 15, 2004 7:52 pm ]
Post subject: 

I think so, like I tried with one of my pics:
code:

var gorilla := Pic.FileNew ("blower.bmp")
Pic.Draw (gorilla, 150, 70, picMerge)
var x, y, btn: int
loop
Mouse.Where (x, y, btn)
if btn=1 then
locate (1, 1)put whatdotcolor (x, y)
end if
end loop

it told me the color of where I was clicking.

Author:  Mazer [ Mon Mar 15, 2004 7:57 pm ]
Post subject: 

Yes. Somewhat.
Just a few things though: first, maybe you already know but just to make sure, whatdotcolour isn't going to say 'red', it'll give you a number (probably 12 depending on the shade of red). Second, turing can draw a picture (from a file) in whatever colour mode the picture is in, but it can only 'see' in 256 colours. So if you compare turing's red with a colour that is just slightly off-red, it'll still give you 12.

Author:  KukuriChan [ Mon Mar 15, 2004 8:03 pm ]
Post subject: 

Ok. I get it. Thanks! That helped a lot. But.... there's something wrong with the picture. Sad There's white spots all over the place.

Author:  Mazer [ Mon Mar 15, 2004 8:05 pm ]
Post subject: 

Hmm... you should explain further but my guess is you're using a JPG with a "white" background, trying maybe to draw it with picMerge. But you can't, because the JPG compression is terrible and you get lots of pixels that are off white.

Author:  KukuriChan [ Mon Mar 15, 2004 8:10 pm ]
Post subject: 

I did it with picMerge. That's the only reason there's white spots all over the place. ^^ So I tried it with picXor and there's no white spots now.
Thanks for the help Mazer. Smile


: