Roundiing difference

Started by Iconshow, December 12, 2015, 12:14:29 PM

Previous topic - Next topic



You have written a great tool. The tool offers great possibilities to adjust color values.

I've tested first ColorPicker Version 1.02.
If I change the values of a Colorbar, the values of the other two Colorbars be affected. I was searching for the mistake and think I've found the cause. In module HSLColors in ToRgbColor function rounding errors may occur. At the end of the routine Colors is multiplied by the 255.

Color [color] * = 255;

After changing the command line, the values of the two Colorbars will no longer be changed.

Color [color] = Math.Round (Color [color] * 255d);

In the version 1.05, the error no longer occurs because the RGB values are stored in a separate variable. But when converting an HSL value but it can still lead to a rounding difference.

Ciao J├╝rgen

Richard Moss


Thanks for taking the time to investigate this issue and let me know of a solution! I've committed your fix to the GitHub repository, although I haven't updated the NuGet package yet as that sync included another commit I haven't fully tested.

Thank you again.

Richard Moss
Read "Before You Post" before posting. Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.