Initialize an SDK context.
boolean createContext(Context activity, String ofSerialNumber, int aiType, String resDir, boolean bDownloadEffectsOnline)
Parameter
Parameter | Description |
---|---|
activity | Android context |
ofSerialNumber | License SN, acquired at time of OrangeFilter purchase |
aiType | AI recognition type |
resDir | Resource storage root path; includes effect package, venus model files, and cache authorization information; default value is activity.getFilesDir().getPath(); null input is recommended. |
bDownloadEffectsOnline | (param added from v1.4.7) If effects download from server or not. defalut value 'false' ('false' means effects were packaged into the app, 'true' means effects download form server, SDK will not clean effect's caches when SDK version changed when 'true') |
Return Values
Return true for success and false for failure.
Remark
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.
boolean destroyContext()
Return Values
Return true for success and false for failure.
A return of false indicates an error in engine destruction. The existing context is unavailable, either because it is not yet initialized or already destroyed.
Availability of Orange beautification SDK.
boolean 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.
Remark
Check whether the rendering engine has been initialized.
Enable/Disable the effect.
boolean enableEffect(EffectType et, boolean bEnable)
Parameter
Parameter | Description |
---|---|
et | Effect type |
bEnable | "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 effect and free its memory.
boolean releaseEffect(EffectType et)
Parameter
Parameter | Description |
---|---|
et | Effect type |
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 gesture effect.
boolean enableGesture(String path, boolean bEnable)
Parameter
Parameter | Description |
---|---|
path | Full path of the gesture effect package file |
bEnable | "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 and free its memory.
boolean releaseGesture(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.
boolean enableSticker(String path, boolean bEnable)
Parameter
Parameter | Description |
---|---|
path | Sticker effect package file full path |
bEnable | "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 and free its memory.
boolean releaseSticker(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 ep)
Parameter
Parameter | Description |
---|---|
ep | Beautification parameter type |
Return Values
Current parameter value
Set an effect parameter.
boolean setEffectParam(EffectParamType ep, int curVal)
Parameter
Parameter | Description |
---|---|
ep | Beautification parameter type |
curVal | 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.
boolean getEffectParamDetail(EffectParamType ep, EffectPram effectPram)
Parameter
Parameter | Description |
---|---|
ep | Beautification parameter type |
effectPram | [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
boolean updateFrameParams(GLTexture textureIn, GLTexture textureOut, 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.
boolean checkStickerResult(String[] stickerPaths, int[] stickerResults)
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.
A return of false indicates a null input parameter, or that the number of stickers exceeds the return's array length.
Remark
This API is often used to find out whether the currently rendered sticker's animation has ended. Call it after updateFrameparams.
Set the log level.
boolean setLogLevel(int logLevel)
Parameter
Parameter | Description |
---|---|
logLevel | Log level |
Return Values
Return true for success and false for failure.
Redirect the log output; you may redirect the required log output with logCallBackFunc in listener.
boolean setLogCallback(OrangeFilter.OF_LogListener logListener))
Parameter
Parameter | Description |
---|---|
logListener | Log callback API |
Return Values
Return true for success and false for failure.
If false, logListener is not available.