MCPcopy Create free account
hub / github.com/Tencent/libpag / ExportImageLayerEditable

Function ExportImageLayerEditable

exporter/src/export/Marker.cpp:645–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643}
644
645void ExportImageLayerEditable(std::shared_ptr<pag::File> file,
646 std::shared_ptr<PAGExportSession> session,
647 const AEGP_ItemH& itemHandle) {
648 if (!file || file->images.empty()) {
649 return;
650 }
651
652 auto imageCount = static_cast<int>(file->images.size());
653 std::vector<bool> isEditable(imageCount, false);
654 bool hasNonEditableImage = false;
655
656 for (int index = 0; index < file->numImages(); index++) {
657 const auto& layerVector = file->getImageAt(index);
658 for (const auto& layer : layerVector) {
659 if (layer->imageBytes == nullptr) {
660 continue;
661 }
662 if (IsImageLayerNonReplaceable(layer, itemHandle, session)) {
663 hasNonEditableImage = true;
664 continue;
665 }
666 for (int imageIndex = 0; imageIndex < imageCount; imageIndex++) {
667 const auto& image = file->images[imageIndex];
668 if (image->id == layer->imageBytes->id) {
669 isEditable[imageIndex] = true;
670 break;
671 }
672 }
673 }
674 }
675
676 if (hasNonEditableImage) {
677 file->editableImages = new std::vector<int>();
678 for (int index = 0; index < imageCount; index++) {
679 if (isEditable[index]) {
680 file->editableImages->push_back(index);
681 }
682 }
683 }
684}
685
686bool IsTextLayerNonReplaceable(const pag::TextLayer* layer, const AEGP_ItemH& itemHandle,
687 std::shared_ptr<PAGExportSession> session) {

Callers 1

ExportLayerEditableFunction · 0.85

Calls 6

emptyMethod · 0.80
sizeMethod · 0.80
getImageAtMethod · 0.80
push_backMethod · 0.80
numImagesMethod · 0.45

Tested by

no test coverage detected