Fixed HSVRGB

This commit is contained in:
Dawid Pietrykowski 2023-04-16 19:42:12 +02:00
parent 6baeaa1dcd
commit 642b873704

View File

@ -105,7 +105,7 @@ void MyWindow::paintEvent(QPaintEvent*)
QColor HSVtoRGB(float H, float S, float V){
float C = V * S;
float HP = (H * 360)/60.0f;
float X = C*(1 - abs( fmod(HP, 2)-1));
float X = C*(1.0f - abs( fmod(HP, 2.0f)-1.0f));
float M = V - C;
float red = 0, green = 0, blue = 0;
if(HP >=0 && HP <=1){
@ -131,7 +131,7 @@ QColor HSVtoRGB(float H, float S, float V){
green+=M;
blue+=M;
return QColor(red, green, blue);
return QColor((int)(red*255.0f), (int)(green*255.0f), (int)(blue*255.0f));
}