You are not logged in.

#1 2011-04-08 23:01:58

bobby
Member

How to read color pixel on the screen

Hi all !!!

what the most simple trick to read and recover the color of a pixel in position x,y ?

GRRLIB GetPixelFromFB ( int x, int y ) ?

thanks !

Last edited by bobby (2011-04-08 23:08:27)

Offline

 

#2 2011-04-08 23:30:30

Crayon
Bad Mother Fucker

Re: How to read color pixel on the screen

Use GRRLIB_GetPixelFromFB to pick a pixel on the screen.

Offline

 

#3 2011-04-09 22:40:45

bobby
Member

Re: How to read color pixel on the screen

thanks Crayon !

Offline

 

#4 2011-04-11 18:16:42

bobby
Member

Re: How to read color pixel on the screen

fonction GRRLIB GetPixelFromFB return the color of a pixel in RGBA format
now, how can i extract the Green value (FA) in 0x40FA50FF for example ?

there is a fonction for just return one value like R, G or B ?

Offline

 

#5 2011-04-11 20:06:14

owen
Member

Re: How to read color pixel on the screen

Yes there are R(), G(), B() macros.  I had a similar problem here: http://grrlib.santo.fr/forum/viewtopic.php?id=335

Offline

 

#6 2011-04-11 22:38:14

bobby
Member

Re: How to read color pixel on the screen

je vais y jeter un oeil, merci Owen ;-)

Offline

 

#7 2011-04-20 17:12:27

bobby
Member

Re: How to read color pixel on the screen

en utilisant la macro du lien donné par Owen, je peux récupérer mes valeurs R V B, les modifier etc..

Par contre j'aimerais comprendre, la ligne : return RGBA(sr,sg,sb,A(color));
cette ligne doit normalement me retourner la couleur (color) modifiée précedement non ?

Offline

 

#8 2011-04-20 21:50:30

Crayon
Bad Mother Fucker

Offline

 

#9 2011-04-21 17:20:49

bobby
Member

Re: How to read color pixel on the screen

ok but i have a small problem

i use

Code:

GRRLIB_Plot(200, 200, 0xFF0000FF);

but i must use this coordinate to detect my red Pixel:

Code:

GRRLIB_GetPixelFromFB (199, 199) ;

if i take the same 200,200 as GRRLIB_Plot ,  the pixel is not detect.....
Why ?

Offline

 

#10 2011-04-21 18:34:54

Crayon
Bad Mother Fucker

Re: How to read color pixel on the screen

Try to use GRRLIB_SetPixelToFB instead of GRRLIB_Plot.

Offline

 

Board footer

Powered by FluxBB