FThumbImageBuffer
The image content of the thumbnail or icon. Set in FScreenCaptureSourceInfo.
USTRUCT(BlueprintType) struct FThumbImageBuffer { GENERATED_BODY() public: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") UImage* Image = nullptr; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") TArray<uint8> buffer; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") int64 length = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") int64 width = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") int64 height = 0; #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) FThumbImageBuffer(){} FThumbImageBuffer(const agora::rtc::ThumbImageBuffer & AgoraData){ length = AgoraData.length; buffer.SetNumZeroed(length); for (int i = 0; i < length; i++) { this->buffer[i] = AgoraData.buffer[i]; } width = AgoraData.width; height = AgoraData.height; if(Image == nullptr){ Image = NewObject<UImage>(); } UTexture2D* RenderTexture = UTexture2D::CreateTransient(width, height, PF_R8G8B8A8); if(RenderTexture){ #if AG_UE5_OR_LATER uint8* RawData = (uint8*)RenderTexture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE); FMemory::Memcpy(RawData, AgoraData.buffer, width * height * 4); RenderTexture->GetPlatformData()->Mips[0].BulkData.Unlock(); RenderTexture->UpdateResource(); #else uint8* RawData = (uint8*)RenderTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); FMemory::Memcpy(RawData, AgoraData.buffer, width * height * 4); RenderTexture->PlatformData->Mips[0].BulkData.Unlock(); RenderTexture->UpdateResource(); #endif FSlateBrush RenderBrush; RenderBrush.SetResourceObject(RenderTexture); Image->SetBrush(RenderBrush); } } agora::rtc::ThumbImageBuffer CreateAgoraData() const { agora::rtc::ThumbImageBuffer AgoraData; char* TmpChar = new char[length]; for (int i = 0; i < length; i++) { TmpChar[i] = this->buffer[i]; } AgoraData.buffer = TmpChar; AgoraData.length = length; AgoraData.width = width; AgoraData.height = height; return AgoraData; } void FreeAgoraData(agora::rtc::ThumbImageBuffer & AgoraData) const { SET_UABT_GENERIC_PTR___MEMFREE(AgoraData.buffer) } #endif };
Note: The default image is in the ARGB format. If you need to use another format, you need to convert the image on your own.
Attributes
- buffer
- The buffer of the thumbnail or icon.
- length
- The buffer length of the thumbnail or icon, in bytes.
- width
- The actual width (px) of the thumbnail or icon.
- height
- The actual height (px) of the thumbnail or icon.