Computer Science Canada

Getting individual RGB values for a pixel on screen

Author:  smool [ Fri Jan 13, 2012 11:12 pm ]
Post subject:  Getting individual RGB values for a pixel on screen

Is there a way to get the individual RGB values of a pixel on screen?
I know of What.Color, but that only returns 1 integer, and i need the 3 seperate RGB values

Author:  DemonWasp [ Sat Jan 14, 2012 12:30 am ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

If you know the colour index, then you can get the red/green/blue values by using RGB.GetColor : http://compsci.ca/holtsoft/doc/rgb_getcolor.html

Author:  mirhagk [ Sat Jan 14, 2012 10:06 am ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

Specifically you'd do something like:

Turing:

var red:int
var green:int
var blue:int
RGB.GetColor(whatdotcolor(x,y),red,green,blue)

Author:  smool [ Sat Jan 14, 2012 11:45 am ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

Sweet thanks

Author:  mirhagk [ Sat Jan 14, 2012 12:26 pm ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

May I ask what you are doing this for? Working with RGB values implies some high quality graphical work, which turing may not be able to handle.

Author:  Dreadnought [ Sat Jan 14, 2012 1:52 pm ]
Post subject:  Re: Getting individual RGB values for a pixel on screen

It should be noted that whatdotcolour does not return the exact colour of a pixels on screen. It actually returns an approximation to one of the Turing colours (the 248 of them).

Depending on what you're doing this may or may not bother you.

If it does, here's a tutorial that allows you to get the actual RGB values of a pixel. http://compsci.ca/v3/viewtopic.php?t=29867

Author:  smool [ Sun Jan 15, 2012 12:50 pm ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

Thanks for the link Dreadnought, I didn't know whatdotcolour did that, that's useful.

mirhagk, basically I would just like to try supersampling. Only for on image, as there is no way turing could pull off supersampling or even multisampling at even a semi decent frame rate.

Author:  mirhagk [ Sun Jan 15, 2012 9:41 pm ]
Post subject:  RE:Getting individual RGB values for a pixel on screen

Do you perhaps know any other languages? I could get you started with the bare minimum needed to load in a picture and draw it to the screen in C# with XNA, and you could actually try to do it in the shader. Although that might be difficult.


: