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

Function GetCompositionFrameImage

exporter/src/utils/AEHelper.cpp:577–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577QImage 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
607void SetItemName(const AEGP_ItemH& itemHandle, const std::string& name) {
608 std::u16string u16str = Utf8ToUtf16(name);

Callers 2

updateFrameImageMethod · 0.85
CompareVideoCompositionFunction · 0.85

Calls 5

GetItemFrameRateFunction · 0.85
SetRenderTimeFunction · 0.85
GetRenderFrameSizeFunction · 0.85
GetRenderFrameFunction · 0.85
copyMethod · 0.80

Tested by

no test coverage detected