FVirtualBackgroundSource
自定义的背景。
C++
USTRUCT(BlueprintType)
struct FVirtualBackgroundSource
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource")
EBACKGROUND_SOURCE_TYPE background_source_type = EBACKGROUND_SOURCE_TYPE::BACKGROUND_COLOR;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource")
int64 color = 0xffffff;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource")
FString source = "";
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource")
EBACKGROUND_BLUR_DEGREE blur_degree = EBACKGROUND_BLUR_DEGREE::BLUR_DEGREE_HIGH;
FVirtualBackgroundSource(){}
FVirtualBackgroundSource(const agora::rtc::VirtualBackgroundSource & AgoraData){
background_source_type = static_cast<EBACKGROUND_SOURCE_TYPE>(AgoraData.background_source_type);
color = AgoraData.color;
source = AgoraData.source;
blur_degree = static_cast<EBACKGROUND_BLUR_DEGREE>(AgoraData.blur_degree);
}
agora::rtc::VirtualBackgroundSource CreateAgoraData() const {
agora::rtc::VirtualBackgroundSource AgoraData;
AgoraData.background_source_type = static_cast<agora::rtc::VirtualBackgroundSource::BACKGROUND_SOURCE_TYPE>(background_source_type);
AgoraData.color = color;
SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.source, this->source)
AgoraData.blur_degree = static_cast<agora::rtc::VirtualBackgroundSource::BACKGROUND_BLUR_DEGREE>(blur_degree);
return AgoraData;
}
void FreeAgoraData(agora::rtc::VirtualBackgroundSource& AgoraData) const {
SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.source)
}
};
background_source_type
自定义的背景。详见 EBACKGROUND_SOURCE_TYPE。
color
自定义的背景图颜色。格式为 RGB 定义下的十六进制整数,不带 # 号,如 0xFFB6C1 表示浅粉色。 默认值为 0xFFFFFF,表示白色。 取值范围为 [0x000000,0xffffff]。如果取值非法,SDK 会用白色背景图替换原背景图。
注意
该参数仅在自定义背景为以下类型时生效,具体效果如下:
- BACKGROUND_COLOR:背景图为该参数传入颜色的纯色图片。
- BACKGROUND_IMG:如果 source 中的图片使用了透明背景,则会使用该参数传入的颜色填充透明背景。
source
自定义背景的本地绝对路径。支持 PNG、JPG、MP4、 AVI、 MKV 和 FLV 格式。如果路径无效,SDK 会使用原背景图或 color 指定的纯色背景。
注意
该参数仅在自定义背景图类型为 BACKGROUND_IMG 或 BACKGROUND_VIDEO 时生效。