当前位置: 首页>>代码示例>>C++>>正文


C++ KisLayerSP::image方法代码示例

本文整理汇总了C++中KisLayerSP::image方法的典型用法代码示例。如果您正苦于以下问题:C++ KisLayerSP::image方法的具体用法?C++ KisLayerSP::image怎么用?C++ KisLayerSP::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KisLayerSP的用法示例。


在下文中一共展示了KisLayerSP::image方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mergeToLayer

void KisIndirectPaintingSupport::mergeToLayer(KisLayerSP layer, const QRegion &region, const QString &transactionText)
{
    /**
     * We do not apply selection here, because it has already
     * been taken into account in a tool code
     */
    KisPainter gc(layer->paintDevice());
    gc.setCompositeOp(d->compositeOp);
    gc.setOpacity(d->compositeOpacity);
    gc.setChannelFlags(layer->channelFlags());

    if (KisPaintLayer* paintLayer = dynamic_cast<KisPaintLayer*>(layer.data())) {
        if (paintLayer->alphaLocked()) {
            gc.setLockAlpha(paintLayer->alphaLocked());
        }
    }

    d->lock.lockForWrite();
    if(layer->image()) {
        gc.beginTransaction(transactionText);
    }

    foreach(const QRect& rc, region.rects()) {
        gc.bitBlt(rc.topLeft(), d->temporaryTarget, rc);
    }
    d->temporaryTarget = 0;

    // in the scratchpad the layer has no image and there is no undo adapter
    if(layer->image()) {
        gc.endTransaction(layer->image()->undoAdapter());
    }

    d->lock.unlock();
}
开发者ID:KDE,项目名称:calligra-history,代码行数:34,代码来源:kis_indirect_painting_support.cpp

示例2: run

void KisRecalculateTransformMaskJob::run()
{
    /**
     * The mask might have been deleted from the layers stack. In
     * such a case, don't try do update it.
     */
    if (!m_mask->parent()) return;

    m_mask->recaclulateStaticImage();

    KisLayerSP layer = dynamic_cast<KisLayer*>(m_mask->parent().data());

    if (!layer) {
        warnKrita << "WARNING: KisRecalculateTransformMaskJob::run() Mask has no parent layer! Skipping projection update!";
        return;
    }

    KisImageSP image = layer->image();
    Q_ASSERT(image);

    image->requestProjectionUpdateNoFilthy(layer, layer->extent(), image->bounds());
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:22,代码来源:kis_recalculate_transform_mask_job.cpp

示例3: testCreation

void KisLayerTest::testCreation()
{

    const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA", 0);
    KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");

    KisLayerSP layer = new TestLayer(image, "test", OPACITY_OPAQUE);
    QCOMPARE(layer->name(), QString("test"));
    QCOMPARE(layer->opacity(), OPACITY_OPAQUE);
    QCOMPARE(layer->image(), image);
    QCOMPARE(layer->colorSpace(), image->colorSpace());
    QCOMPARE(layer->visible(), true);
    QCOMPARE(layer->userLocked(), false);
    QCOMPARE(layer->temporary(), false);

    image->addNode(layer, image->rootLayer());

    QBitArray channels(4);
    channels.fill(true);
    layer->setChannelFlags(channels);
    QVERIFY(layer->channelFlags().count() == 4);
    QCOMPARE(layer->channelFlags().at(0), true);
    QCOMPARE(layer->channelFlags().at(1), true);
    QCOMPARE(layer->channelFlags().at(2), true);
    QCOMPARE(layer->channelFlags().at(3), true);


    layer->setOpacity(OPACITY_TRANSPARENT);
    QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT);
    layer->setPercentOpacity(100);
    QCOMPARE(layer->opacity(), OPACITY_OPAQUE);
    layer->setPercentOpacity(0);
    QCOMPARE(layer->opacity(), OPACITY_TRANSPARENT);


}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例4: play

void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info) const
{
    dbgUI << "Play recorded paint action on node : " << node->name() ;
    KisTransaction * cmd = 0;
    if (info.undoAdapter()) cmd = new KisTransaction("", node->paintDevice());

    KisPaintDeviceSP target = 0;
    if (d->paintIncremental) {
        target = node->paintDevice();
    } else {
        target = new KisPaintDevice(node->paintDevice()->colorSpace());
    }

    KisPainter painter(target);

    KisImageSP image;
    KisNodeSP parent = node;
    while (image == 0 && parent->parent()) {
        // XXX: ugly!
        KisLayerSP layer = dynamic_cast<KisLayer*>(parent.data());
        if (layer) {
            image = layer->image();
        }
        parent = parent->parent();
    }

    painter.setPaintOpPreset(d->paintOpPreset, image);

    if (d->paintIncremental) {
        painter.setCompositeOp(d->compositeOp);
        painter.setOpacity(d->opacity);
    } else {
        painter.setCompositeOp(node->paintDevice()->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
        painter.setOpacity(OPACITY_OPAQUE);

    }

    painter.setPaintColor(d->foregroundColor);
    painter.setFillColor(d->backgroundColor);

    playPaint(info, &painter);

    if (!d->paintIncremental) {
        KisPainter painter2(node->paintDevice());
        painter2.setCompositeOp(d->compositeOp);
        painter2.setOpacity(d->opacity);
        
        QRegion r = painter.dirtyRegion();
        QVector<QRect> dirtyRects = r.rects();
        QVector<QRect>::iterator it = dirtyRects.begin();
        QVector<QRect>::iterator end = dirtyRects.end();
        while (it != end) {
            painter2.bitBlt(it->topLeft(), target, *it);
            ++it;
        }

        node->setDirty(painter2.dirtyRegion());
    } else {
        node->setDirty(painter.dirtyRegion());
    }
    if (info.undoAdapter()) info.undoAdapter()->addCommand(cmd);
}
开发者ID:,项目名称:,代码行数:62,代码来源:


注:本文中的KisLayerSP::image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。