~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/imageplugins/filters/colorfxtool.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * Description : a digiKam image plugin for to apply a color
8
8
 *               effect to an image.
9
9
 *
10
 
 * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
11
 
 * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
 
11
 * Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
12
 *
13
13
 * This program is free software; you can redistribute it
14
14
 * and/or modify it under the terms of the GNU General
75
75
namespace DigikamFxFiltersImagePlugin
76
76
{
77
77
 
78
 
class ColorFxTool::ColorFxToolPriv
 
78
class ColorFxTool::Private
79
79
{
80
80
 
81
81
public:
82
82
 
83
 
    ColorFxToolPriv() :
84
 
        destinationPreviewData(0),
 
83
    Private() :
85
84
        effectTypeLabel(0),
86
85
        levelLabel(0),
87
86
        iterationLabel(0),
99
98
    static const QString configLevelAdjustmentEntry;
100
99
    static const QString configIterationAdjustmentEntry;
101
100
 
102
 
    uchar*               destinationPreviewData;
103
 
 
104
101
    QLabel*              effectTypeLabel;
105
102
    QLabel*              levelLabel;
106
103
    QLabel*              iterationLabel;
113
110
    ImageGuideWidget*    previewWidget;
114
111
    EditorToolSettings*  gboxSettings;
115
112
};
116
 
const QString ColorFxTool::ColorFxToolPriv::configGroupName("coloreffect Tool");
117
 
const QString ColorFxTool::ColorFxToolPriv::configHistogramChannelEntry("Histogram Channel");
118
 
const QString ColorFxTool::ColorFxToolPriv::configHistogramScaleEntry("Histogram Scale");
119
 
const QString ColorFxTool::ColorFxToolPriv::configEffectTypeEntry("EffectType");
120
 
const QString ColorFxTool::ColorFxToolPriv::configLevelAdjustmentEntry("LevelAdjustment");
121
 
const QString ColorFxTool::ColorFxToolPriv::configIterationAdjustmentEntry("IterationAdjustment");
 
113
 
 
114
const QString ColorFxTool::Private::configGroupName("coloreffect Tool");
 
115
const QString ColorFxTool::Private::configHistogramChannelEntry("Histogram Channel");
 
116
const QString ColorFxTool::Private::configHistogramScaleEntry("Histogram Scale");
 
117
const QString ColorFxTool::Private::configEffectTypeEntry("EffectType");
 
118
const QString ColorFxTool::Private::configLevelAdjustmentEntry("LevelAdjustment");
 
119
const QString ColorFxTool::Private::configIterationAdjustmentEntry("IterationAdjustment");
122
120
 
123
121
// --------------------------------------------------------
124
122
 
125
 
ColorFxTool::ColorFxTool(QObject* parent)
 
123
ColorFxTool::ColorFxTool(QObject* const parent)
126
124
    : EditorToolThreaded(parent),
127
 
      d(new ColorFxToolPriv)
 
125
      d(new Private)
128
126
{
129
127
    setObjectName("coloreffects");
130
128
    setToolName(i18n("Color Effects"));
142
140
    d->gboxSettings = new EditorToolSettings;
143
141
    d->gboxSettings->setTools(EditorToolSettings::Histogram);
144
142
    d->gboxSettings->setHistogramType(LRGBC);
145
 
    
 
143
 
146
144
    // -------------------------------------------------------------
147
145
 
148
146
    d->effectTypeLabel = new QLabel(i18n("Type:"));
206
204
            this, SLOT(slotTimer()));
207
205
 
208
206
    connect(d->previewWidget, SIGNAL(signalResized()),
209
 
            this, SLOT(slotEffect()));
 
207
            this, SLOT(slotPreview()));
210
208
 
211
209
    connect(d->effectType, SIGNAL(activated(int)),
212
210
            this, SLOT(slotEffectTypeChanged(int)));
214
212
 
215
213
ColorFxTool::~ColorFxTool()
216
214
{
217
 
    if (d->destinationPreviewData)
218
 
    {
219
 
        delete [] d->destinationPreviewData;
220
 
    }
221
 
 
222
215
    delete d;
223
216
}
224
217
 
