本文整理汇总了C++中KisPaintDeviceSP::write方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::write方法的具体用法?C++ KisPaintDeviceSP::write怎么用?C++ KisPaintDeviceSP::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testStore
void KisPaintDeviceTest::testStore()
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
KoStore * readStore =
KoStore::createStore(QString(FILES_DATA_DIR) + QDir::separator() + "store_test.kra", KoStore::Read);
readStore->open("built image/layers/layer0");
QVERIFY(dev->read(readStore->device()));
readStore->close();
delete readStore;
QVERIFY(dev->exactBounds() == QRect(0, 0, 100, 100));
KoStore * writeStore =
KoStore::createStore(QString(FILES_OUTPUT_DIR) + QDir::separator() + "store_test_out.kra", KoStore::Write);
KisFakePaintDeviceWriter fakeWriter(writeStore);
writeStore->open("built image/layers/layer0");
QVERIFY(dev->write(fakeWriter));
writeStore->close();
delete writeStore;
KisPaintDeviceSP dev2 = new KisPaintDevice(cs);
readStore =
KoStore::createStore(QString(FILES_OUTPUT_DIR) + QDir::separator() + "store_test_out.kra", KoStore::Read);
readStore->open("built image/layers/layer0");
QVERIFY(dev2->read(readStore->device()));
readStore->close();
delete readStore;
QVERIFY(dev2->exactBounds() == QRect(0, 0, 100, 100));
QPoint pt;
if (!TestUtil::comparePaintDevices(pt, dev, dev2)) {
QFAIL(QString("Loading a saved image is not pixel perfect, first different pixel: %1,%2 ").arg(pt.x()).arg(pt.y()).toLatin1());
}
}
示例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;
}