API

createContext

Initialize an SDK context.

bool createContext(const std::string& serialNumber, const std::string& licensePath, const std::string& resDir, VenusType aiType = VN_All)

Parameter

ParameterDescription
serialNumberLicense SN, acquired at time of OrangeFilter purchase
licensePathWritable path, for saving license information
resDirRoot path for saving resources, including effect packages and AI model files
aiTypeAI 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:

  1. Instance creation failed

  2. Incorrect path, number, or name of model file


destroyContext

Destroy an SDK context.

void destroyContext()

isContextValid

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.


enableEffect

Enable/Disable the effect type.

bool enableEffect(EffectType effectType, bool enabled)

Parameter

ParameterDescription
effectTypeEffect 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.


releaseEffect

Disable the effect type and free its memory.

bool releaseEffect(EffectType effectType)

Parameter

ParameterDescription
effectTypeEffect type

Return Values

Return true for success and false for failure.


enableGesture

Enable/Disable the gesture effect.

bool enableGesture(const std::string& path, bool enabled)

Parameter

ParameterDescription
pathFull 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.

releaseGesture

Disable the gesture effect package of the specified path and free its memory.

bool releaseGesture(const std::string& path)

Parameter

ParameterDescription
pathFull 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.

enableSticker

Enable/Disable the sticker effect.

bool enableSticker(const std::string& path, bool enabled)

Parameter

ParameterDescription
pathSticker 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.

releaseSticker

Disable the sticker effect package of the specified path and free its memory.

bool releaseSticker(const std::string& path)

Parameter

ParameterDescription
pathSticker 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.

getEffectParam

Obtain an effect parameter .

int getEffectParam(EffectParamType paramType)

Parameter

ParameterDescription
paramTypeBeautification parameter type

Return Values

Current parameter value

setEffectParam

Set an effect parameter.

bool setEffectParam(EffectParamType paramType, int value)

Parameter

ParameterDescription
paramTypeBeautification parameter type
valueBeautification 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.

getEffectParamDetail

Get the effect parameter's scope and default value.

bool getEffectParamDetail(EffectParamType paramType, EffectPram& paramVal)

Parameter

ParameterDescription
paramTypeBeautification 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.

updateFrameParams

Frame-rendering effect callback.

bool updateFrameParams(const GLTexture& textureIn, const GLTexture& textureOut, const ImageInfo& image)

Parameter

ParameterDescription
textureInInput texture encapsulated instance
textureOutOutput texture encapsulated instance
imageImage 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.

checkStickerResult

Check returns for stickers.

bool checkStickerResult(const std::vector<std::string>& paths, std::vector<int>& results)

Parameter

ParameterDescription
stickerPathsFull 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.

setLogLevel

Set a log level.

bool setLogLevel(int level)

Parameter

ParameterDescription
levelLog level

Return Values

Return true for success and false for failure.

setLogCallback

Redirect the log output. Call to redirect the required log for output.

bool setLogCallback(void(*callback)(const char* msg))

Parameter

ParameterDescription
callbackLog callback API

Return Values

Return true for success and false for failure.

A return of false indicates that the callback API is not available.

Was this page helpful?

Helpful Not helpful
Submitted! Your feedback would help us improve the website.
Feedback
Top