// Swift's SelectionClipboard extension: Copy, Copy Merged, Paste. public: // Ctrl+X: copy, then clear the selected pixels. void cutSelection(std::function done = {}); // What Paste puts back in place, until another copy. const std::optional &pixelClipboard() const; // The layers Copy took whole, until another copy. const std::optional &copiedLayer() const; // Whether the clipboard still holds this very copy. static bool clipboardHolds(const QPointer &data); // Every selected layer, a folder with all it holds. void duplicateActiveLayer(); // Each layer copied as one step; the copies end selected. void duplicateLayers(const std::vector &ids, const QString &editName = QStringLiteral("Duplicate Layer")); bool duplicateLayer(QUuid id, std::optional parent, std::optional above = std::nullopt, bool atBottom = false); std::optional selectionCopyRegion() const; bool canCopyPixels() const; // Copy with no selection takes the layers themselves. bool canCopyLayer() const; std::optional renderSelectedPixels(const ImageLayer &layer, bool mask) const; bool canCopyMerged() const; std::optional renderMergedPixels() const; void copyMergedSelection(); void copySelection(); bool canPaste() const; void paste(); void layerViaCopy(); // A shape or text style is tied to its asset. void addPixelLayer(const QImage &image, QPointF origin, const QString &name, const QString &editName, bool dropsSelection = true, const std::optional &shape = std::nullopt, const std::optional &text = std::nullopt); QString nextLayerName() const; private: void store(const CopiedPixels &copied); std::vector copiedLayerIDs() const; std::optional insertCopy(QUuid id);