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


C++ KisNodeSP类代码示例

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


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

示例1: removeKeyframes

    bool removeKeyframes(KisImageSP image, const FrameItemList &frames) {
        bool result = false;

        QScopedPointer<KUndo2Command> cmd(
            new KUndo2Command(kundo2_i18np("Remove Keyframe",
                                           "Remove Keyframes",
                                           frames.size()))); // lisp-lovers present ;)

        foreach (const FrameItem &item, frames) {
            const int time = item.time;
            KisNodeSP node = item.node;

            KisKeyframeChannel *content =
                node->getKeyframeChannel(KisKeyframeChannel::Content.id());

            if (!content) continue;

            KisKeyframeSP keyframe = content->keyframeAt(time);
            if (!keyframe) continue;

            content->deleteKeyframe(keyframe, cmd.data());

            result = true;
        }

        if (result) {
            image->postExecutionUndoAdapter()->addCommand(toQShared(cmd.take()));
        }

        return result;
    }
开发者ID:Developer626,项目名称:krita,代码行数:31,代码来源:kis_animation_utils.cpp

示例2: updateMask

    void updateMask(bool isHidden) {
        /**
         * Depending on whether the mask is hidden we should either
         * update it entirely via the setDirty() call, or we can use a
         * lightweight approach by directly regenerating the
         * precalculated static image using
         * KisRecalculateTransformMaskJob.
         */

        if (!isHidden) {
            KisRecalculateTransformMaskJob updateJob(m_mask);
            updateJob.run();
        } else {
            m_mask->recaclulateStaticImage();

            QRect updateRect = m_mask->extent();

            KisNodeSP parent = m_mask->parent();
            if (parent && parent->original()) {
                updateRect |= parent->original()->defaultBounds()->bounds();
            }

            m_mask->setDirty(updateRect);
        }
    }
开发者ID:ChrisJong,项目名称:krita,代码行数:25,代码来源:transform_stroke_strategy.cpp

示例3: loadNode

