Matched HSVRGB to video
This commit is contained in:
parent
642b873704
commit
8fd16f569c
@ -44,6 +44,8 @@ MyWindow::MyWindow(QWidget *parent) :
|
||||
// i wysokosci. Ustawiamy format bitmapy na 32 bitowe RGB
|
||||
// (0xffRRGGBB).
|
||||
img = new QImage(szer,wys,QImage::Format_RGB32);
|
||||
|
||||
DrawG(0);
|
||||
}
|
||||
|
||||
// Definicja destruktora
|
||||
@ -151,8 +153,8 @@ void MyWindow::DrawR(int r){
|
||||
unsigned char* ptr = img->bits();
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
int b = ((float) i / img->width()) * 255.0f;
|
||||
int g = ((float) j / img->height()) * 255.0f;
|
||||
int b = (((float) i / img->width())) * 255.0f;
|
||||
int g = (1.0f - ((float) j / img->height())) * 255.0f;
|
||||
DrawPixel(img, i, j, QColor(r, g, b));
|
||||
}
|
||||
}
|
||||
@ -163,8 +165,8 @@ void MyWindow::DrawG(int g){
|
||||
unsigned char* ptr = img->bits();
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
int b = ((float) i / img->width()) * 255.0f;
|
||||
int r = ((float) j / img->height()) * 255.0f;
|
||||
int r = ((float) i / img->width()) * 255.0f;
|
||||
int b = (1.0f - ((float) j / img->height())) * 255.0f;
|
||||
DrawPixel(img, i, j, QColor(r, g, b));
|
||||
}
|
||||
}
|
||||
@ -176,7 +178,7 @@ void MyWindow::DrawB(int b){
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
int g = ((float) i / img->width()) * 255.0f;
|
||||
int r = ((float) j / img->height()) * 255.0f;
|
||||
int r = (1.0f - ((float) j / img->height())) * 255.0f;
|
||||
DrawPixel(img, i, j, QColor(r, g, b));
|
||||
}
|
||||
}
|
||||
@ -188,8 +190,8 @@ void MyWindow::DrawH(float h){
|
||||
unsigned char* ptr = img->bits();
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
float s = ((float) i / img->width());
|
||||
float v = ((float) j / img->height());
|
||||
float v = ((float) i / img->width());
|
||||
float s = (1.0f - ((float) j / img->height()));
|
||||
DrawPixel(img, i, j, HSVtoRGB(h, s, v));
|
||||
}
|
||||
}
|
||||
@ -201,7 +203,7 @@ void MyWindow::DrawS(float s){
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
float h = ((float) i / img->width());
|
||||
float v = ((float) j / img->height());
|
||||
float v = (1.0f - ((float) j / img->height()));
|
||||
DrawPixel(img, i, j, HSVtoRGB(h, s, v));
|
||||
}
|
||||
}
|
||||
@ -213,7 +215,7 @@ void MyWindow::DrawV(float v){
|
||||
for(int i = 0; i < img->width(); i++){
|
||||
for(int j = 0; j < img->height(); j++){
|
||||
float h = ((float) i / img->width());
|
||||
float s = ((float) j / img->height());
|
||||
float s = (1.0f - ((float) j / img->height()));
|
||||
DrawPixel(img, i, j, HSVtoRGB(h, s, v));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user