示例#1
0
void BCGContainer::writeToFilterAction(FilterAction& action, const QString& prefix) const
{
    action.addParameter(prefix + "channel",    channel);
    action.addParameter(prefix + "brightness", brightness);
    action.addParameter(prefix + "contrast",   contrast);
    action.addParameter(prefix + "gamma",      gamma);
}
示例#2
0
QString DImgFilterManager::i18nDisplayableName(const FilterAction& action)
{
    if (action.displayableName().isEmpty() && action.identifier().isEmpty())
    {
        return i18n("Unknown filter");
    }
    else
    {
        QString i18nDispName     = i18nDisplayableName(action.identifier());
        QString metadataDispName = action.displayableName();

        if (!i18nDispName.isEmpty())
        {
            return i18nDispName;
        }
        else if (!metadataDispName.isEmpty())
        {
            return metadataDispName;
        }
        else
        {
            return action.identifier();
        }
    }
}
示例#3
0
void NRFilter::readParameters(const FilterAction& action)
{
    for (int i = 0; i < 3; ++i)
    {
        d->settings.softness[i]   = action.parameter(QString("softness[%1]").arg(i)).toDouble();
        d->settings.thresholds[i] = action.parameter(QString("thresholds[%1]").arg(i)).toDouble();
    }
}
示例#4
0
BCGContainer BCGContainer::fromFilterAction(const FilterAction& action, const QString& prefix)
{
    BCGContainer settings;
    settings.channel    = action.parameter(prefix + "channel",    settings.channel);
    settings.brightness = action.parameter(prefix + "brightness", settings.brightness);
    settings.contrast   = action.parameter(prefix + "contrast",   settings.contrast);
    settings.gamma      = action.parameter(prefix + "gamma",      settings.gamma);
    return settings;
}
示例#5
0
void TapParameterDialog::filterActionTriggered()
{
    FilterAction *fa = qobject_cast<FilterAction *>(QObject::sender());
    QString filter_expr = filterExpression();

    if (!fa || filter_expr.isEmpty()) {
        return;
    }

    emit filterAction(filter_expr, fa->action(), fa->actionType());
}
示例#6
0
void DistortionFXFilter::readParameters(const FilterAction& action)
{
    d->antiAlias  = action.parameter(QLatin1String("antiAlias")).toBool();
    d->effectType = action.parameter(QLatin1String("type")).toInt();
    d->iteration  = action.parameter(QLatin1String("iteration")).toInt();
    d->level      = action.parameter(QLatin1String("level")).toInt();

    if (d->effectType == Tile)
    {
        d->randomSeed = action.parameter(QLatin1String("randomSeed")).toUInt();
    }
}
示例#7
0
void BWSepiaFilter::readParameters(const FilterAction& action)
{
    d->settings.filmType    = action.parameter(QLatin1String("filmType")).toInt();
    d->settings.filterType  = action.parameter(QLatin1String("filterType")).toInt();
    d->settings.preview     = action.parameter(QLatin1String("preview")).toBool();
    d->settings.previewType = action.parameter(QLatin1String("previewType")).toInt();
    d->settings.strength    = action.parameter(QLatin1String("strength")).toDouble();
    d->settings.toneType    = action.parameter(QLatin1String("toneType")).toInt();

    d->settings.curvesPrm   = CurvesContainer::fromFilterAction(action);
    d->settings.bcgPrm      = BCGContainer::fromFilterAction(action);
}
示例#8
0
RedEyeCorrectionContainer RedEyeCorrectionContainer::fromFilterAction(const FilterAction& action, const QString& prefix)
{
    RedEyeCorrectionContainer settings;
    settings.m_redToAvgRatio = action.parameter(prefix + QLatin1String("redtoavgratio"), settings.m_redToAvgRatio);

    return settings;
}
示例#9
0
void FreeRotationFilter::readParameters(const FilterAction& action)
{
    d->settings.angle = action.parameter("angle").toDouble();
    d->settings.antiAlias = action.parameter("antiAlias").toBool();
    d->settings.autoCrop = action.parameter("autoCrop").toInt();
    d->settings.newSize = action.parameter("newSize").toSize();
    d->settings.orgH = action.parameter("orgH").toInt();
    d->settings.orgW = action.parameter("orgW").toInt();
    d->settings.backgroundColor.setRed(action.parameter("backgroundColorR").toInt());
    d->settings.backgroundColor.setGreen(action.parameter("backgroundColorG").toInt());
    d->settings.backgroundColor.setBlue(action.parameter("backgroundColorB").toInt());
    d->settings.backgroundColor.setAlpha(action.parameter("backgroundColorA").toInt());
}
示例#10
0
void ShearFilter::readParameters(const FilterAction& action)
{
    d->antiAlias = action.parameter("antiAlias").toBool();
    d->hAngle = action.parameter("hAngle").toFloat();
    d->orgH = action.parameter("orgH").toInt();
    d->orgW = action.parameter("orgW").toInt();
    d->vAngle = action.parameter("vAngle").toFloat();
    d->backgroundColor.setRed(action.parameter("backgroundColorR").toInt());
    d->backgroundColor.setGreen(action.parameter("backgroundColorG").toInt());
    d->backgroundColor.setBlue(action.parameter("backgroundColorB").toInt());
    d->backgroundColor.setAlpha(action.parameter("backgroundColorA").toInt());
}
示例#11
0
void DImageFilterActionTest::testDRawDecoding()
{
    DRawDecoding params;

    params.rawPrm.sixteenBitsImage = true;
    params.rawPrm.autoBrightness  = true;
    params.rawPrm.whiteBalance = KDcrawIface::RawDecodingSettings::AERA;
    params.rawPrm.RGBInterpolate4Colors = true;
    params.rawPrm.RAWQuality = KDcrawIface::RawDecodingSettings::AMAZE;
    params.rawPrm.NRType = KDcrawIface::RawDecodingSettings::WAVELETSNR;
    params.rawPrm.outputColorSpace = KDcrawIface::RawDecodingSettings::ADOBERGB;

    FilterAction action;
    params.writeToFilterAction(action);

    qDebug() << action.parameters();

    DRawDecoding params2 = DRawDecoding::fromFilterAction(action);
    QVERIFY(params == params2);
}
示例#12
0
QString DImgFilterManager::filterIcon(const FilterAction& action)
{
    QString iconName = filterIcon(action.identifier());

    if (!iconName.isNull())
    {
        return iconName;
    }

    return QLatin1String("document-edit");
}
示例#13
0
void WBContainer::writeToFilterAction(FilterAction& action, const QString& prefix) const
{
    action.addParameter(prefix + "black", black);
    action.addParameter(prefix + "exposition", exposition);
    action.addParameter(prefix + "temperature", temperature);
    action.addParameter(prefix + "green", green);
    action.addParameter(prefix + "dark", dark);
    action.addParameter(prefix + "gamma", gamma);
    action.addParameter(prefix + "saturation", saturation);
}
示例#14
0
WBContainer WBContainer::fromFilterAction(const FilterAction& action, const QString& prefix)
{
    WBContainer settings;
    settings.black       = action.parameter(prefix + "black", settings.black);
    settings.exposition  = action.parameter(prefix + "exposition", settings.exposition);
    settings.temperature = action.parameter(prefix + "temperature", settings.temperature);
    settings.green       = action.parameter(prefix + "green", settings.green);
    settings.dark        = action.parameter(prefix + "dark", settings.dark);
    settings.gamma       = action.parameter(prefix + "gamma", settings.gamma);
    settings.saturation  = action.parameter(prefix + "saturation", settings.saturation);
    return settings;
}
示例#15
0
void DImgBuiltinFilter::setAction(const FilterAction& action)
{
    m_type = NoOperation;

    if (action.identifier() == "transform:rotate" && action.version() == 1)
    {
        int angle = action.parameter("angle").toInt();

        if (angle == 90)
        {
            m_type = Rotate90;
        }
        else if (angle == 180)
        {
            m_type = Rotate180;
        }
        else
        {
            m_type = Rotate270;
        }
    }
    else if (action.identifier() == "transform:flip" && action.version() == 1)
    {
        QString direction = action.parameter("direction").toString();

        if (direction == "vertical")
        {
            m_type = FlipVertically;
        }
        else
        {
            m_type = FlipHorizontally;
        }
    }
    else if (action.identifier() == "transform:crop" && action.version() == 1)
    {
        m_type     = Crop;
        int x      = action.parameter("x").toInt();
        int y      = action.parameter("y").toInt();
        int width  = action.parameter("width").toInt();
        int height = action.parameter("height").toInt();
        m_arg      = QRect(x, y, width, height);
    }
    else if (action.identifier() == "transform:resize" && action.version() == 1)
    {
        m_type     = Resize;
        int width  = action.parameter("width").toInt();
        int height = action.parameter("height").toInt();
        m_arg      = QSize(width, height);
    }
    else if (action.identifier() == "transform:convertDepth" && action.version() == 1)
    {
        int depth = action.parameter("depth").toInt();

        if (depth == 16)
        {
            m_type = ConvertTo16Bit;
        }
        else
        {
            m_type = ConvertTo8Bit;
        }
    }
}
示例#16
0
void RedEyeCorrectionContainer::writeToFilterAction(FilterAction& action, const QString& prefix) const
{
    action.addParameter(prefix + QLatin1String("redtoavgratio"), m_redToAvgRatio);
}
示例#17
0
void BorderFilter::readParameters(const FilterAction& action)
{
    d->settings.borderPath            = action.parameter(QLatin1String("borderPath")).toString();
    d->settings.borderPercent         = action.parameter(QLatin1String("borderPercent")).toDouble();
    d->settings.borderType            = action.parameter(QLatin1String("borderType")).toInt();
    d->settings.borderWidth1          = action.parameter(QLatin1String("borderWidth1")).toInt();
    d->settings.borderWidth2          = action.parameter(QLatin1String("borderWidth2")).toInt();
    d->settings.borderWidth3          = action.parameter(QLatin1String("borderWidth3")).toInt();
    d->settings.borderWidth4          = action.parameter(QLatin1String("borderWidth4")).toInt();
    d->settings.preserveAspectRatio   = action.parameter(QLatin1String("preserveAspectRatio")).toBool();
    d->settings.orgHeight             = action.parameter(QLatin1String("orgHeight")).toInt();
    d->settings.orgWidth              = action.parameter(QLatin1String("orgWidth")).toInt();

    d->settings.solidColor            = stringToColor(action.parameter(QLatin1String("solidColor")).toString());
    d->settings.niepceBorderColor     = stringToColor(action.parameter(QLatin1String("niepceBorderColor")).toString());
    d->settings.niepceLineColor       = stringToColor(action.parameter(QLatin1String("niepceLineColor")).toString());
    d->settings.bevelUpperLeftColor   = stringToColor(action.parameter(QLatin1String("bevelUpperLeftColor")).toString());
    d->settings.bevelLowerRightColor  = stringToColor(action.parameter(QLatin1String("bevelLowerRightColor")).toString());
    d->settings.decorativeFirstColor  = stringToColor(action.parameter(QLatin1String("decorativeFirstColor")).toString());
    d->settings.decorativeSecondColor = stringToColor(action.parameter(QLatin1String("decorativeSecondColor")).toString());
}
示例#18
0
FilterAction DImgBuiltinFilter::filterAction() const
{
    FilterAction action;

    switch (m_type)
    {
        case NoOperation:
        default:
            return action;

        case Rotate90:
        case Rotate180:
        case Rotate270:
        {
            action = FilterAction("transform:rotate", 1);
            int angle;

            if (m_type == Rotate90)
            {
                angle = 90;
            }
            else if (m_type == Rotate180)
            {
                angle = 180;
            }
            else
            {
                angle = 270;
            }

            action.addParameter("angle", angle);
            break;
        }

        case FlipHorizontally:
        case FlipVertically:
        {
            action = FilterAction("transform:flip", 1);
            action.addParameter("direction", m_type == FlipHorizontally ? "horizontal" : "vertical");
            break;
        }

        case Crop:
        {
            action  = FilterAction("transform:crop", 1);
            QRect r = m_arg.toRect();
            action.addParameter("x",      r.x());
            action.addParameter("y",      r.y());
            action.addParameter("width",  r.width());
            action.addParameter("height", r.height());
            break;
        }

        case Resize:
        {
            action  = FilterAction("transform:resize", 1);
            QSize s = m_arg.toSize();
            action.addParameter("width",  s.width());
            action.addParameter("height", s.height());
            break;
        }

        case ConvertTo8Bit:
        case ConvertTo16Bit:
        {
            action = FilterAction("transform:convertDepth", 1);
            action.addParameter("depth", m_type == ConvertTo8Bit ? 8 : 16);
            break;
        }
    }

    action.setDisplayableName(displayableName());
    return action;
}
示例#19
0
QString ToolTipFiller::filterActionTipContents(const FilterAction& action)
{
    if (action.isNull())
    {
        return QString();
    }

    QString            str;
    DToolTipStyleSheet cnt(ApplicationSettings::instance()->getToolTipsFont());
    QString            tip = cnt.tipHeader;

    tip += cnt.headBeg + i18n("Filter") + cnt.headEnd;

    // Displayable name
    tip += cnt.cellBeg + i18n("Name:") + cnt.cellMid
        + DImgFilterManager::instance()->i18nDisplayableName(action) + cnt.cellEnd;

    // Category
    QString reproducible("---");

    switch (action.category())
    {
        case FilterAction::ReproducibleFilter:
            reproducible = i18nc("Image filter reproducible: Yes", "Yes");
            break;
        case FilterAction::ComplexFilter:
            reproducible = i18nc("Image filter reproducible: Partially", "Partially");
            break;
        case FilterAction::DocumentedHistory:
            reproducible = i18nc("Image filter reproducible: No", "No");
            break;
        default:
            break;
    };

    tip += cnt.cellBeg + i18n("Reproducible:") + cnt.cellMid
         + reproducible + cnt.cellEnd;

    // Description

    str = action.description();

    if (str.isEmpty())
    {
        str = QString("---");
    }

    tip += cnt.cellSpecBeg + i18nc("Image filter description", "Description:") + cnt.cellSpecMid
        + cnt.breakString(str) + cnt.cellSpecEnd;

    // Identifier + version
    tip += cnt.cellBeg + i18n("Identifier:") + cnt.cellMid
        + action.identifier() + " (v" + QString::number(action.version()) + ") " + cnt.cellEnd;

    if (action.hasParameters())
    {
        tip += cnt.headBeg + i18n("Technical Parameters") + cnt.headEnd;

        const QHash<QString, QVariant>& params = action.parameters();
        QList<QString> keys                    = params.keys();
        qSort(keys);

        foreach(const QString& key, keys)
        {
            QHash<QString, QVariant>::const_iterator it;

            for (it = params.find(key); it != params.end() && it.key() == key; ++it)
            {
                if (it.key().isEmpty() || !it.value().isValid())
                {
                    continue;
                }

                if (it.key().startsWith(QLatin1String("curveData")))
                {
                    str = i18n("<i>Binary Data</i>");
                }
                else
                {
                    str = it.value().toString();
                }

                if (str.length() > cnt.maxStringLength)
                {
                    str = cnt.elidedText(str, Qt::ElideRight);
                }

                QString key = it.key();
                QChar first = key.at(0);

                if (first.isLower())
                {
                    key.replace(0, 1, first.toUpper());
                }

                tip += cnt.cellBeg + key + cnt.cellMid
                    + str + cnt.cellEnd;
            }
        }