本文整理汇总了C++中KisPaintDeviceSP::makeCloneFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::makeCloneFrom方法的具体用法?C++ KisPaintDeviceSP::makeCloneFrom怎么用?C++ KisPaintDeviceSP::makeCloneFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::makeCloneFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMakeClone
void KisPaintDeviceTest::testMakeClone()
{
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP srcDev = new KisPaintDevice(cs);
srcDev->convertFromQImage(image, 0);
srcDev->move(10,10);
const KoColorSpace * weirdCS = KoColorSpaceRegistry::instance()->lab16();
KisPaintDeviceSP dstDev = new KisPaintDevice(weirdCS);
dstDev->move(1000,1000);
QVERIFY(!dstDev->fastBitBltPossible(srcDev));
QRect cloneRect(100,100,200,200);
QPoint errpoint;
dstDev->makeCloneFrom(srcDev, cloneRect);
QVERIFY(*dstDev->colorSpace() == *srcDev->colorSpace());
QCOMPARE(dstDev->pixelSize(), srcDev->pixelSize());
QCOMPARE(dstDev->x(), srcDev->x());
QCOMPARE(dstDev->y(), srcDev->y());
QCOMPARE(dstDev->exactBounds(), cloneRect);
QImage srcImage = srcDev->convertToQImage(0, cloneRect.x(), cloneRect.y(),
cloneRect.width(), cloneRect.height());
QImage dstImage = dstDev->convertToQImage(0, cloneRect.x(), cloneRect.y(),
cloneRect.width(), cloneRect.height());
if (!TestUtil::compareQImages(errpoint, dstImage, srcImage)) {
QFAIL(QString("Failed to create identical image, first different pixel: %1,%2 \n").arg(errpoint.x()).arg(errpoint.y()).toLatin1());
}
}