Initialize an SDK context.
bool createContext(const std::string& serialNumber, const std::string& licensePath, const std::string& resDir, VenusType aiType = VN_All)
Parameter
Parameter | Description |
---|---|
serialNumber | License SN, acquired at time of OrangeFilter purchase |
licensePath | Writable path, for saving license information |
resDir | Root path for saving resources, including effect packages and AI model files |
aiType | AI recognition type |
Return Values
Return true for success and false for failure.
Remarks
There must be a rendering context before SDK initialization.
If SDK initialization fails, subsequent operations must be terminated.
Causes for SDK initialization failure:
Instance creation failed
Incorrect path, number, or name of model file
Destroy an SDK context.
void destroyContext()
Availability of Orange beautification SDK.
bool isContextValid()
Return Values
Return true for success and false for failure.
A return of false indicates the existing context is unavailable, either because it is not yet initialized or already destroyed.
Remarks
Check whether the rendering engine has been initialized.
Enable/Disable the effect type.
bool enableEffect(EffectType effectType, bool enabled)
Parameter
Parameter | Description |
---|---|
effectType | Effect type |
enabled | "true"-enabled; "false"-disabled |
Return Values
Return true for success and false for failure.
A return of false indicates a failure to enable the effect due to failing to create an instance failure. Check for problems in the effect package path.
Disable the effect type and free its memory.
bool releaseEffect(EffectType effectType)
Parameter
Parameter | Description |
---|---|
effectType | Effect type |
Return Values
Return true for success and false for failure.
Enable/Disable the gesture effect.
bool enableGesture(const std::string& path, bool enabled)
Parameter
Parameter | Description |
---|---|
path | Full path of the gesture effect package file |
enabled | "true"-enabled; "false"-disabled |
Return Values
Return true for success and false for failure.
A return of false indicates a failure to enable the effect package. Check for problems in the effect package path.
Disable the gesture effect package of the specified path and free its memory.
bool releaseGesture(const std::string& path)
Parameter
Parameter | Description |
---|---|
path | Full path of the gesture effect package file |
Return Values
Return true for success and false for failure.
A return of false indicates that the effect package given to the path has not been enabled.
Enable/Disable the sticker effect.
bool enableSticker(const std::string& path, bool enabled)
Parameter
Parameter | Description |
---|---|
path | Sticker effect package file full path |
enabled | "true"-enabled; "false"-disabled |
Return Values
Return true for success and false for failure.
A return of false indicates a failure to enable the effect package. Check for problems in the effect package path.
Disable the sticker effect package of the specified path and free its memory.
bool releaseSticker(const std::string& path)
Parameter
Parameter | Description |
---|---|
path | Sticker effect package file full path |
Return Values
Return true for success and false for failure.
A return of false indicates that the effect package given to the path has not been enabled.
Obtain an effect parameter .
int getEffectParam(EffectParamType paramType)
Parameter
Parameter | Description |
---|---|
paramType | Beautification parameter type |
Return Values
Current parameter value
Set an effect parameter.
bool setEffectParam(EffectParamType paramType, int value)
Parameter
Parameter | Description |
---|---|
paramType | Beautification parameter type |
value | Beautification parameter value |
Return Values
Return true for success and false for failure.
A return of false indicates setting failure, possibly due to an incorrect given effect type.
Get the effect parameter's scope and default value.
bool getEffectParamDetail(EffectParamType paramType, EffectPram& paramVal)
Parameter
Parameter | Description |
---|---|
paramType | Beautification parameter type |
paramVal | [out] EffectPram instance: includes scope, default value, and current value. |
Return Values
Return true for success and false for failure.
A return of false indicates failure to obtain values, possibly due to an incorrect given effect type.
Frame-rendering effect callback.
bool updateFrameParams(const GLTexture& textureIn, const GLTexture& textureOut, const ImageInfo& image)
Parameter
Parameter | Description |
---|---|
textureIn | Input texture encapsulated instance |
textureOut | Output texture encapsulated instance |
image | Image recognition encapsulated instance |
Return Values
Return true for success and false for failure.
A return of false indicates data frame rendering failure, possibly because no effect is enabled.
Check returns for stickers.
bool checkStickerResult(const std::vector<std::string>& paths, std::vector<int>& results)
Parameter
Parameter | Description |
---|---|
stickerPaths | Full path of the sticker effect in question |
stickerResults | [out] Sticker effect returned results, usually for determining whether a sticker animation has ended. A return of 7 (OF_Result_AnimationStoped) means the animation is over. |
Return Values
Return true for success and false for failure.
Currently, only true is returned; false is used for subsequent scaling.
Remarks
This API is often used to find out whether the currently rendered sticker's animation has ended. Call it after updateFrameparams.
Set a log level.
bool setLogLevel(int level)
Parameter
Parameter | Description |
---|---|
level | Log level |
Return Values
Return true for success and false for failure.
Redirect the log output. Call to redirect the required log for output.
bool setLogCallback(void(*callback)(const char* msg))
Parameter
Parameter | Description |
---|---|
callback | Log callback API |
Return Values
Return true for success and false for failure.
A return of false indicates that the callback API is not available.