Exemplo n.º 1
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();
    }
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
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);
}
Exemplo n.º 4
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();
    }
}
Exemplo n.º 5
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;
}
Exemplo n.º 6
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());
}
Exemplo n.º 7
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());
}
Exemplo n.º 8
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;
}
Exemplo n.º 9
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());
}
Exemplo n.º 10
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;
        }
    }
}