267
260
    d->levelInput->blockSignals(false);
268
261
    d->iterationInput->blockSignals(false);
269
262
 
270
 
    slotEffect();
 
263
    slotPreview();
271
264
}
272
265
 
273
266
void ColorFxTool::slotColorSelectedFromTarget(const DColor& color)
320
313
    d->levelInput->blockSignals(false);
321
314
    d->iterationInput->blockSignals(false);
322
315
 
323
 
    slotEffect();
 
316
    slotPreview();
324
317
}
325
318
 
326
 
void ColorFxTool::prepareEffect()
 
319
void ColorFxTool::preparePreview()
327
320
{
328
321
    d->effectTypeLabel->setEnabled(false);
329
322
    d->effectType->setEnabled(false);
332
325
    d->iterationInput->setEnabled(false);
333
326
    d->iterationLabel->setEnabled(false);
334
327
 
335
 
    int l = d->levelInput->value();
336
 
    int f = d->iterationInput->value();
337
 
    int e = d->effectType->currentIndex();
338
 
 
339
 
    ImageIface* iface = d->previewWidget->imageIface();
340
 
    QScopedArrayPointer<uchar> data(iface->getPreviewImage());
341
 
    DImg image(iface->previewWidth(), iface->previewHeight(), iface->previewSixteenBit(),
342
 
               iface->previewHasAlpha(), data.data());
 
328
    int l                   = d->levelInput->value();
 
329
    int f                   = d->iterationInput->value();
 
330
    int e                   = d->effectType->currentIndex();
 
331
    ImageIface* const iface = d->previewWidget->imageIface();
 
332
    DImg image              = iface->preview();
343
333
 
344
334
    setFilter(new ColorFXFilter(&image, this, e, l, f));
345
335
}
357
347
    int f = d->iterationInput->value();
358
348
    int e = d->effectType->currentIndex();
359
349
 
360
 
    ImageIface iface(0, 0);
 
350
    ImageIface iface;
361
351
 
362
 
    setFilter(new ColorFXFilter(iface.getOriginalImg(), this, e, l, f));
 
352
    setFilter(new ColorFXFilter(iface.original(), this, e, l, f));
363
353
}
364
354
 
365
 
void ColorFxTool::putPreviewData()
 
355
void ColorFxTool::setPreviewImage()
366
356
{
367
 
    ImageIface* iface = d->previewWidget->imageIface();
368
 
    DImg preview = filter()->getTargetImage();
369
 
    DImg imDest  = preview.smoothScale(iface->previewWidth(), iface->previewHeight());
370
 
    iface->putPreviewImage(imDest.bits());
371
 
    d->gboxSettings->histogramBox()->histogram()->updateData(preview.bits(), preview.width(), preview.height(),
372
 
            preview.sixteenBit(), 0, 0, 0, false);
 
357
    ImageIface* const iface = d->previewWidget->imageIface();
 
358
    DImg preview            = filter()->getTargetImage();
 
359
    DImg imDest             = preview.smoothScale(iface->previewSize());
 
360
    iface->setPreview(imDest);
 
361
    d->gboxSettings->histogramBox()->histogram()->updateData(preview, DImg(), false);
373
362
 
374
363
    d->previewWidget->updatePreview();
375
364
}
376
365
 
377
 
void ColorFxTool::putFinalData()
 
366
void ColorFxTool::setFinalImage()
378
367
{
379
 
    ImageIface iface(0, 0);
 
368
    ImageIface iface;
380
369
 
381
370
    QString name;
382
371
 
399
388
            break;
400
389
    }
401
390
 
402
 
    iface.putOriginalImage(name, filter()->filterAction(), filter()->getTargetImage().bits());
 
391
    iface.setOriginal(name, filter()->filterAction(), filter()->getTargetImage());
403
392
}
404
393
 
405
394
void ColorFxTool::renderingFinished()
428
417
}
429
418
 
430
419
}  // namespace DigikamFxFiltersImagePlugin
431