MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / UpdateChannelSliderBackground

Method UpdateChannelSliderBackground

Xaml/Controls/ColorPicker.cpp:1203–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201 }
1202
1203 void ColorPicker::UpdateChannelSliderBackground(const ColorPickerSlider &slider, txmp::ColorChannel channel, txmp::ColorRepresentation representation)
1204 {
1205 if (slider)
1206 {
1207 // Regardless of the active color representation, the sliders always use HSV
1208 // Therefore, always calculate HSV color here
1209 // Warning: Always maintain/use HSV information in the saved HSV color
1210 // This avoids loss of precision and drift caused by continuously converting to/from RGB
1211 if (!m_SavedHsvColor)
1212 {
1213 const auto rgbColor = Color();
1214
1215 m_SavedHsvColor = Util::Color(rgbColor).ToHSV();
1216 m_SavedHsvColorRgbEquivalent = rgbColor;
1217 }
1218
1219 slider.IsAutoUpdatingEnabled(false);
1220 slider.ColorChannel(channel);
1221 slider.ColorRepresentation(representation);
1222 slider.HsvColor(*m_SavedHsvColor);
1223 slider.UpdateColors();
1224 }
1225 }
1226
1227 void ColorPicker::UpdateCustomPalette()
1228 {

Callers

nothing calls this directly

Calls 4

ColorClass · 0.85
ToHSVMethod · 0.80
HsvColorMethod · 0.80
UpdateColorsMethod · 0.80

Tested by

no test coverage detected