I am using the raylib and it uses the 32 bit RGBA colours. I searched in a cheatsheet, but I could not find any appropriate routine. What I want to do is multiply two colours as if they were vec4
s in opengl (each channel ranging from 0 to 1). I actually already successfully
performed the multiplication but it is rather slow operation involving lot of floating point arithmetic for something so simple:
uint8_t multiplyBytes(uint8_t a, uint8_t b) {
const float invertedByte = 1/255.0;
return (uint8_t)(((a * invertedByte) * (b * invertedByte)) * 255.0);
}
My question is if there is better way to do this? Or I should stick with this solution?