How does the red() function work

i was just wondering what processing does so it can do red(colorObject) and return the red value of that color

A color is an integer number of 32 bits ordered as AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB where the A’s contain the alpha value, the R’s are the red value, G’s are green, and B’s are blue.
The red() function extracts the R component of this number and scales it to the colorMode() value.
If you are using the default colorMode 255 value, you can use bit shifting which makes it easier to understand how the individual colors are extracted. See:

Hello,

Resources:

You can also print these values:

There are references, tutorials and examples here:

processing.org

Not always easy to find stuff… enjoy the search and you learn along the way.

:)