|
Author |
Topic: How can I get the R, G or B from a color datatype (Read 1914 times) |
|
javito
|
How can I get the R, G or B from a color datatype
« on: Aug 13th, 2003, 8:16pm » |
|
Hi I?m trying to get the R, G or B value as a integer from a single pixel of a image, how can i get it? I need to get only one of these values and store as a integer. Thank you very much and sorry about my english..
|
Javi Burón
|
|
|
arielm
|
Re: How can I get the R, G or B from a color datat
« Reply #1 on: Aug 13th, 2003, 9:05pm » |
|
not tested but should work: Code: int p = pixels[1234]; // p is holding something like #00ffc033 int r = (p >> 16) & 0x000000ff; int g = (p >> 8) & 0x000000ff; int b = p & 0x000000ff; |
|
|
Ariel Malka | www.chronotext.org
|
|
|
javito
|
Re: How can I get the R, G or B from a color datat
« Reply #3 on: Aug 14th, 2003, 9:33pm » |
|
Thank you very much!!!!!
|
Javi Burón
|
|
|
|