本文整理汇总了C++中DImg::size方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::size方法的具体用法?C++ DImg::size怎么用?C++ DImg::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preparePreview
void LensAutoFixTool::preparePreview()
{
// Settings information must be get before to disable settings view.
LensFunContainer settings = d->cameraSelector->settings();
d->settingsView->assignFilterSettings(settings);
ImageIface* const iface = d->previewWidget->imageIface();
DImg preview = iface->preview();
if (d->showGrid->isChecked())
{
QBitmap pattern(9, 9);
pattern.clear();
QPainter p1(&pattern);
p1.setPen(QPen(Qt::black, 1));
p1.drawLine(5, 0, 5, 9);
p1.drawLine(0, 5, 9, 5);
p1.end();
QPixmap pix(preview.size());
pix.fill(Qt::transparent);
QPainter p2(&pix);
p2.setPen(QPen(Qt::gray, 1));
p2.fillRect(0, 0, pix.width(), pix.height(), QBrush(pattern));
p2.end();
DImg grid(pix.toImage());
DColorComposer* const composer = DColorComposer::getComposer(DColorComposer::PorterDuffNone);
DColorComposer::MultiplicationFlags flags = DColorComposer::NoMultiplication;
// Do alpha blending of template on dest image
preview.bitBlendImage(composer, &grid, 0, 0, preview.width(), preview.height(), 0, 0, flags);
}
setFilter(new LensFunFilter(&preview, this, settings));
}
示例2: testActions
void DImageFilterActionTest::testActions()
{
QStringList files = QDir(imagePath()).entryList(QDir::Files);
files.removeOne(originalImage());
DImg original(imagePath() + originalImage());
QVERIFY(!original.isNull());
foreach (const QString& fileName, files)
{
DImg ref(imagePath() + fileName);
QVERIFY(!ref.isNull());
DImageHistory history = ref.getImageHistory();
FilterActionFilter filter;
filter.setFilterActions(history.allActions());
QVERIFY(filter.isReproducible() || filter.isComplexAction());
filter.setupFilter(original.copy());
filter.startFilterDirectly();
qDebug() << filter.filterActions().size();
DImg img = filter.getTargetImage();
QVERIFY(ref.size() == img.size());
bool isEqual = true;
DImg diff(ref.width(), ref.height(), ref.sixteenBit());
diff.fill(DColor(Qt::black));
for (uint x=0; x<ref.width(); x++)
{
for (uint y=0; y<ref.height(); y++)
{
DColor cref = ref.getPixelColor(x,y);
DColor cres = img.getPixelColor(x,y);
if (cref.red() != cres.red() || cref.green() != cres.green() || cref.blue() != cres.blue())
{
//qDebug() << x << y;
diff.setPixelColor(x,y, DColor(Qt::white));
isEqual = false;
}
}
}
if (!isEqual)
{
showDiff(original, ref, img, diff);
}
QVERIFY(isEqual);
}
示例3: setSelection
void ImageIface::setSelection(const QString& caller, const FilterAction& action, const DImg& img)
{
if (img.hasAlpha() != originalHasAlpha() ||
img.sixteenBit() != originalSixteenBit() ||
img.size() != selectionRect().size()
)
{
kDebug() << "Properties of image to overwrite selection differs than original image";
return;
}
if (img.isNull())
{
kDebug() << "No image data to handle";
return;
}
d->core->putImgSelection(caller, action, img);
}
示例4: setImage
void PanIconWidget::setImage(int previewWidth, int previewHeight, const DImg& image)
{
DImg img = DImg(image).smoothScale(previewWidth, previewHeight, Qt::KeepAspectRatio);
setImage(img.copyQImage(), image.size());
}