本文整理汇总了C++中DImg::crop方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::crop方法的具体用法?C++ DImg::crop怎么用?C++ DImg::crop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::crop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
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;
}
}
示例2: finalRendering
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();
}