本文整理汇总了C++中QuillImage::setTargetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QuillImage::setTargetSize方法的具体用法?C++ QuillImage::setTargetSize怎么用?C++ QuillImage::setTargetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuillImage
的用法示例。
在下文中一共展示了QuillImage::setTargetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLoadSetTargetSizeOnly
void ut_load::testLoadSetTargetSizeOnly()
{
QTemporaryFile testFile;
testFile.open();
Unittests::generatePaletteImage().save(testFile.fileName(), "jpg");
QuillImageFilter filter("com.meego.load");
filter.setOption(QuillImageFilter::FileName,
QVariant(testFile.fileName()));
filter.setOption(QuillImageFilter::MimeType,
QVariant("image/jpeg"));
QuillImage image;
image.setTargetSize(QSize(4, 1));
QuillImage loadedImage = filter.apply(image);
QCOMPARE(loadedImage.size(), QSize(4, 1));
}
示例2: testCropping
void ut_load::testCropping()
{
QuillImageFilter *filter =
QuillImageFilterFactory::createImageFilter("org.maemo.load");
QFile file("/usr/share/quillimagefilter-tests/images/16_color_palette.png");
filter->setOption(QuillImageFilter::FileName, QString(file.fileName()));
QuillImage target = QuillImage();
target.setTargetSize(QSize(1, 1));
target.setFullImageSize(QSize(8, 2));
target.setArea(QRect(2, 0, 2, 2));
QuillImage result = filter->apply(target);
QCOMPARE(result.size(), QSize(1, 1));
// Expect an average of the given area (png = smooth scaling).
QCOMPARE(qRed(result.pixel(QPoint(0,0))), 96);
QCOMPARE(qGreen(result.pixel(QPoint(0,0))), 193);
QCOMPARE(qBlue(result.pixel(QPoint(0,0))), 0);
delete filter;
}