get(x,y) returns large #

ok so i get(x,y) and print x,y and c on screen , x and y are correct, but i get -largenumber

color c=get(x,y); print(x,y,c);

i get for example: 223 160 -2171170

Tagged:

Answers

  • That is correct. A Processing color is actually a 32 bit integer behind the scenes but interpreted in a special way: the first 8 bits are the alpha channel, the next 8 bits are red, the next 8 green and the last 8 blue. But if you try to print out a color, it will get interpreted as an integer and printed as such. You could try using the hex() method to get a more readable version of the colour: https://processing.org/reference/hex_.html

  • Answer ✓

    You're printing a color. The color is stored as an integer. When you print the color using print(), it will print the value of that color as an integer.

    Colors are made up of different amounts of red, green, and blue... Maybe you would get more meaningful information about your color if you printed out red(c), green(c), and blue(c).

Sign In or Register to comment.