Refactor 2022 #18

556.jpg

In this variation the colors are not blended. Where they would otherwise overlap, one color is selected, rather than trying to blend them.

For the nerds out there, the bug was one of those kind of bugs. Internally I represent each color channel by a (continuous) floating point value between 0 and 1. The graphics hardware and the bitmap file format uses (discrete) byte values between 0 and 255. So one must multiply or divide by 256, depending on direction, for conversion. At one point I wrote 255 instead of 256. I looked at that number many times and it did not occur to me that it was wrong. The small difference is barely noticeable.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.