Review Request 108709: in KisPlainColorSource equally distribute mix factor between values [0..255]

Friedrich W. H. Kossebau kossebau at kde.org
Sat Feb 2 03:30:05 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/108709/
-----------------------------------------------------------

Review request for Calligra and Boudewijn Rempt.


Description
-------

While I just wanted to fix the warning about "(qint16)255 - weight" possibly being out-of-range, I wondered if the calculation of the parts of the colors being mixed in is behaving like wanted.
The old code "(int)(mix * 255)" will map to "0" for values of mix in the range of [0..1/255[, while it will only map to 255 when mix is exactly 1.0.
Which gives the foreground color less power than the background color in average here.

Attached patch fixes that by using the formula "int(mix * 256)" which distributes the values [0.0..1.0[ equally to the range [0..255], with the exception of 1.0, which would be 256, but that can be catched.

The proposed algorithm might be more correct, but has the problem that any stored settings of the mix value would result in slight color changes. No idea if that can happen, your call.

Any better algorithm?

If okay, okay to also backport to 2.6?


Diffs
-----

  krita/plugins/paintops/libpaintop/kis_color_source.cpp fe19834 

Diff: http://git.reviewboard.kde.org/r/108709/diff/


Testing
-------


Thanks,

Friedrich W. H. Kossebau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130202/03abd63f/attachment.htm>


More information about the calligra-devel mailing list