protected static float FixOpacityValue(float value) { const float max = 1.0f; const float min = 0.0f; return Math.Min(Math.Max(value, min), max); }