Skip to main content
GameDev.net gamedev.net
🔒 Locked

Sample RGB Values

Started by Voldron Jan 11, 2005 at 11:37 PM 2 replies 1k views
Original Post
Voldron
Voldron
I am trying to sample the color value of each channel in RGB from a pixel, is there any way to do this? Then I want to select the greater of the three and run a function that corrosponds with it. For instance if(red.value > green.value and blue.value) { red_run; }
Marlow Landscape
Marlow Landscape
Amm I didn't understand your point, could you tell me exactly what you want?
Do you want to obtain diferent colors you mean?
"You have tried and failed miserably, the lesson is, never try"-Homer J. Simpson.
Agony
Agony
Try using a union like this:

union u_Color{  D3DCOLOR c;  struct  {    BYTE b;    BYTE g;    BYTE r;    BYTE a;  };};BYTE MaxColorComponent(D3DCOLOR c){  u_Color Color;  Color.c = c;  BYTE Max = Color.r;  if (Color.g > Max)    Max = Color.g;  if (Color.b > Max)    Max = Color.b;  return Max;}
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.