I'm working on processing and I'd like to recreate on low level code the function blend lightest.
I saw in documentation that C = max(A * factor, B)
C
is the returned colorA
is the sourceB
is the image to mix with
I've seen on web that the factor specified is based on the alpha component of the source pixel, which is represented by the first 8 bits ( from the left ) of the 32-bit integer representing the pixel color. These leftmost bits are also referred to as the highest bits.
Source: this book, page 464
What should i think of it?
This is my code of that part:
for (int y = 0; y < capWidth * capHeight; y++) {
int factor = (pixels[y] >> 24) & 0xFF;
pixels[y] = max(pixels[y] * factor, previousFrame.pixels[y]);
}
That doesn't work, any help?