|
Krita Source Code Documentation
|
#include <kis_mimedata.h>
Inheritance diagram for KisMimeData:Public Member Functions | |
| void | deepCopyNodes () |
| QStringList | formats () const override |
| KisMimeData (QList< KisNodeSP > nodes, KisImageSP image, bool forceCopy=false) | |
| QList< KisNodeSP > | nodes () const |
| return the node set on this mimedata object – for internal use | |
Static Public Member Functions | |
| static KisDisplayConfig | displayConfigForMimePastes () |
| static bool | insertMimeLayers (const QMimeData *data, KisImageSP image, KisShapeController *shapeController, KisNodeDummy *parentDummy, KisNodeDummy *aboveThisDummy, bool copyNode, KisNodeInsertionAdapter *nodeInsertionAdapter, bool changeOffset=false, QPointF offset=QPointF(), KisProcessingApplicator *applicator=nullptr) |
| static KisNodeList | loadNodesFast (const QMimeData *data, KisImageSP image, KisShapeController *shapeController, bool ©Node) |
| static KisNodeList | loadNodesFastAndRecenter (const QPoint &preferredCenter, const QMimeData *data, KisImageSP image, KisShapeController *shapeController, bool ©Node) |
| static QMimeData * | mimeForLayers (const KisNodeList &nodes, KisImageSP image, bool forceCopy=false) |
| static QMimeData * | mimeForLayersDeepCopy (const KisNodeList &nodes, KisImageSP image, bool forceCopy) |
Protected Member Functions | |
| QVariant | retrieveData (const QString &mimetype, QMetaType preferredType) const override |
Static Private Member Functions | |
| static void | initializeExternalNode (KisNodeSP *nodes, KisImageSP srcImage, KisImageSP dstImage, KisShapeController *shapeController) |
| static KisNodeList | loadNonNativeNodes (const QMimeData *data, KisImageWSP image) |
| static KisNodeList | tryLoadInternalNodes (const QMimeData *data, KisImageSP image, KisShapeController *shapeController, bool ©Node) |
Private Attributes | |
| QRect | m_copiedBounds |
| bool | m_forceCopy |
| KisImageSP | m_image |
| QList< KisNodeSP > | m_nodes |
KisMimeData implements delayed retrieval of nodes for d&d and copy/paste.
TODO: implement support for the ora format.
Definition at line 28 of file kis_mimedata.h.
| KisMimeData::KisMimeData | ( | QList< KisNodeSP > | nodes, |
| KisImageSP | image, | ||
| bool | forceCopy = false ) |
Definition at line 62 of file kis_mimedata.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN, m_copiedBounds, m_nodes, nodes(), and KisLayerUtils::recursiveTightNodeVisibleBounds().
| void KisMimeData::deepCopyNodes | ( | ) |
For Cut/Copy/Paste operations we should detach the contents of the mime data from the actual image because the user can modify our image between the Copy/Cut and Paste calls. So we just copy all our nodes into the internal array.
It also fixes the problem of Cutting group layers. If we don't copy the node and all its children, it'll be deleted by the Cut operation and we will not be able to paste it correctly later.
Definition at line 103 of file kis_mimedata.cpp.
References m_image, m_nodes, and KisNode::setImage().
|
static |
Conversion options for mime clips when they are pasted into clipboard or fetched from clipboard (with user selecting "display" space)
On unmanaged compositors they should coinside with the space of the display. On managed ones they should be set to the default color space, e.g. sRGB.
When the surface is managed, we just put the data in sRGB mode, because the compositor expects untagged data to be sRGB.
Definition at line 77 of file kis_mimedata.cpp.
References KisDisplayConfig::conversionFlags, KisConfig::displayProfile(), KisPortingUtils::getScreenNumberForWidget(), KoColorSpaceRegistry::instance(), KisPlatformPluginInterfaceFactory::instance(), KisOpenGLModeProber::instance(), KisDisplayConfig::intent, KoColorConversionTransformation::internalConversionFlags(), KoColorConversionTransformation::internalRenderingIntent(), KisDisplayConfig::isHDR, KIS_SAFE_ASSERT_RECOVER, KoColorSpaceRegistry::p709SRGBProfile(), and KisDisplayConfig::profile.
|
override |
KisMimeData provides the following formats if a node has been set:
Definition at line 130 of file kis_mimedata.cpp.
References m_nodes.
|
staticprivate |
Definition at line 252 of file kis_mimedata.cpp.
References qFuzzyCompare(), KoShape::setTransformation(), KoShape::transformation(), KisImage::xRes(), and KisImage::yRes().
|
static |
We have the node juggler running, so it will delay the update of the generator layers that might be included into the paste. To avoid that we should forcefully to make it stop
Definition at line 487 of file kis_mimedata.cpp.
References KisNodeInsertionAdapter::addNodes(), KisProcessingApplicator::applyCommand(), correctNewNodeLocation(), KisSharedPtr< T >::data(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, loadNodesFast(), KisNodeInsertionAdapter::moveNodes(), KisNodeDummy::node(), nodes(), KisLayerUtils::recursiveApplyNodes(), KisImage::requestStrokeEnd(), KisBaseNode::setX(), KisBaseNode::setY(), KisBaseNode::x(), and KisBaseNode::y().
|
static |
Don't try to move a node originating from another image, just copy it.
Definition at line 448 of file kis_mimedata.cpp.
References loadNonNativeNodes(), nodes(), and tryLoadInternalNodes().
|
static |
Definition at line 472 of file kis_mimedata.cpp.
References KisBaseNode::exactBounds(), loadNodesFast(), nodes(), KisBaseNode::setX(), KisBaseNode::setY(), KisBaseNode::x(), and KisBaseNode::y().
|
staticprivate |
Loads a node from a mime container Supports image and color types.
Definition at line 338 of file kis_mimedata.cpp.
References KisImage::bounds(), KisSwatch::color(), KisPaintDevice::convertFromQImage(), KisWeakSharedPtr< T >::data(), KisPaintDevice::exactBounds(), KisBaseProcessor::factoryConfiguration(), KisSwatch::fromByteArray(), KisImage::globalSelection(), KisGeneratorRegistry::instance(), KoColorSpaceRegistry::instance(), KisGlobalResourcesInterface::instance(), KisImage::nextLayerName(), nodes(), OPACITY_OPAQUE_U8, KisBaseNode::projection(), KisBaseNode::setX(), KisBaseNode::setY(), KoColor::toQColor(), and KoGenericRegistry< T >::value().
|
static |
Definition at line 392 of file kis_mimedata.cpp.
References KisMimeData(), nodes(), KisNodeFacade::root, and KisLayerUtils::sortMergeableNodes().
|
static |
Definition at line 403 of file kis_mimedata.cpp.
References deepCopyNodes(), KisMimeData(), nodes(), KisNodeFacade::root, and KisLayerUtils::sortMergeableNodes().
return the node set on this mimedata object – for internal use
Definition at line 125 of file kis_mimedata.cpp.
References m_nodes.
|
overrideprotected |
HACK ALERT:
Sometimes Qt requests the data after destruction of Krita, we cannot load the nodes in that case, because we need signals and timers. So we just skip serializing.
Definition at line 198 of file kis_mimedata.cpp.
References KisDisplayConfig::conversionFlags, createDocument(), KisSharedPtr< T >::data(), KisDisplayConfig::intent, KisDisplayConfig::profile, and serializeToByteArray().
|
staticprivate |
Try load the node, which belongs to the same Krita instance, that is can be fetched without serialization
Definition at line 276 of file kis_mimedata.cpp.
References KisLayerUtils::addCopyOfNameTag(), initializeExternalNode(), m_forceCopy, m_image, and nodes().
|
private |
Definition at line 131 of file kis_mimedata.h.
|
private |
Definition at line 129 of file kis_mimedata.h.
|
private |
Definition at line 130 of file kis_mimedata.h.
Definition at line 128 of file kis_mimedata.h.