API

Basic APIs

createContext

Initialize an SDK context.

boolean createContext(Context activity, String ofSerialNumber, int aiType, String resDir, boolean bDownloadEffectsOnline)

Parameter

ParameterDescription
activityAndroid context
ofSerialNumberLicense SN, acquired at time of OrangeFilter purchase
aiTypeAI recognition type
resDirResource 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:

  1. Instance creation failed

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


destroyContext

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.


isContextValid

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.


enableEffect

Enable/Disable the effect.

boolean enableEffect(EffectType et, boolean bEnable)

Parameter

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


releaseEffect

Disable the effect and free its memory.

boolean releaseEffect(EffectType et)

Parameter

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


enableGesture

Enable/Disable the gesture effect.

boolean enableGesture(String path, boolean bEnable)

Parameter

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


releaseGesture

Disable the gesture effect package and free its memory.

boolean releaseGesture(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.

boolean enableSticker(String path, boolean bEnable)

Parameter

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


releaseSticker

Disable the sticker effect package and free its memory.

boolean releaseSticker(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 ep)

Parameter

ParameterDescription
epBeautification parameter type

Return Values

Current parameter value


setEffectParam

Set an effect parameter.

boolean setEffectParam(EffectParamType ep, int curVal)

Parameter

ParameterDescription
epBeautification parameter type
curValBeautification 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.

boolean getEffectParamDetail(EffectParamType ep, EffectPram effectPram)

Parameter

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


updateFrameParams

Frame-rendering effect callback

boolean updateFrameParams(GLTexture textureIn, GLTexture textureOut, 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.

boolean checkStickerResult(String[] stickerPaths, int[] stickerResults)

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.

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.


setLogLevel

Set the log level.

boolean setLogLevel(int logLevel)

Parameter

ParameterDescription
logLevelLog level

Return Values

Return true for success and false for failure.


setLogCallback

Redirect the log output; you may redirect the required log output with logCallBackFunc in listener.

boolean setLogCallback(OrangeFilter.OF_LogListener logListener))

Parameter

ParameterDescription
logListenerLog callback API

Return Values

Return true for success and false for failure.

If false, logListener is not available.


Was this page helpful?

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