Fixed HSVRGB
This commit is contained in:
parent
6baeaa1dcd
commit
642b873704
@ -105,7 +105,7 @@ void MyWindow::paintEvent(QPaintEvent*)
|
|||||||
QColor HSVtoRGB(float H, float S, float V){
|
QColor HSVtoRGB(float H, float S, float V){
|
||||||
float C = V * S;
|
float C = V * S;
|
||||||
float HP = (H * 360)/60.0f;
|
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 M = V - C;
|
||||||
float red = 0, green = 0, blue = 0;
|
float red = 0, green = 0, blue = 0;
|
||||||
if(HP >=0 && HP <=1){
|
if(HP >=0 && HP <=1){
|
||||||
@ -131,7 +131,7 @@ QColor HSVtoRGB(float H, float S, float V){
|
|||||||
green+=M;
|
green+=M;
|
||||||
blue+=M;
|
blue+=M;
|
||||||
|
|
||||||
return QColor(red, green, blue);
|
return QColor((int)(red*255.0f), (int)(green*255.0f), (int)(blue*255.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user