本文整理汇总了C++中KisPaintDeviceSP::createThumbnailDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::createThumbnailDevice方法的具体用法?C++ KisPaintDeviceSP::createThumbnailDevice怎么用?C++ KisPaintDeviceSP::createThumbnailDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::createThumbnailDevice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void KisSmallTilesFilter::process(KisConstProcessingInformation srcInfo,
KisProcessingInformation dstInfo,
const QSize& size,
const KisFilterConfiguration* config,
KoUpdater* progressUpdater
) const
{
const KisPaintDeviceSP src = srcInfo.paintDevice();
KisPaintDeviceSP dst = dstInfo.paintDevice();
QPoint dstTopLeft = dstInfo.topLeft();
QPoint srcTopLeft = srcInfo.topLeft();
Q_ASSERT(!src.isNull());
Q_ASSERT(!dst.isNull());
//read the filter configuration values from the KisFilterConfiguration object
quint32 numberOfTiles = config->getInt("numberOfTiles", 2);
QRect srcRect = src->exactBounds();
int w = static_cast<int>(srcRect.width() / numberOfTiles);
int h = static_cast<int>(srcRect.height() / numberOfTiles);
KisPaintDeviceSP tile = KisPaintDeviceSP(0);
if (srcInfo.selection()) {
KisPaintDeviceSP tmp = new KisPaintDevice(src->colorSpace());
KisPainter gc(tmp);
gc.setCompositeOp(COMPOSITE_COPY);
gc.bitBlt(0, 0, src, srcTopLeft.x(), srcTopLeft.y(), size.width(), size.height());
tile = tmp->createThumbnailDevice(srcRect.width() / numberOfTiles, srcRect.height() / numberOfTiles);
} else {
tile = src->createThumbnailDevice(srcRect.width() / numberOfTiles, srcRect.height() / numberOfTiles);
}
if (tile.isNull()) return;
KisPainter gc(dst);
gc.setCompositeOp(COMPOSITE_COPY);
if (progressUpdater) {
progressUpdater->setRange(0, numberOfTiles);
}
if (srcInfo.selection()) {
gc.setSelection(srcInfo.selection());
}
for (uint y = 0; y < numberOfTiles; ++y) {
for (uint x = 0; x < numberOfTiles; ++x) {
gc.bitBlt(w * x, h * y, tile, 0, 0, w, h);
}
if (progressUpdater) progressUpdater->setValue(y);
}
gc.end();
}
示例2: processImpl
void KisSmallTilesFilter::processImpl(KisPaintDeviceSP device,
const QRect& /*applyRect*/,
const KisFilterConfiguration* config,
KoUpdater* progressUpdater
) const
{
Q_ASSERT(!device.isNull());
//read the filter configuration values from the KisFilterConfiguration object
quint32 numberOfTiles = config->getInt("numberOfTiles", 2);
QRect srcRect = device->exactBounds();
int w = static_cast<int>(srcRect.width() / numberOfTiles);
int h = static_cast<int>(srcRect.height() / numberOfTiles);
KisPaintDeviceSP tile = device->createThumbnailDevice(srcRect.width() / numberOfTiles, srcRect.height() / numberOfTiles);
if (tile.isNull()) return;
KisPainter gc(device);
gc.setCompositeOp(COMPOSITE_COPY);
if (progressUpdater) {
progressUpdater->setRange(0, numberOfTiles);
}
for (uint y = 0; y < numberOfTiles; ++y) {
for (uint x = 0; x < numberOfTiles; ++x) {
gc.bitBlt(w * x, h * y, tile, 0, 0, w, h);
}
if (progressUpdater) progressUpdater->setValue(y);
}
gc.end();
}
示例3: testThumbnail
void KisPaintDeviceTest::testThumbnail()
{
QImage image(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png");
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisPaintDeviceSP dev = new KisPaintDevice(cs);
dev->convertFromQImage(image, 0);
{
KisPaintDeviceSP thumb = dev->createThumbnailDevice(50, 50);
QRect rc = thumb->exactBounds();
QVERIFY(rc.width() <= 50);
QVERIFY(rc.height() <= 50);
}
{
QImage thumb = dev->createThumbnail(50, 50);
QVERIFY(!thumb.isNull());
QVERIFY(thumb.width() <= 50);
QVERIFY(thumb.height() <= 50);
image.save("kis_paint_device_test_test_thumbnail.png");
}
}