Simple port of the base functions used in "ColorShifter-qt" to C#