void DImgBuiltinFilter::apply(DImg& image) const { switch (m_type) { case NoOperation: break; case Rotate90: image.rotate(DImg::ROT90); break; case Rotate180: image.rotate(DImg::ROT180); break; case Rotate270: image.rotate(DImg::ROT270); break; case FlipHorizontally: image.flip(DImg::HORIZONTAL); break; case FlipVertically: image.flip(DImg::VERTICAL); break; case Crop: image.crop(m_arg.toRect()); break; case Resize: { QSize s = m_arg.toSize(); image.resize(s.width(), s.height()); break; } case ConvertTo8Bit: image.convertToEightBit(); break; case ConvertTo16Bit: image.convertToSixteenBit(); break; } }
void RatioCropTool::finalRendering() { qApp->setOverrideCursor( Qt::WaitCursor ); QRect currentRegion = d->imageSelectionWidget->getRegionSelection(); ImageIface* const iface = d->imageSelectionWidget->imageIface(); QRect normalizedRegion = getNormalizedRegion(); DImg imOrg = iface->original()->copy(); imOrg.crop(normalizedRegion); FilterAction action(QLatin1String("digikam:RatioCrop"), 1); action.setDisplayableName(i18n("Aspect Ratio Crop")); action.addParameter(QLatin1String("x"), currentRegion.x()); action.addParameter(QLatin1String("y"), currentRegion.y()); action.addParameter(QLatin1String("width"), currentRegion.width()); action.addParameter(QLatin1String("height"), currentRegion.height()); iface->setOriginal(i18n("Aspect Ratio Crop"), action, imOrg); qApp->restoreOverrideCursor(); writeSettings(); }