diff --git a/app/Operations/BinaryMaskOp.cpp b/app/Operations/BinaryMaskOp.cpp index 3536e4bda1a0832027d05458b29d6b609b2ba2d7..dd4ef225d54eea08ca5c62d9ad78d224f5540cef 100644 --- a/app/Operations/BinaryMaskOp.cpp +++ b/app/Operations/BinaryMaskOp.cpp @@ -27,7 +27,7 @@ using namespace std; using namespace imagein; using namespace genericinterface; -BinaryMaskOp::BinaryMaskOp() : GenericOperation(qApp->translate("Operations", "Apply mask").toStdString()) +BinaryMaskOp::BinaryMaskOp() : GenericOperation(qApp->translate("BinaryMaskOp", "Apply mask").toStdString()) { } @@ -60,7 +60,7 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd, dialog->setWindowTitle(currentImgName); auto* layout = new QFormLayout(dialog); auto* imgBox = new MixImageListBox(dialog, currentImgName.toStdString(), stdImgList, dblImgList); - layout->insertRow(0, tr("Mask to apply : "), imgBox); + layout->insertRow(0, qApp->translate("BinaryMaskOp","Mask to apply : "), imgBox); auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, dialog); layout->insertRow(1, buttonBox); QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); diff --git a/app/Operations/ColorDialog.cpp b/app/Operations/ColorDialog.cpp index b57c1060fcb2fbcb98f411ab73e3ecb2becc2824..f7c15fff05957ebc41400e543be42ce219251b3f 100644 --- a/app/Operations/ColorDialog.cpp +++ b/app/Operations/ColorDialog.cpp @@ -60,14 +60,35 @@ unsigned int ColorDialog::getHeight() const { } void ColorDialog::getHint() { -// QDialog* hint = new QDialog(QApplication::activeWindow()); -// hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip for Qt HSV Color Model"))); -// hint->setLayout(new QVBoxLayout); -// QLabel* pic = new QLabel(hint); -// pic->setPixmap(QPixmap(":/images/qcolor-hsv.png")); - -// hint->resize(500,500); -// pic->resize(hint->size()); -// hint->show(); - emit needHint(); + auto* hint = new QDialog(QApplication::activeWindow()); + hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip"))); + + // Créer une disposition verticale pour le QDialog + auto* mainLayout = new QVBoxLayout(hint); + + auto* huePic = new QLabel(hint); + huePic->setPixmap(QPixmap(":/img/qcolor_hsv.png")); + + auto* hueLabel = new QLabel("<b>Hue</b> is the dominant color from 0 to 359 degrees on the color wheel bellow <br>", hint); + + auto* satuPic = new QLabel(hint); + satuPic->setPixmap(QPixmap(":/img/qcolor-saturation.png")); + + auto* satuLabel = new QLabel("<b>Saturation</b> is in the range 0 to 255 and refers to the vividness of the color <br>", hint); + + auto* valuePic = new QLabel(hint); + valuePic->setPixmap(QPixmap(":/img/qcolor-value.png")); + + auto* valueLabel = new QLabel("<b>Value</b> is in the range 0 to 255 and represents the brightness of the color <br>", hint); + + // Ajouter les QLabel à la disposition principale + mainLayout->addWidget(hueLabel); + mainLayout->addWidget(huePic); + mainLayout->addWidget(satuLabel); + mainLayout->addWidget(satuPic); + mainLayout->addWidget(valueLabel); + mainLayout->addWidget(valuePic); + + // Afficher le QDialog + hint->show(); } diff --git a/app/Operations/ColorDialog.h b/app/Operations/ColorDialog.h index 33c97c07025599a6c82328da62d28bf31be22c72..03531fffcd74400882053ab96bb44688e1af45f9 100644 --- a/app/Operations/ColorDialog.h +++ b/app/Operations/ColorDialog.h @@ -40,8 +40,6 @@ public: unsigned int getHeight() const; public slots: void getHint(); -signals: - void needHint(); private: Ui::ColorDialog *ui; diff --git a/app/Operations/ColorimetryOp.cpp b/app/Operations/ColorimetryOp.cpp index 8e0bcc72273a0d421bc5744618acd62c90ca2724..6ab87e14ff5820da0eeb82c27dcb50ae9486e9d1 100644 --- a/app/Operations/ColorimetryOp.cpp +++ b/app/Operations/ColorimetryOp.cpp @@ -44,7 +44,6 @@ void ColorimetryOp::operator()(const imagein::Image*, const std::map<const image ColorDialog* dialog = new ColorDialog(QApplication::activeWindow()); dialog->setWindowTitle(QString(qApp->translate("Operations", "RGB/HSV image generator"))); - QObject::connect(dialog, SIGNAL(needHint()), this, SLOT(giveHint())); QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec()); QColor color = dialog->getColor(); @@ -81,20 +80,4 @@ void ColorimetryOp::operator()(const imagein::Image*, const std::map<const image } } outImage(resImg, "RGB Image"); -} - -void ColorimetryOp::giveHint(){ - - QDialog* hint = new QDialog(QApplication::activeWindow()); - hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip"))); - hint->setLayout(new QVBoxLayout); - QLabel* pic = new QLabel(hint); - pic->setPixmap(QPixmap(":/img/qcolor_hsv.png")); - hint->resize(320,280); - pic->resize(hint->size()); - hint->show(); - std::string outputMessage1 = qApp->translate("ColorimetryOp","H, for hue, is in the range 0 to 359. Red is 0 (degrees), green is 120, and blue is 240 as shown by the pop-up image.\n\n").toStdString(); - std::string outputMessage2 = qApp->translate("ColorimetryOp","S, for saturation, is in the range 0 to 255, and the bigger it is, the stronger the color is.\n\n").toStdString(); - std::string outputMessage3 = qApp->translate("ColorimetryOp","V, for value, is in the range 0 to 255 and represents lightness or brightness of the color, 0 represents for black.\n\n-------------------------------------------").toStdString(); - outText(outputMessage1+outputMessage2+outputMessage3); -} +} \ No newline at end of file diff --git a/app/Operations/ColorimetryOp.h b/app/Operations/ColorimetryOp.h index 4f8d7c69efda0eb23618d7dfb3acca6196a81fec..1e2206cc186846ccc13ae6db1b125bc0291f4b46 100644 --- a/app/Operations/ColorimetryOp.h +++ b/app/Operations/ColorimetryOp.h @@ -24,17 +24,12 @@ class ColorimetryOp : public Operation { - Q_OBJECT public: ColorimetryOp(); void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&); bool needCurrentImg() const; - -public slots: - void giveHint(); - }; #endif // COLORIMETRYOP_H diff --git a/app/Operations/ScalingOp.cpp b/app/Operations/ScalingOp.cpp index 0abe3fc522a9baaded928448846c57829f60168d..5a54d4a03c3703b53a982867e670aadcd76c6ec7 100644 --- a/app/Operations/ScalingOp.cpp +++ b/app/Operations/ScalingOp.cpp @@ -65,21 +65,22 @@ void ScalingOp::operator()(const genericinterface::ImageWindow* currentWnd, cons // QDoubleSpinBox* xScaleBoxN = new QDoubleSpinBox(); // QDoubleSpinBox* xScaleBoxD = new QDoubleSpinBox(); + QLineEdit* xScaleBoxN = new QLineEdit(); xScaleBoxN->setText("1"); - xScaleBoxN->setValidator(new QIntValidator(0, 100, this)); + xScaleBoxN->setValidator(new QIntValidator(0, 100)); QLineEdit* xScaleBoxD = new QLineEdit(); xScaleBoxD->setText("1"); - xScaleBoxD->setValidator(new QIntValidator(0, 100, this)); + xScaleBoxD->setValidator(new QIntValidator(0, 100)); // QDoubleSpinBox* yScaleBoxN = new QDoubleSpinBox(); // QDoubleSpinBox* yScaleBoxD = new QDoubleSpinBox(); QLineEdit* yScaleBoxN = new QLineEdit(); yScaleBoxN->setText("1"); - yScaleBoxN->setValidator(new QIntValidator(0, 100, this)); + yScaleBoxN->setValidator(new QIntValidator(0, 100)); QLineEdit* yScaleBoxD = new QLineEdit(); yScaleBoxD->setText("1"); - yScaleBoxD->setValidator(new QIntValidator(0, 100, this)); + yScaleBoxD->setValidator(new QIntValidator(0, 100)); // xScaleBox->setValue(1.0); // yScaleBox->setValue(1.0); diff --git a/app/Operations/SplitHsvOp.cpp b/app/Operations/SplitHsvOp.cpp index c046591c6aa0afef203f1b1c8c72a823afd0fa6c..98ec5b1503ca7c05842f4c05efb3973c42a9687f 100644 --- a/app/Operations/SplitHsvOp.cpp +++ b/app/Operations/SplitHsvOp.cpp @@ -53,15 +53,22 @@ void SplitHsvOp:: operator()(const imagein::Image* image, const std::map<const i for(unsigned int i = 0; i < width; i++) { for(unsigned int j = 0; j < height; j++) { QColor color = QColor(image->getPixel(i, j, 0), image->getPixel(i, j, 1), image->getPixel(i, j, 2)); - if(color.hue()<0) //Qt returns a hue value of -1 for achromatic colors - resImgH->setPixelAt(i,j,0); - else - resImgH->setPixelAt(i,j,color.hue()); + + /* Hue = -1 <-- R = G = B + * Hue = (360°+60*(G-B)/(Max-Min))%360 <-- R = Max + * Hue = 120°+60°*(B-R)/(Max-Min) <-- G = Max + * Hue = 2400°+60°*(R-G)/(Max-Min) <-- B = Max */ + resImgH->setPixelAt(i,j,color.hue()); + + /* Saturation = 0 <-- Max = 0 + * Saturation = 255*(Max-Min)/Max <-- Max != 0 */ resImgS->setPixelAt(i,j,color.saturation()); + + /* Value = max */ resImgV->setPixelAt(i,j,color.value()); } } - this->outDoubleImage(resImgH, qApp->translate("Operations", "Hue").toStdString(),DISABLE, DISABLE,false); + this->outDoubleImage(resImgH, qApp->translate("Operations", "Hue").toStdString(),ENABLE, DISABLE,false,0,true); this->outDoubleImage(resImgS, qApp->translate("Operations", "Saturation").toStdString(),DISABLE, DISABLE,false); this->outDoubleImage(resImgV, qApp->translate("Operations", "Value").toStdString(),DISABLE, DISABLE,false); } diff --git a/app/imageinsa_app_res.qrc b/app/imageinsa_app_res.qrc index 5a2604f4d6bbc9e5bcecdcb96c47fd7157c3c35c..7376942123af601c851b5b8d7d2de74f91402db9 100644 --- a/app/imageinsa_app_res.qrc +++ b/app/imageinsa_app_res.qrc @@ -10,5 +10,7 @@ <file>img/arrow-top-left.png</file> <file>img/arrow-top-right.png</file> <file>img/qcolor_hsv.png</file> + <file>img/qcolor-saturation.png</file> + <file>img/qcolor-value.png</file> </qresource> </RCC> diff --git a/app/img/qcolor-saturation.png b/app/img/qcolor-saturation.png new file mode 100644 index 0000000000000000000000000000000000000000..5b57ae27550b229be5c04cfc4ae79759f67fba9b Binary files /dev/null and b/app/img/qcolor-saturation.png differ diff --git a/app/img/qcolor-value.png b/app/img/qcolor-value.png new file mode 100644 index 0000000000000000000000000000000000000000..0c9a98c5347989e09f52d082c69ce44319345f6c Binary files /dev/null and b/app/img/qcolor-value.png differ diff --git a/app/img/qcolor_hsv.png b/app/img/qcolor_hsv.png index 66b61d094a1327a7601196e878b2b7319ba1b7b7..b3d68adadbb48fd490a05f9922aa559e837e2ad2 100644 Binary files a/app/img/qcolor_hsv.png and b/app/img/qcolor_hsv.png differ diff --git a/core/Operation.h b/core/Operation.h index 546f4ba6a066d8c451ad1238c570ba535cbb32ec..070ec049f413d00a0d7ef1a7407d9c751899260f 100644 --- a/core/Operation.h +++ b/core/Operation.h @@ -22,13 +22,8 @@ #include <map> #include <string> -#include <QObject> -#include <QApplication> -#include <QString> #include "Image.h" -class QWidget; - namespace genericinterface { class ImageWindow; @@ -45,7 +40,7 @@ class WindowService; * For an exemple of a true generic operation class, see the PointOp implementation in imageinsa source code. */ -class GenericOperation : public QObject{ +class GenericOperation{ public: /**