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