本文整理汇总了C++中QuillImage::pixel方法的典型用法代码示例。如果您正苦于以下问题:C++ QuillImage::pixel方法的具体用法?C++ QuillImage::pixel怎么用?C++ QuillImage::pixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuillImage
的用法示例。
在下文中一共展示了QuillImage::pixel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLoadSameFilterTwice
void ut_load::testLoadSameFilterTwice()
{
QTemporaryFile testFile;
testFile.open();
QImage greenTestImage("/usr/share/quillimagefilter-tests/images/854x480_blue.png");
// Verify whether image exists
QVERIFY(!greenTestImage.isNull());
greenTestImage.save(testFile.fileName(), "jpg");
QuillImage target = QuillImage();
target.setFullImageSize(QSize(854, 480));
target.setArea(QRect(0, 0, 854, 480));
QuillImage target2 = QuillImage();
target2.setFullImageSize(QSize(854, 480));
target2.setArea(QRect(0, 0, 854, 480));
QuillImageFilter *filter =
QuillImageFilterFactory::createImageFilter("org.maemo.load");
filter->setOption(QuillImageFilter::FileName, testFile.fileName());
// Passing JPEG through the filter
QuillImage imageAfter = filter->apply(target);
// Passing JPEG through the filter
QuillImage imageAfter2 = filter->apply(target2);
// Checking the red channel value which should be always bigger than that of greeen channel
QVERIFY( qBlue(imageAfter.pixel(QPoint(0, 0))) > qGreen(imageAfter.pixel(QPoint(0, 0))) );
// Checking the red channel value which should be always bigger than that of greeen channel
QVERIFY( qBlue(imageAfter2.pixel(QPoint(0, 0))) > qGreen(imageAfter2.pixel(QPoint(0, 0))) );
delete filter;
}
示例2: testTransparency
void ut_load::testTransparency()
{
QTemporaryFile testFile;
testFile.open();
QImage image = Unittests::generatePaletteImage();
image = image.convertToFormat(QImage::Format_ARGB32);
image.setPixel(QPoint(0, 0), qRgba(255, 0, 0, 0));
image.setPixel(QPoint(0, 1), qRgba(255, 0, 0, 127));
image.save(testFile.fileName(), "png");
QuillImageFilter *filter =
QuillImageFilterFactory::createImageFilter("org.maemo.load");
filter->setOption(QuillImageFilter::FileName, testFile.fileName());
filter->setOption(QuillImageFilter::FileFormat, QString("png"));
filter->setOption(QuillImageFilter::BackgroundColor, QColor(qRgb(0, 0, 255)));
QuillImage imageAfter = filter->apply(image);
QCOMPARE(imageAfter.pixel(QPoint(0, 0)), qRgb(0, 0, 255));
QCOMPARE(imageAfter.pixel(QPoint(0, 1)), qRgb(127, 0, 128));
delete filter;
}
示例3: 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;
}