| 575 | } |
| 576 | |
| 577 | QImage GetCompositionFrameImage(const AEGP_ItemH& itemHandle, pag::Frame frame) { |
| 578 | if (itemHandle == nullptr) { |
| 579 | return {}; |
| 580 | } |
| 581 | AEGP_RenderOptionsH renderOptions = nullptr; |
| 582 | float frameRate = GetItemFrameRate(itemHandle); |
| 583 | |
| 584 | Suites->RenderOptionsSuite3()->AEGP_NewFromItem(PluginID, itemHandle, &renderOptions); |
| 585 | if (renderOptions == nullptr) { |
| 586 | return {}; |
| 587 | } |
| 588 | Suites->RenderOptionsSuite3()->AEGP_SetWorldType(renderOptions, AEGP_WorldType_8); |
| 589 | SetRenderTime(renderOptions, frameRate, frame); |
| 590 | |
| 591 | uint8_t* rgbaBytes = nullptr; |
| 592 | A_u_long stride = 0; |
| 593 | A_long width = 0; |
| 594 | A_long height = 0; |
| 595 | GetRenderFrameSize(renderOptions, stride, width, height); |
| 596 | if (width <= 0 || height <= 0 || stride <= 0) { |
| 597 | return {}; |
| 598 | } |
| 599 | rgbaBytes = new uint8_t[stride * height]; |
| 600 | GetRenderFrame(rgbaBytes, stride, stride, width, height, renderOptions); |
| 601 | QImage image(rgbaBytes, width, height, stride, QImage::Format_RGBA8888); |
| 602 | QImage saveImage = image.copy(); |
| 603 | delete[] rgbaBytes; |
| 604 | return saveImage; |
| 605 | } |
| 606 | |
| 607 | void SetItemName(const AEGP_ItemH& itemHandle, const std::string& name) { |
| 608 | std::u16string u16str = Utf8ToUtf16(name); |
no test coverage detected