Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64426

Color mixing algorithms, like Blur, are not treating color values correctly

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.2
    • None
    • n/a

    Description

      Color values stored in computer's memory are in fact a square root of the original (real world) value. In order to mix the colors properly the values should be raised to the second power before the calculation and the result should be square rooted.

      Mixing algorithms are usually implemented with following formula:
      result = (color1 + color2) / 2

      The formula should be modified to:
      result = sqrt((color1^2 + color2^2) / 2)

      The wrong formula may be seen for example in FastBlur, so my suggestion is to implement the correct color mixing formula in Qt Graphical Effects.

       

      I am not sure whether the added complexity of the formula is worth the natural effect, but the natural effect could always be optional, not implemented in FastBlur, etc.

      I attach an example image which shows what I am talking about and project's source code.

      Differences are easily visible in the simple red/green image. The transition between colors is dark when using an incorrect mixing algorithm.
      It is less visible in more complex image, but the problem is still present. For example look at tall green plants at the right. In the wrong effect they seem to be thinner.

      Attachments

        1. blur_example.png
          495 kB
          Filip Hazubski
        2. color_mixing_project.7z
          613 kB
          Filip Hazubski
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            fhazubski Filip Hazubski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes