Frei0rColoradjWidget::Frei0rColoradjWidget(Mlt::Filter filter, bool setDefaults, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Frei0rColoradjWidget),
    m_filter(filter)
{
    ui->setupUi(this);
    ui->keepLumaCheckBox->hide();
    m_defaultAction = 0.5;
    m_defaultLuma = false;
    m_defaultRGB = QColor::fromRgbF(0.5, 0.5, 0.5);
    if (setDefaults) {
        ui->modeComboBox->setCurrentIndex(2 * m_defaultAction);
        ui->keepLumaCheckBox->setChecked(m_defaultLuma);
        ui->wheel->setColor(m_defaultRGB);
        m_filter.set(kParamAction, m_defaultAction);
        m_filter.set(kParamKeepLuma, m_defaultLuma? 1 : 0);
        m_filter.set(kParamRed, m_defaultRGB.redF());
        m_filter.set(kParamGreen, m_defaultRGB.greenF());
        m_filter.set(kParamBlue, m_defaultRGB.blueF());
        ui->preset->saveDefaultPreset(m_filter);
    } else {
        ui->modeComboBox->setCurrentIndex(2 * filter.get_double(kParamAction));
        ui->keepLumaCheckBox->setChecked(filter.get_int(kParamKeepLuma));
        ui->wheel->setColor(QColor::fromRgbF(filter.get_double(kParamRed),
                                             filter.get_double(kParamGreen),
                                             filter.get_double(kParamBlue)));
    }
    ui->preset->loadPresets();
    m_filter.set(kParamLumaFormula,
                 (MLT.profile().colorspace() == 709? kLumaFormula709 : kLumaFormula601));
}
Beispiel #2
0
MovitColorFilter::MovitColorFilter(Mlt::Filter filter, bool setDefaults, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MovitColorFilter),
    m_filter(filter)
{
    ui->setupUi(this);
    Mlt::Filter f(MLT.profile(), "movit.lift_gamma_gain");
    m_liftDefault = QColor::fromRgbF(f.get_double("lift_r"),
                                     f.get_double("lift_g"),
                                     f.get_double("lift_b"));
    m_gammaDefault = QColor::fromRgbF(f.get_double("gamma_r") / GAMMA_FACTOR,
                                      f.get_double("gamma_g") / GAMMA_FACTOR,
                                      f.get_double("gamma_b") / GAMMA_FACTOR);
    m_gainDefault = QColor::fromRgbF(f.get_double("gain_r") / GAIN_FACTOR,
                                     f.get_double("gain_g") / GAIN_FACTOR,
                                     f.get_double("gain_b") / GAIN_FACTOR);
    if (setDefaults) {
        ui->liftWheel->setColor(m_liftDefault);
        ui->gammaWheel->setColor(m_gammaDefault);
        ui->gainWheel->setColor(m_gainDefault);
        ui->preset->saveDefaultPreset(m_filter);
    } else {
        ui->liftWheel->setColor(QColor::fromRgbF(filter.get_double("lift_r"),
                                                 filter.get_double("lift_g"),
                                                 filter.get_double("lift_b")));
        ui->gammaWheel->setColor(QColor::fromRgbF(filter.get_double("gamma_r") / GAMMA_FACTOR,
                                                  filter.get_double("gamma_g") / GAMMA_FACTOR,
                                                  filter.get_double("gamma_b") / GAMMA_FACTOR));
        ui->gainWheel->setColor(QColor::fromRgbF(filter.get_double("gain_r") / GAIN_FACTOR,
                                                 filter.get_double("gain_g") / GAIN_FACTOR,
                                                 filter.get_double("gain_b") / GAIN_FACTOR));
    }
    ui->preset->loadPresets();
}