| 643 | } |
| 644 | |
| 645 | void 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 | |
| 686 | bool IsTextLayerNonReplaceable(const pag::TextLayer* layer, const AEGP_ItemH& itemHandle, |
| 687 | std::shared_ptr<PAGExportSession> session) { |
no test coverage detected