本文整理汇总了C++中KisFixedPaintDeviceSP::convertTo方法的典型用法代码示例。如果您正苦于以下问题:C++ KisFixedPaintDeviceSP::convertTo方法的具体用法?C++ KisFixedPaintDeviceSP::convertTo怎么用?C++ KisFixedPaintDeviceSP::convertTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisFixedPaintDeviceSP
的用法示例。
在下文中一共展示了KisFixedPaintDeviceSP::convertTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testCopyMasking
//#define SAVE_OUTPUT_IMAGES
void KisAutoBrushTest::testCopyMasking()
{
int w = 64;
int h = 64;
int x = 0;
int y = 0;
QRect rc(x, y, w, h);
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor black(Qt::black, cs);
KoColor red(Qt::red, cs);
KisPaintDeviceSP tempDev = new KisPaintDevice(cs);
tempDev->fill(0, 0, w, h, red.data());
#ifdef SAVE_OUTPUT_IMAGES
tempDev->convertToQImage(0).save("tempDev.png");
#endif
KisCircleMaskGenerator * mask = new KisCircleMaskGenerator(w, 1.0, 0.5, 0.5, 2, true);
KisAutoBrush brush(mask, 0, 0);
KisFixedPaintDeviceSP maskDab = new KisFixedPaintDevice(cs);
brush.mask(maskDab, black, KisDabShape(), KisPaintInformation());
maskDab->convertTo(KoColorSpaceRegistry::instance()->alpha8());
#ifdef SAVE_OUTPUT_IMAGES
maskDab->convertToQImage(0, 0, 0, 64, 64).save("maskDab.png");
#endif
QCOMPARE(tempDev->exactBounds(), rc);
QCOMPARE(maskDab->bounds(), rc);
KisFixedPaintDeviceSP dev2fixed = new KisFixedPaintDevice(cs);
dev2fixed->setRect(rc);
dev2fixed->initialize();
tempDev->readBytes(dev2fixed->data(), rc);
dev2fixed->convertToQImage(0).save("converted-tempDev-to-fixed.png");
KisPaintDeviceSP dev = new KisPaintDevice(cs);
KisPainter painter(dev);
painter.setCompositeOp(COMPOSITE_COPY);
painter.bltFixedWithFixedSelection(x, y, dev2fixed, maskDab, 0, 0, 0, 0, rc.width(), rc.height());
//painter.bitBltWithFixedSelection(x, y, tempDev, maskDab, 0, 0, 0, 0, rc.width(), rc.height());
#ifdef SAVE_OUTPUT_IMAGES
dev->convertToQImage(0).save("final.png");
#endif
}
示例2: testColorSpaceConversion
void KisFixedPaintDeviceTest::testColorSpaceConversion()
{
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "tile.png");
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->rgb8();
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->lab16();
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(srcCs);
dev->convertFromQImage(image, 0);
dev->convertTo(dstCs);
QVERIFY(dev->bounds() == QRect(0, 0, image.width(), image.height()));
QVERIFY(dev->pixelSize() == dstCs->pixelSize());
QVERIFY(*dev->colorSpace() == *dstCs);
}