KisNodeSP KisKraLoader::loadNodes(const KoXmlElement& element, KisImageWSP image, KisNodeSP parent)
{

    KoXmlNode node = element.firstChild();
    KoXmlNode child;

    if (!node.isNull()) {

        if (node.isElement()) {

            if (node.nodeName().toUpper() == LAYERS.toUpper() || node.nodeName().toUpper() == MASKS.toUpper()) {
                for (child = node.lastChild(); !child.isNull(); child = child.previousSibling()) {
                    KisNodeSP node = loadNode(child.toElement(), image, parent);
                    if (node) {
                        image->nextLayerName(); // Make sure the nameserver is current with the number of nodes.
                        image->addNode(node, parent);
                        if (node->inherits("KisLayer") && child.childNodesCount() > 0) {
                            loadNodes(child.toElement(), image, node);
                        }
                    }
                }
            }
        }
    }

    return parent;
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:27,代码来源:kis_kra_loader.cpp

示例4: KisImageCommand

KisImageLayerRemoveCommand::KisImageLayerRemoveCommand(KisImageSP image, KisNodeSP layer)
        : KisImageCommand(i18n("Remove Layer"), image)
{
    m_layer = layer;
    m_prevParent = layer->parent();
    m_prevAbove = layer->prevSibling();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: refreshLayerMovementAbilities

    void refreshLayerMovementAbilities()
    {
        layerMeta.clear();
        if (layers.count() == 0)
            return;
        for(int i = 0; i < layers.count(); ++i)
        {
            const KisNodeSP layer = layers.at(i);
            LayerModelMetaInfo ability;

            if (i > 0)
                ability.canMoveUp = true;

            if (i < layers.count() - 1)
                ability.canMoveDown = true;

            KisNodeSP parent = layer;
            while(parent)
            {
                ++ability.depth;
                parent = parent->parent();
            }

            if (ability.depth > 1)
                ability.canMoveLeft = true;

            if (i < layers.count() - 1 && qobject_cast<const KisGroupLayer*>(layers.at(i + 1).constData()))
                ability.canMoveRight = true;

            layerMeta[layer] = ability;
        }
    }
开发者ID:HOST-Oman,项目名称:krita,代码行数:32,代码来源:LayerModel.cpp

示例6: Q_UNUSED

QRect KisFilterMask::needRect(const QRect& rect, PositionToFilthy pos) const
{
    Q_UNUSED(pos);

    /**
     * FIXME: This check of the emptiness should be done
     * on the higher/lower level
     */

    if(rect.isEmpty()) return rect;

    KisSafeFilterConfigurationSP filterConfig = filter();
    if (!filterConfig) return rect;

    KisNodeSP parent = this->parent();
    const int lod = parent && parent->projection() ?
        parent->projection()->defaultBounds()->currentLevelOfDetail() : 0;

    KisFilterSP filter = KisFilterRegistry::instance()->value(filterConfig->name());

    /**
     * If we need some additional pixels even outside of a selection
     * for accurate layer filtering, we'll get them!
     * And no KisMask::needRect will prevent us from doing this! ;)
     * That's why simply we do not call KisMask::needRect here :)
     */
    return filter->neededRect(rect, filterConfig.data(), lod);
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:28,代码来源:kis_filter_mask.cpp

示例7: filter

/**
 * FIXME: try to cache filter pointer inside a Private block
 */
QRect KisFilterMask::changeRect(const QRect &rect, PositionToFilthy pos) const
{
    /**
     * FIXME: This check of the emptiness should be done
     * on the higher/lower level
     */
    if(rect.isEmpty()) return rect;

    QRect filteredRect = rect;

    KisSafeFilterConfigurationSP filterConfig = filter();
    if (filterConfig) {
        KisNodeSP parent = this->parent();
        const int lod = parent && parent->projection() ?
            parent->projection()->defaultBounds()->currentLevelOfDetail() : 0;

        KisFilterSP filter = KisFilterRegistry::instance()->value(filterConfig->name());
        filteredRect = filter->changedRect(rect, filterConfig.data(), lod);
    }

    /**
     * We can't paint outside a selection, that is why we call
     * KisMask::changeRect to crop actual change area in the end
     */
    filteredRect = KisMask::changeRect(filteredRect, pos);
    /**
     * FIXME: Think over this solution
     * Union of rects means that changeRect returns NOT the rect
     * changed by this very layer, but an accumulated rect changed
     * by all underlying layers. Just take into account and change
     * documentation accordingly
     */
    return rect | filteredRect;
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:37,代码来源:kis_filter_mask.cpp

示例8: while

KisImageCommand::UpdateTarget::UpdateTarget(KisImageWSP image,
                                            KisNodeSP removedNode,
                                            const QRect &updateRect)
    : m_image(image), m_updateRect(updateRect)
{
    m_needsFullRefresh = false;

    if(!isLayer(removedNode)) {
        m_node = removedNode->parent();
    }
    else {
        m_node = removedNode;
        while((m_node = m_node->nextSibling()) && !isLayer(m_node));

        if(!m_node) {
            m_node = removedNode;
            while((m_node = m_node->prevSibling()) && !isLayer(m_node));
        }

        if(!m_node) {
            m_node = removedNode->parent();
            m_needsFullRefresh = true;
        }
    }
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:25,代码来源:kis_image_command.cpp

示例9: moveNode

bool KisNodeFacade::moveNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis)
{
    dbgImage << "moveNode " << node << " " << parent << " " << aboveThis;
    if (!node) {
        dbgImage << "cannot move null node"; return false;
    }
    if (!parent)  {
        dbgImage << "cannot move to null parent"; return false;
    }
    if (node == parent)  {
        dbgImage << "cannot move self inside self"; return false;
    }
    if (node == aboveThis)  {
        dbgImage << "cannot move self above self"; return false;
    }
    if (parent == aboveThis)  {
        dbgImage << "cannot move above parent"; return false;
    }
    if (!node->parent())  {
        dbgImage << "node does not have a parent"; return false;
    }

    if (aboveThis && aboveThis->parent() != parent)  {
        dbgImage << "above this parent is not the parent"; return false;
    }

    int newIndex = aboveThis ? parent->index(aboveThis) + 1 : 0;
    return moveNode(node, parent, newIndex);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:29,代码来源:kis_node_facade.cpp

示例10: findNode

    KisNodeSP findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly)
    {
        KisNodeSP foundNode = 0;
        while (node) {
            KisLayerSP layer = dynamic_cast<KisLayer*>(node.data());

            if (!layer || !layer->isEditable()) {
                node = node->prevSibling();
                continue;
            }

            KoColor color(layer->projection()->colorSpace());
            layer->projection()->pixel(point.x(), point.y(), &color);

            KisGroupLayerSP group = dynamic_cast<KisGroupLayer*>(layer.data());

            if ((group && group->passThroughMode()) ||  color.opacityU8() != OPACITY_TRANSPARENT_U8) {
                if (layer->inherits("KisGroupLayer") && (!editableOnly || layer->isEditable())) {
                    // if this is a group and the pixel is transparent, don't even enter it
                    foundNode = findNode(node->lastChild(), point, wholeGroup, editableOnly);
                }
                else {
                    foundNode = !wholeGroup ? node : node->parent();
                }

            }

            if (foundNode) break;

            node = node->prevSibling();
        }

        return foundNode;
    }
开发者ID:IGLOU-EU,项目名称:krita,代码行数:34,代码来源:kis_tool_utils.cpp

示例11: ClearSelection

void KisCutCopyActionFactory::run(bool willCut, KisView2 *view)
{
    KisImageSP image = view->image();
    bool haveShapesSelected = view->selectionManager()->haveShapesSelected();

    if (haveShapesSelected) {
#ifdef __GNUC__
#warning "Add saving of XML data for Cut/Copy of shapes"
#endif

        image->barrierLock();
        if (willCut) {
            view->canvasBase()->toolProxy()->cut();
        } else {
            view->canvasBase()->toolProxy()->copy();
        }
        image->unlock();
    } else {
        KisNodeSP node = view->activeNode();
        if (!node) return;

        image->barrierLock();
        ActionHelper::copyFromDevice(view, node->paintDevice());
        image->unlock();

        KUndo2Command *command = 0;

        if (willCut && node->isEditable()) {
            struct ClearSelection : public KisTransactionBasedCommand {
                ClearSelection(KisNodeSP node, KisSelectionSP sel)
                    : m_node(node), m_sel(sel) {}
                KisNodeSP m_node;
                KisSelectionSP m_sel;

                KUndo2Command* paint() {
                    KisTransaction transaction("", m_node->paintDevice());
                    m_node->paintDevice()->clearSelection(m_sel);
                    m_node->setDirty(m_sel->selectedRect());
                    return transaction.endAndTake();
                }
            };

            command = new ClearSelection(node, view->selection());
        }

        QString actionName = willCut ? i18n("Cut") : i18n("Copy");
        KisProcessingApplicator *ap = beginAction(view, actionName);

        if (command) {
            ap->applyCommand(command,
                             KisStrokeJobData::SEQUENTIAL,
                             KisStrokeJobData::NORMAL);
        }

        KisOperationConfiguration config(id());
        config.setProperty("will-cut", willCut);
        endAction(ap, config.toXML());
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:59,代码来源:kis_selection_action_factories.cpp

示例12: removeNode

bool KisNodeFacade::removeNode(KisNodeSP node)
{
    if (!node) return false;
    if (!node->parent()) return false;

    return node->parent()->remove(node);

}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:8,代码来源:kis_node_facade.cpp

示例13: deepChildCount

 int deepChildCount(KisNodeSP layer)
 {
     quint32 childCount = layer->childCount();
     QList<KisNodeSP> children = layer->childNodes(layerClassNames(), KoProperties());
     for(quint32 i = 0; i < childCount; ++i)
         childCount += deepChildCount(children.at(i));
     return childCount;
 }
开发者ID:HOST-Oman,项目名称:krita,代码行数:8,代码来源:LayerModel.cpp

示例14: findFirstLayer

KisNodeSP KisDummiesFacadeBase::findFirstLayer(KisNodeSP root)
{
    KisNodeSP child = root->firstChild();
    while(child && !child->inherits("KisLayer")) {
        child = child->nextSibling();
    }
    return child;
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:8,代码来源:kis_dummies_facade_base.cpp

示例15: toTop

bool KisNodeFacade::toTop(KisNodeSP node)
{
    if (!node) return false;
    if (!node->parent()) return false;
    if (node == node->parent()->lastChild()) return true;

    return moveNode(node, node->parent(), node->parent()->lastChild());

}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:9,代码来源:kis_node_facade.cpp


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