You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears the bug from "Programming in C in 2022" is still present.
This is because when blending colours you use the alpha value of the "incoming" colour to calculate the new blended RGB colour components for the pixel, but the alpha component of the pixel is never updated.
So if the canvas initially starts filled with zeroes, then each pixel will always have alpha 0. And blended colour writes will never modify this. So the final exported image will have the correct R/G/B values, but always have alpha 0 in every pixel.
You probably want to "accumulate" the alpha from both the current colour on the canvas, and the "incoming" colour. For example, if the canvas contains a pixel with 25% alpha, and you draw a pixel with 50% alpha on top, the resulting alpha should be greater than 25%. But the current code will never modify it.
The text was updated successfully, but these errors were encountered:
It appears the bug from "Programming in C in 2022" is still present.
This is because when blending colours you use the alpha value of the "incoming" colour to calculate the new blended RGB colour components for the pixel, but the alpha component of the pixel is never updated.
So if the canvas initially starts filled with zeroes, then each pixel will always have alpha 0. And blended colour writes will never modify this. So the final exported image will have the correct R/G/B values, but always have alpha 0 in every pixel.
You probably want to "accumulate" the alpha from both the current colour on the canvas, and the "incoming" colour. For example, if the canvas contains a pixel with 25% alpha, and you draw a pixel with 50% alpha on top, the resulting alpha should be greater than 25%. But the current code will never modify it.
The text was updated successfully, but these errors were encountered: