Пример #1
0
void FilmGrainTool::prepareFinal()
{
    FilmGrainContainer prm = d->settingsView->settings();

    ImageIface iface;
    setFilter(new FilmGrainFilter(iface.original(), this, prm));
}
Пример #2
0
void WhiteBalanceTool::prepareFinal()
{
    WBContainer settings = d->settingsView->settings();

    ImageIface iface;
    setFilter(new WBFilter(iface.original(), this, settings));
}
Пример #3
0
void EmbossTool::prepareFinal()
{
    int depth = d->depthInput->value();

    ImageIface iface;
    setFilter(new EmbossFilter(iface.original(), this, depth));
}
Пример #4
0
void ContentAwareResizeTool::prepareEffect()
{
    if (d->prevW  != d->wInput->value()  || d->prevH  != d->hInput->value() ||
        d->prevWP != d->wpInput->value() || d->prevHP != d->hpInput->value())
    {
        slotValuesChanged();
    }

    disableSettings();

    ImageIface* iface = d->previewWidget->imageIface();
    int w             = iface->previewWidth();
    int h             = iface->previewHeight();
    DImg imTemp       = iface->getOriginalImg()->smoothScale(w, h, Qt::KeepAspectRatio);
    int new_w         = (int)(w*d->wpInput->value()/100.0);
    int new_h         = (int)(h*d->hpInput->value()/100.0);

    if (d->mixedRescaleInput->value()<100.0) // mixed rescale
    {
        double stdRescaleP = (100.0 - d->mixedRescaleInput->value()) / 100.0;
        int diff_w         = (int)(stdRescaleP * (w - new_w));
        int diff_h         = (int)(stdRescaleP * (h - new_h));

        imTemp.resize(imTemp.width() - diff_w, imTemp.height() - diff_h);
    }

    QImage mask;

    if (d->weightMaskBox->isChecked())
    {
        mask = d->previewWidget->getMask();
    }

    contentAwareResizeCore(&imTemp, new_w, new_h, mask);
}
Пример #5
0
void ResizeTool::prepareEffect()
{
    if (d->prevW  != d->wInput->value()  || d->prevH  != d->hInput->value() ||
        d->prevWP != d->wpInput->value() || d->prevHP != d->hpInput->value())
    {
        slotValuesChanged();
    }

    ImageIface* iface = d->previewWidget->imageIface();
    int w             = iface->previewWidth();
    int h             = iface->previewHeight();
    DImg imTemp       = iface->getOriginalImg()->smoothScale(w, h, Qt::KeepAspectRatio);
    int new_w         = (int)(w*d->wpInput->value()/100.0);
    int new_h         = (int)(h*d->hpInput->value()/100.0);

    if (d->useGreycstorationBox->isChecked())
    {
        setFilter(new GreycstorationFilter(&imTemp,
                                           d->settingsWidget->settings(),
                                           GreycstorationFilter::Resize,
                                           new_w, new_h,
                                           QImage(),
                                           this));
    }
    else
    {
        // See B.K.O #152192: CImg resize() sound like defective or unadapted
        // to resize image without good quality.
        DImgBuiltinFilter resize(DImgBuiltinFilter::Resize, QSize(new_w, new_h));
        setFilter(resize.createThreadedFilter(&imTemp, this));
    }
}
Пример #6
0
void BlurFXTool::preparePreview()
{
    d->gboxSettings->setEnabled(false);

    DImg image;

    switch (d->effectType->currentIndex())
    {
        case BlurFXFilter::ZoomBlur:
        case BlurFXFilter::RadialBlur:
        case BlurFXFilter::FocusBlur:
        {
            ImageIface iface;
            image = *iface.original();
            break;
        }

        case BlurFXFilter::FarBlur:
        case BlurFXFilter::MotionBlur:
        case BlurFXFilter::SoftenerBlur:
        case BlurFXFilter::ShakeBlur:
        case BlurFXFilter::SmartBlur:
        case BlurFXFilter::FrostGlass:
        case BlurFXFilter::Mosaic:
            image = d->previewWidget->getOriginalRegionImage();
            break;
    }

    int type  = d->effectType->currentIndex();
    int dist  = d->distanceInput->value();
    int level = d->levelInput->value();

    setFilter(new BlurFXFilter(&image, this, type, dist, level));
}
Пример #7
0
void InsertTextTool::finalRendering()
{
    qApp->setOverrideCursor( Qt::WaitCursor );

    ImageIface iface;
    DImg dest = d->previewWidget->makeInsertText();

    FilterAction action(QLatin1String("digikam:insertTextTool"), 2);
    action.setDisplayableName(i18n("Insert Text Tool"));

    action.addParameter(QLatin1String("text"),              d->textEdit->toPlainText());
    action.addParameter(QLatin1String("textRotationIndex"), d->textRotation->currentIndex());
    action.addParameter(QLatin1String("textFont"),          d->textFont.toString());
    action.addParameter(QLatin1String("colorR"),            d->fontColorButton->color().red());
    action.addParameter(QLatin1String("colorG"),            d->fontColorButton->color().green());
    action.addParameter(QLatin1String("colorB"),            d->fontColorButton->color().blue());
    action.addParameter(QLatin1String("colorA"),            d->fontColorButton->color().alpha());
    action.addParameter(QLatin1String("textOpacity"),       d->textOpacity->value());
    action.addParameter(QLatin1String("borderText"),        d->borderText->isChecked());
    action.addParameter(QLatin1String("transparentText"),   d->transparentText->isChecked());

    iface.setOriginal(i18n("Insert Text"), action, dest);

    qApp->restoreOverrideCursor();
}
void AbstractDImageHistoryTest::applyFilters4()
{
    ImageIface iface;

    BlurFilter filter(iface.original(), this);
    filter.startFilterDirectly();
    iface.setOriginal("", filter.filterAction(), filter.getTargetImage());
}
Пример #9
0
void CharcoalTool::prepareFinal()
{
    double pencil = (double)d->pencilInput->value()/10.0;
    double smooth = (double)d->smoothInput->value();

    ImageIface iface;
    setFilter(new CharcoalFilter(iface.original(), this, pencil, smooth));
}
Пример #10
0
void RainDropTool::putPreviewData()
{
    ImageIface* iface = d->previewWidget->imageIface();
    DImg imDest       = filter()->getTargetImage().smoothScale(iface->previewWidth(), iface->previewHeight());
    iface->putPreviewImage(imDest.bits());

    d->previewWidget->updatePreview();
}
Пример #11
0
void LensAutoFixTool::prepareFinal()
{
    // Settings information must be handle before to disable settings view.
    LensFunContainer settings = d->cameraSelector->settings();
    d->settingsView->assignFilterSettings(settings);
    ImageIface iface;
    setFilter(new LensFunFilter(iface.original(), this, settings));
}
Пример #12
0
void BCGTool::prepareFinal()
{
    BCGContainer settings = d->settingsView->settings();

    ImageIface iface;

    setFilter(new BCGFilter(iface.original(), this, settings));
}
Пример #13
0
void RestorationTool::prepareFinal()
{
    ImageIface iface;
    DImg originalImage = iface.original()->copy();

    setFilter(new GreycstorationFilter(&originalImage,
                                       d->settingsWidget->settings(), GreycstorationFilter::Restore,
                                       0, 0, QImage(), this));
}
Пример #14
0
void LensDistortionTool::prepareFinal()
{
    double m = d->mainInput->value();
    double e = d->edgeInput->value();
    double r = d->rescaleInput->value();
    double b = d->brightenInput->value();

    ImageIface iface;
    setFilter(new LensDistortionFilter(iface.original(), this, m, e, r, b, 0, 0));
}
Пример #15
0
void BlurFXTool::prepareFinal()
{
    d->gboxSettings->setEnabled(false);

    int type  = d->effectType->currentIndex();
    int dist  = d->distanceInput->value();
    int level = d->levelInput->value();

    ImageIface iface;
    setFilter(new BlurFXFilter(iface.original(), this, type, dist, level));
}
void AbstractDImageHistoryTest::applyFilters1()
{
    ImageIface iface;

    BCGFilter filter1(iface.original(), this);
    filter1.startFilterDirectly();
    iface.setOriginal(i18n("Brightness / Contrast / Gamma"), filter1.filterAction(), filter1.getTargetImage());

    CurvesFilter filter2(iface.original(), this);
    filter2.startFilterDirectly();
    iface.setOriginal("Curves", filter2.filterAction(), filter2.getTargetImage());
}
Пример #17
0
void WhiteBalanceTool::preparePreview()
{
    ImageIface iface;
    DImg* const img      = iface.original();
    WBContainer settings = d->settingsView->settings();
    WBFilter::findChanelsMax(img, settings.maxr, settings.maxg, settings.maxb);

    d->gboxSettings->histogramBox()->histogram()->stopHistogramComputation();

    DImg preview = d->previewWidget->getOriginalRegionImage(true);
    setFilter(new WBFilter(&preview, this, settings));
}
Пример #18
0
void ShearTool::prepareFinal()
{
    float hAngle         = d->mainHAngleInput->value() + d->fineHAngleInput->value();
    float vAngle         = d->mainVAngleInput->value() + d->fineVAngleInput->value();
    bool antialiasing    = d->antialiasInput->isChecked();
    QColor background    = Qt::black;

    ImageIface iface;
    int orgW             = iface.originalSize().width();
    int orgH             = iface.originalSize().height();
    DImg* const orgImage = iface.original();
    setFilter(new ShearFilter(orgImage, this, hAngle, vAngle, antialiasing, background, orgW, orgH));
}
Пример #19
0
void WhiteBalanceTool::slotAutoAdjustExposure()
{
    kapp->activeWindow()->setCursor(Qt::WaitCursor);

    ImageIface iface;
    DImg* const img      = iface.original();
    WBContainer settings = d->settingsView->settings();
    WBFilter::autoExposureAdjustement(img, settings.black, settings.expositionMain);
    d->settingsView->setSettings(settings);

    kapp->activeWindow()->unsetCursor();
    slotTimer();
}
Пример #20
0
void LensAutoFixTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("Lens Auto-Correction"), filter()->filterAction(), filter()->getTargetImage());

    MetaEngineData data  = iface.originalMetadata();

    // Note: there are certain situations in the editor where these metadata changes may be undone.
    // Ignore for now, as they are not critical.
    LensFunFilter* const fltr = dynamic_cast<LensFunFilter*>(filter());

    if (fltr)
        fltr->registerSettingsToXmp(data);

    iface.setOriginalMetadata(data);
}
Пример #21
0
void ContentAwareResizeTool::prepareFinal()
{
    if (d->prevW  != d->wInput->value()  || d->prevH  != d->hInput->value() ||
        d->prevWP != d->wpInput->value() || d->prevHP != d->hpInput->value())
    {
        slotValuesChanged();
    }

    disableSettings();

    ImageIface iface;
    QImage     mask;

    if (d->mixedRescaleInput->value() < 100.0) // mixed rescale
    {
        double stdRescaleP = (100.0 - d->mixedRescaleInput->value()) / 100.0;
        int diff_w         = (int)(stdRescaleP * (iface.originalSize().width()  - d->wInput->value()));
        int diff_h         = (int)(stdRescaleP * (iface.originalSize().height() - d->hInput->value()));
        DImg image         = iface.original()->smoothScale(iface.originalSize().width()  - diff_w,
                             iface.originalSize().height() - diff_h,
                             Qt::IgnoreAspectRatio);

        if (d->weightMaskBox->isChecked())
        {
            mask = d->previewWidget->getMask().scaled(iface.originalSize().width()  - diff_w,
                    iface.originalSize().height() - diff_h);
        }

        contentAwareResizeCore(&image, d->wInput->value(), d->hInput->value(), mask);
    }
    else
    {
        if (d->weightMaskBox->isChecked())
        {
            mask = d->previewWidget->getMask().scaled(iface.originalSize());
        }

        contentAwareResizeCore(iface.original(), d->wInput->value(), d->hInput->value(), mask);
    }
}
Пример #22
0
void RainDropTool::prepareEffect()
{
    int drop   = d->dropInput->value();
    int amount = d->amountInput->value();
    int coeff  = d->coeffInput->value();

    ImageIface* iface = d->previewWidget->imageIface();

    // Selected data from the image
    QRect selection( iface->selectedXOrg(), iface->selectedYOrg(),
                     iface->selectedWidth(), iface->selectedHeight() );

    setFilter(new RainDropFilter(iface->getOriginalImg(), this, drop, amount, coeff, &selection));
}
Пример #23
0
void ResizeTool::putPreviewData()
{
    ImageIface* iface = d->previewWidget->imageIface();
    int w             = iface->previewWidth();
    int h             = iface->previewHeight();
    DImg imTemp       = filter()->getTargetImage().smoothScale(w, h, Qt::KeepAspectRatio);
    DImg imDest(w, h, filter()->getTargetImage().sixteenBit(), filter()->getTargetImage().hasAlpha());

    QColor background = toolView()->backgroundRole();
    imDest.fill(DColor(background, filter()->getTargetImage().sixteenBit()));
    imDest.bitBltImage(&imTemp, (w-imTemp.width())/2, (h-imTemp.height())/2);

    iface->putPreviewImage((imDest.smoothScale(iface->previewWidth(), iface->previewHeight())).bits());
    d->previewWidget->updatePreview();
}
Пример #24
0
void BlurTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("Gaussian Blur"), filter()->filterAction(), filter()->getTargetImage());
}
Пример #25
0
void BlurTool::prepareFinal()
{
    ImageIface iface;
    setFilter(new BlurFilter(iface.original(), this, d->radiusInput->value()));
}
Пример #26
0
void BCGTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("Brightness / Contrast / Gamma"), filter()->filterAction(), filter()->getTargetImage());
}
Пример #27
0
void ShearTool::setFinalImage()
{
    ImageIface iface;
    DImg targetImage = filter()->getTargetImage();
    iface.setOriginal(i18n("Shear Tool"), filter()->filterAction(), targetImage);
}
Пример #28
0
void WhiteBalanceTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("White Balance"), filter()->filterAction(), filter()->getTargetImage());
}
Пример #29
0
void RestorationTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("Restoration"), filter()->filterAction(), filter()->getTargetImage());
}
Пример #30
0
void FilmGrainTool::setFinalImage()
{
    ImageIface iface;
    iface.setOriginal(i18n("Film Grain"), filter()->filterAction(), filter()->getTargetImage());
}