本文整理汇总了C++中KisImageSP::nlayers方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::nlayers方法的具体用法?C++ KisImageSP::nlayers怎么用?C++ KisImageSP::nlayers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::nlayers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLoading
void KisKraLoaderTest::testLoading()
{
KisDocument *doc = KisPart::instance()->createDocument();
doc->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
KisImageSP image = doc->image();
image->lock();
QCOMPARE(image->nlayers(), 12);
QCOMPARE(doc->documentInfo()->aboutInfo("title"), QString("test image for loading"));
QCOMPARE(image->height(), 753);
QCOMPARE(image->width(), 1000);
QCOMPARE(image->colorSpace()->id(), KoColorSpaceRegistry::instance()->rgb8()->id());
KisNodeSP node = image->root()->firstChild();
QVERIFY(node);
QCOMPARE(node->name(), QString("Background"));
QVERIFY(node->inherits("KisPaintLayer"));
node = node->nextSibling();
QVERIFY(node);
QCOMPARE(node->name(), QString("Group 1"));
QVERIFY(node->inherits("KisGroupLayer"));
QCOMPARE((int) node->childCount(), 2);
delete doc;
}
示例2: testObligeSingleChildImpl
void testObligeSingleChildImpl(bool transpDefaultPixel)
{
QString id = !transpDefaultPixel ?
"single_layer_no_channel_flags_nontransp_def_pixel.kra" :
"single_layer_no_channel_flags_transp_def_pixel.kra";
QString fileName = TestUtil::fetchDataFileLazy(id);
KisDocument *doc = KisPart::instance()->createDocument();
doc->loadNativeFormat(fileName);
KisImageSP image = doc->image();
QVERIFY(image);
QCOMPARE(image->nlayers(), 2);
KisNodeSP root = image->root();
KisNodeSP child = root->firstChild();
QVERIFY(child);
QCOMPARE(root->original(), root->projection());
if (transpDefaultPixel) {
QCOMPARE(root->original(), child->projection());
} else {
QVERIFY(root->original() != child->projection());
}
delete doc;
}
示例3: testOrdering
void KisLayerTest::testOrdering()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA", 0);
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
KisLayerSP layer1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP layer2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP layer3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
QVERIFY(layer1->name() == "layer1");
QVERIFY(layer2->name() == "layer2");
QVERIFY(layer3->name() == "layer3");
/*
+---------+
| layer 2 |
| layer 3 |
| layer 1 |
|root |
+---------+
*/
QVERIFY(image->addNode(layer1, image->rootLayer()));
QVERIFY(image->addNode(layer2, image->rootLayer()));
QVERIFY(image->addNode(layer3, image->rootLayer(), layer1));
QCOMPARE((int) image->nlayers(), 4);
QVERIFY(layer1->parent() == image->root());
QVERIFY(layer2->parent() == image->root());
QVERIFY(layer3->parent() == image->root());
QVERIFY(image->rootLayer()->firstChild() == layer1.data());
QVERIFY(image->rootLayer()->lastChild() == layer2.data());
QVERIFY(image->rootLayer()->at(0) == layer1.data());
QVERIFY(image->rootLayer()->at(1) == layer3.data());
QVERIFY(image->rootLayer()->at(2) == layer2.data());
QVERIFY(image->rootLayer()->index(layer1) == 0);
QVERIFY(image->rootLayer()->index(layer3) == 1);
QVERIFY(image->rootLayer()->index(layer2) == 2);
QVERIFY(layer3->prevSibling() == layer1.data());
QVERIFY(layer2->prevSibling() == layer3.data());
QVERIFY(layer1->prevSibling() == 0);
QVERIFY(layer3->nextSibling() == layer2.data());
QVERIFY(layer2->nextSibling() == 0);
QVERIFY(layer1->nextSibling() == layer3.data());
/*
+---------+
| layer 3 |
| layer 2 |
| layer 1 |
|root |
+---------+
*/
QVERIFY(image->moveNode(layer2, image->rootLayer(), layer1));
QVERIFY(image->rootLayer()->at(0) == layer1.data());
QVERIFY(image->rootLayer()->at(1) == layer2.data());
QVERIFY(image->rootLayer()->at(2) == layer3.data());
QVERIFY(image->rootLayer()->firstChild() == layer1.data());
QVERIFY(image->rootLayer()->lastChild() == layer3.data());
QVERIFY(image->rootLayer()->index(layer1) == 0);
QVERIFY(image->rootLayer()->index(layer2) == 1);
QVERIFY(image->rootLayer()->index(layer3) == 2);
QVERIFY(layer3->prevSibling() == layer2.data());
QVERIFY(layer2->prevSibling() == layer1.data());
QVERIFY(layer1->prevSibling() == 0);
QVERIFY(layer3->nextSibling() == 0);
QVERIFY(layer2->nextSibling() == layer3.data());
QVERIFY(layer1->nextSibling() == layer2.data());
}