本文整理汇总了C++中KisPaintDeviceSP::move方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::move方法的具体用法?C++ KisPaintDeviceSP::move怎么用?C++ KisPaintDeviceSP::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::move方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
示例2: testColorSpaceConversion
void KisPaintDeviceTest::testColorSpaceConversion()
{
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "tile.png");
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->lab16();
KisPaintDeviceSP dev = new KisPaintDevice(srcCs);
dev->convertFromQImage(image, 0);
dev->move(10, 10); // Unalign with tile boundaries
KUndo2Command* cmd = dev->convertTo(dstCs);
QCOMPARE(dev->exactBounds(), QRect(10, 10, image.width(), image.height()));
QCOMPARE(dev->pixelSize(), dstCs->pixelSize());
QVERIFY(*dev->colorSpace() == *dstCs);
delete cmd;
}
示例3: testMoveWrapAround
void KisPaintDeviceTest::testMoveWrapAround()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = createWrapAroundPaintDevice(cs);
KoColor c1(Qt::red, cs);
KoColor c2(Qt::green, cs);
dev->setPixel(3, 3, c1);
dev->setPixel(18, 18, c2);
// QRect rc = dev->defaultBounds()->bounds();
//dev->convertToQImage(0, rc.x(), rc.y(), rc.width(), rc.height()).save("move0.png");
QCOMPARE(dev->exactBounds(), QRect(3,3,16,16));
dev->move(QPoint(10,10));
QCOMPARE(dev->exactBounds(), QRect(8,8,6,6));
//dev->convertToQImage(0, rc.x(), rc.y(), rc.width(), rc.height()).save("move1.png");
}
示例4: testFastBitBlt
void KisPaintDeviceTest::testFastBitBlt()
{
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dstDev = new KisPaintDevice(cs);
KisPaintDeviceSP srcDev = new KisPaintDevice(cs);
srcDev->convertFromQImage(image, 0);
QRect cloneRect(100,100,200,200);
QPoint errpoint;
QVERIFY(dstDev->fastBitBltPossible(srcDev));
dstDev->fastBitBlt(srcDev, 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, srcImage, dstImage)) {
QFAIL(QString("Failed to create identical image, first different pixel: %1,%2 \n").arg(errpoint.x()).arg(errpoint.y()).toLatin1());
}
// Test Rough version
dstDev->clear();
dstDev->fastBitBltRough(srcDev, cloneRect);
srcImage = srcDev->convertToQImage(0, cloneRect.x(), cloneRect.y(),
cloneRect.width(), cloneRect.height());
dstImage = dstDev->convertToQImage(0, cloneRect.x(), cloneRect.y(),
cloneRect.width(), cloneRect.height());
if (!TestUtil::compareQImages(errpoint, srcImage, dstImage)) {
QFAIL(QString("Failed to create identical image, first different pixel: %1,%2 \n").arg(errpoint.x()).arg(errpoint.y()).toLatin1());
}
srcDev->move(10,10);
QVERIFY(!dstDev->fastBitBltPossible(srcDev));
}
示例5: testGeometry
void KisPaintDeviceTest::testGeometry()
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
quint8* pixel = new quint8[cs->pixelSize()];
cs->fromQColor(Qt::white, pixel);
dev->fill(0, 0, 512, 512, pixel);
QCOMPARE(dev->exactBounds(), QRect(0, 0, 512, 512));
QCOMPARE(dev->extent(), QRect(0, 0, 512, 512));
dev->move(10, 10);
QCOMPARE(dev->exactBounds(), QRect(10, 10, 512, 512));
QCOMPARE(dev->extent(), QRect(10, 10, 512, 512));
dev->crop(50, 50, 50, 50);
QCOMPARE(dev->exactBounds(), QRect(50, 50, 50, 50));
QCOMPARE(dev->extent(), QRect(10, 10, 128, 128));
QColor c;
dev->clear(QRect(50, 50, 50, 50));
dev->pixel(80, 80, &c);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT_U8);
dev->fill(0, 0, 512, 512, pixel);
dev->pixel(80, 80, &c);
QVERIFY(c == Qt::white);
QVERIFY(c.alpha() == OPACITY_OPAQUE_U8);
dev->clear();
dev->pixel(80, 80, &c);
QVERIFY(c.alpha() == OPACITY_TRANSPARENT_U8);
QVERIFY(dev->extent().isEmpty());
QVERIFY(dev->exactBounds().isEmpty());
}
示例6: testCaching
void KisPaintDeviceTest::testCaching()
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
quint8* whitePixel = new quint8[cs->pixelSize()];
cs->fromQColor(Qt::white, whitePixel);
quint8* blackPixel = new quint8[cs->pixelSize()];
cs->fromQColor(Qt::black, blackPixel);
dev->fill(0, 0, 512, 512, whitePixel);
QImage thumb1 = dev->createThumbnail(50, 50);
QRect exactBounds1 = dev->exactBounds();
dev->fill(0, 0, 768, 768, blackPixel);
QImage thumb2 = dev->createThumbnail(50, 50);
QRect exactBounds2 = dev->exactBounds();
dev->move(10, 10);
QImage thumb3 = dev->createThumbnail(50, 50);
QRect exactBounds3 = dev->exactBounds();
dev->crop(50, 50, 50, 50);
QImage thumb4 = dev->createThumbnail(50, 50);
QRect exactBounds4 = dev->exactBounds();
QVERIFY(thumb1 != thumb2);
QVERIFY(thumb2 == thumb3); // Cache miss, but image is the same
QVERIFY(thumb3 != thumb4);
QVERIFY(thumb4 != thumb1);
QCOMPARE(exactBounds1, QRect(0,0,512,512));
QCOMPARE(exactBounds2, QRect(0,0,768,768));
QCOMPARE(exactBounds3, QRect(10,10,768,768));
QCOMPARE(exactBounds4, QRect(50,50,50,50));
}