本文整理汇总了C++中KisPaintDeviceSP::defaultPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::defaultPixel方法的具体用法?C++ KisPaintDeviceSP::defaultPixel怎么用?C++ KisPaintDeviceSP::defaultPixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::defaultPixel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLoadAnimated
void KisKraLoaderTest::testLoadAnimated()
{
KisDocument *doc = KisPart::instance()->createDocument();
doc->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test_animation.kra");
KisImageSP image = doc->image();
KisNodeSP node1 = image->root()->firstChild();
KisNodeSP node2 = node1->nextSibling();
QVERIFY(node1->inherits("KisPaintLayer"));
QVERIFY(node2->inherits("KisPaintLayer"));
KisPaintLayerSP layer1 = qobject_cast<KisPaintLayer*>(node1.data());
KisPaintLayerSP layer2 = qobject_cast<KisPaintLayer*>(node2.data());
KisKeyframeChannel *channel1 = layer1->getKeyframeChannel(KisKeyframeChannel::Content.id());
KisKeyframeChannel *channel2 = layer2->getKeyframeChannel(KisKeyframeChannel::Content.id());
QCOMPARE(channel1->keyframeCount(), 3);
QCOMPARE(channel2->keyframeCount(), 1);
QCOMPARE(image->animationInterface()->framerate(), 17);
QCOMPARE(image->animationInterface()->fullClipRange(), KisTimeRange::fromTime(15, 45));
QCOMPARE(image->animationInterface()->currentTime(), 19);
KisPaintDeviceSP dev = layer1->paintDevice();
const KoColorSpace *cs = dev->colorSpace();
KoColor transparent(Qt::transparent, cs);
KoColor white(Qt::white, cs);
KoColor red(Qt::red, cs);
image->animationInterface()->switchCurrentTimeAsync(0);
image->waitForDone();
QCOMPARE(dev->exactBounds(), QRect(506, 378, 198, 198));
QCOMPARE(dev->x(), -26);
QCOMPARE(dev->y(), -128);
QCOMPARE(dev->defaultPixel(), transparent);
image->animationInterface()->switchCurrentTimeAsync(20);
image->waitForDone();
QCOMPARE(dev->nonDefaultPixelArea(), QRect(615, 416, 129, 129));
QCOMPARE(dev->x(), 502);
QCOMPARE(dev->y(), 224);
QCOMPARE(dev->defaultPixel(), white);
image->animationInterface()->switchCurrentTimeAsync(30);
image->waitForDone();
QCOMPARE(dev->nonDefaultPixelArea(), QRect(729, 452, 45, 44));
QCOMPARE(dev->x(), 645);
QCOMPARE(dev->y(), -10);
QCOMPARE(dev->defaultPixel(), red);
}
示例2: savePaintDevice
bool KisKraSaveVisitor::savePaintDevice(KisPaintDeviceSP device,
QString location)
{
// Layer data
KisConfig cfg;
m_store->setCompressionEnabled(cfg.compressKra());
if (m_store->open(location)) {
if (!device->write(*m_writer)) {
device->disconnect();
m_store->close();
return false;
}
m_store->close();
}
if (m_store->open(location + ".defaultpixel")) {
m_store->write((char*)device->defaultPixel(), device->colorSpace()->pixelSize());
m_store->close();
}
m_store->setCompressionEnabled(true);
return true;
}