Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Edited Issue: Several bugs in ColorPicker code [22416]

$
0
0
There are several bugs in ColorPicker source code.
\src\xceed.wpf.toolkit\core\utilities\colorutilities.cs
```
public static HsvColor ConvertRgbToHsv( int r, int b, int g ) – b and g parameters are swapped that cause incorrect conversion.
```

That will lead to changes in \src\xceed.wpf.toolkit\colorcanvas\implementation\colorcanvas.cs
```
private void UpdateColorShadeSelectorPosition( Color? color )


HsvColor hsv = ColorUtilities.ConvertRgbToHsv( color.Value.R, color.Value.G, color.Value.B );

if( _updateSpectrumSliderValue )
{
_spectrumSlider.Value = 360 - hsv.H; // here 360 -
}
```


Also generation of spectrum have bug \Src\Xceed.Wpf.Toolkit\ColorCanvas\Implementation\ColorSpectrumSlider.cs

```
private void CreateSpectrum()

List<Color> colorsList = ColorUtilities.GenerateHsvSpectrum();
double stopIncrement = ( double )1 / (colorsList.Count - 1); // Here colorsList.Count - 1
```

and ColorUtilities.GenerateHsvSpectrum have additional unnecessary gradient stops due to this bug. Code may be

```
public static List<Color> GenerateHsvSpectrum()
{
List<Color> colorsList = new List<Color>();

int hStep = 60;

for (int h = 0; h < 360; h += hStep)
{
colorsList.Add(ColorUtilities.ConvertHsvToRgb(h, 1, 1));
}
colorsList.Add(ColorUtilities.ConvertHsvToRgb(0, 1, 1));

return colorsList;
}
```

Or even make it in pure XAML…
Comments: ** Comment from web user: BoucherS **

Hi,

This will be fixed in v3.3.
Thanks !

――――
_Get more controls, features, updates and technical support with [Xceed Toolkit Plus for WPF](https://wpftoolkit.codeplex.com/wikipage?title=Compare%20Editions)_


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>