Commit 147fb283 authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

Port all BQM tools (with some exceptions *) to record their filter actions in the image,

thus properly supporting versioning

* The tools which actually tune the saving format do not apply history.
  Watermark tool is missing as it is not based on a filter.
  Rotation does not add an action for some cases intentionally

CCBUG: 293500
parent 16e3e6bc
......@@ -109,40 +109,35 @@ bool AutoCorrection::toolOperations()
case AutoLevelsCorrection:
{
AutoLevelsFilter autolevels(&image(), &image());
autolevels.startFilterDirectly();
image().putImageData(autolevels.getTargetImage().bits());
applyFilter(&autolevels);
break;
}
case NormalizeCorrection:
{
NormalizeFilter normalize(&image(), &image());
normalize.startFilterDirectly();
image().putImageData(normalize.getTargetImage().bits());
applyFilter(&normalize);
break;
}
case EqualizeCorrection:
{
EqualizeFilter equalize(&image(), &image());
equalize.startFilterDirectly();
image().putImageData(equalize.getTargetImage().bits());
applyFilter(&equalize);
break;
}
case StretchContrastCorrection:
{
StretchFilter stretch(&image(), &image());
stretch.startFilterDirectly();
image().putImageData(stretch.getTargetImage().bits());
applyFilter(&stretch);
break;
}
case AutoExposureCorrection:
{
AutoExpoFilter expo(&image(), &image());
expo.startFilterDirectly();
image().putImageData(expo.getTargetImage().bits());
applyFilter(&expo);
break;
}
}
......
......@@ -107,8 +107,7 @@ bool BCGCorrection::toolOperations()
prm.gamma = settings()["Gamma"].toDouble();
BCGFilter bcg(&image(), 0L, prm);
bcg.startFilterDirectly();
image().putImageData(bcg.getTargetImage().bits());
applyFilter(&bcg);
return (savefromDImg());
}
......
......@@ -151,8 +151,7 @@ bool BWConvert::toolOperations()
*/
BWSepiaFilter bw(&image(), 0L, prm);
bw.startFilterDirectly();
image().putImageData(bw.getTargetImage().bits());
applyFilter(&bw);
return (savefromDImg());
}
......
......@@ -175,8 +175,7 @@ bool ChannelMixer::toolOperations()
prm.blackBlueGain = settings()["blackBlueGain"].toDouble();
MixerFilter mixer(&image(), 0L, prm);
mixer.startFilterDirectly();
image().putImageData(mixer.getTargetImage().bits());
applyFilter(&mixer);
return (savefromDImg());
}
......
......@@ -107,8 +107,7 @@ bool ColorBalance::toolOperations()
prm.blue = settings()["Blue"].toDouble();
CBFilter cb(&image(), 0L, prm);
cb.startFilterDirectly();
image().putImageData(cb.getTargetImage().bits());
applyFilter(&cb);
return (savefromDImg());
}
......
......@@ -32,6 +32,7 @@
// Local includes
#include "dimg.h"
#include "dimgbuiltinfilter.h"
namespace Digikam
{
......@@ -56,7 +57,8 @@ bool Convert16to8::toolOperations()
return false;
}
image().convertDepth(32);
DImgBuiltinFilter filter(DImgBuiltinFilter::ConvertTo8Bit);
applyFilter(&filter);
return (savefromDImg());
}
......
......@@ -32,6 +32,7 @@
// Local includes
#include "dimg.h"
#include "dimgbuiltinfilter.h"
namespace Digikam
{
......@@ -56,7 +57,8 @@ bool Convert8to16::toolOperations()
return false;
}
image().convertDepth(64);
DImgBuiltinFilter filter(DImgBuiltinFilter::ConvertTo16Bit);
applyFilter(&filter);
return (savefromDImg());
}
......
......@@ -163,8 +163,7 @@ bool CurvesAdjust::toolOperations()
prm.values[AlphaChannel] = settings()["values[AlphaChannel]"].value<QPolygon>();
CurvesFilter curves(&image(), 0L, prm);
curves.startFilterDirectly();
image().putImageData(curves.getTargetImage().bits());
applyFilter(&curves);
return (savefromDImg());
}
......
......@@ -111,8 +111,7 @@ bool HSLCorrection::toolOperations()
prm.vibrance = settings()["Vibrance"].toDouble();
HSLFilter hsl(&image(), 0L, prm);
hsl.startFilterDirectly();
image().putImageData(hsl.getTargetImage().bits());
applyFilter(&hsl);
return (savefromDImg());
}
......
......@@ -119,13 +119,14 @@ bool IccConvert::toolOperations()
transform.setOutputProfile(out);
IccTransformFilter icc(&image(), 0L, transform);
icc.startFilterDirectly();
DImg imDest = icc.getTargetImage();
image().putImageData(imDest.bits());
image().setIccProfile(imDest.getIccProfile());
applyFilter(&icc);
image().setIccProfile(icc.getTargetImage().getIccProfile());
DMetadata meta(image().getMetadata());
meta.removeExifColorSpace();
image().setMetadata(meta.data());
return (savefromDImg());
}
......
......@@ -62,8 +62,7 @@ bool Invert::toolOperations()
}
InvertFilter inv(&image(), 0L);
inv.startFilterDirectly();
image().putImageData(inv.getTargetImage().bits());
applyFilter(&inv);
return (savefromDImg());
}
......
......@@ -126,9 +126,8 @@ bool WhiteBalance::toolOperations()
prm.saturation = settings()["saturation"].toDouble();
prm.exposition = settings()["exposition"].toDouble();
WBFilter bcg(&image(), 0L, prm);
bcg.startFilterDirectly();
image().putImageData(bcg.getTargetImage().bits());
WBFilter wb(&image(), 0L, prm);
applyFilter(&wb);
return (savefromDImg());
}
......
......@@ -162,9 +162,7 @@ bool Border::toolOperations()
prm.orgHeight = image().height();
BorderFilter bd(&image(), 0L, prm);
bd.startFilterDirectly();
DImg trg = bd.getTargetImage();
image().putImageData(trg.width(), trg.height(), trg.sixteenBit(), trg.hasAlpha(), trg.bits());
applyFilterChangedProperties(&bd);
return (savefromDImg());
}
......
......@@ -558,6 +558,8 @@ bool WaterMark::toolOperations()
break;
}
// TODO: Create watermark filter, move code there, implement FilterAction
image().bitBlendImage(composer, &watermarkImage, 0, 0, watermarkImage.width(), watermarkImage.height(),
watermarkRect.left(), watermarkRect.top());
......
......@@ -131,8 +131,7 @@ bool AntiVignetting::toolOperations()
prm.yshift = settings()["yshift"].toDouble();
AntiVignettingFilter vig(&image(), 0L, prm);
vig.startFilterDirectly();
image().putImageData(vig.getTargetImage().bits());
applyFilter(&vig);
return (savefromDImg());
}
......
......@@ -113,8 +113,7 @@ bool Blur::toolOperations()
double radius = settings()["Radius"].toInt();
BlurFilter blur(&image(), 0L, radius);
blur.startFilterDirectly();
image().putImageData(blur.getTargetImage().bits());
applyFilter(&blur);
return savefromDImg();
}
......
......@@ -225,11 +225,12 @@ bool LensAutoFix::toolOperations()
}
LensFunFilter filter(&image(), 0L, prm);
filter.startFilterDirectly();
image().putImageData(filter.getTargetImage().bits());
applyFilter(&filter);
KExiv2Data data = image().getMetadata();
filter.registerSettingsToXmp(data);
image().setMetadata(data);
return savefromDImg();
}
......
......@@ -184,8 +184,7 @@ bool LocalContrast::toolOperations()
prm.stage[3].blur = settings()["stage4_blur"].toDouble();
LocalContrastFilter lc(&image(), 0L, prm);
lc.startFilterDirectly();
image().putImageData(lc.getTargetImage().bits());
applyFilter(&lc);
return (savefromDImg());
}
......
......@@ -124,8 +124,7 @@ bool NoiseReduction::toolOperations()
prm.softness[2] = settings()["CbSoftness"].toDouble();
NRFilter wnr(&image(), 0L, prm);
wnr.startFilterDirectly();
image().putImageData(wnr.getTargetImage().bits());
applyFilter(&wnr);
return (savefromDImg());
}
......
......@@ -152,14 +152,9 @@ bool Restoration::toolOperations()
m_cimgIface->setOriginalImage(image());
m_cimgIface->setSettings(settings);
m_cimgIface->setup();
m_cimgIface->startFilterDirectly();
if (isCancelled())
{
return false;
}
applyFilter(m_cimgIface);
image().putImageData(m_cimgIface->getTargetImage().bits());
delete m_cimgIface;
m_cimgIface = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment