import Vnmf from '../../index' declare module '../../index' { namespace isVKSupport { /** vision kit Version */ interface Version { /** old version */ v1 /** v2 Version ,Currently only iOS Base library 2.22.0 The above support */ v2 } } namespace createVKSession { /** vision kit Version */ interface Version { /** old version */ v1 /** v2 Version ,Currently only iOS Base library 2.22.0 The above support */ v2 } /** Tracking configuration */ interface Track { /** Plane tracking configuration */ plane: Plane } /** Plane tracking configuration */ interface Plane { /** Plane tracking configuration mode */ mode: keyof PlaneMode } /** The legal value of the plane tracking configuration mode */ interface PlaneMode { /** Detecting horizontal plane */ 1 /** Detects vertical planes ,only v2 Version support */ 2 /** Detects horizontal and vertical planes ,only v2 Version support */ 3 } } /** anchor Object ,only v2 Version support * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKAnchor.html */ interface VKAnchor { /** Uniquely identifies */ id: number /** type */ type: keyof VKAnchor.Type /** Contain 、Rotate 、The matrix of a shrinking information ,As the main order */ transform: Float32Array /** size ,Only plane anchor support */ size: VKAnchor.Size /** direction ,Only plane anchor support */ alignment: number } namespace VKAnchor { /** anchor Object type Legal value */ interface Type { /** flat */ 0 } /** anchor Object type Legal value */ interface Size { /** width */ width: number /** high */ height: number } } /** Camera object * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.html */ interface VKCamera { /** View matrix */ viewMatrix: Float32Array /** Internal reference of the camera ,only v2 Version support */ intrinsics: Float32Array /** Get the projection matrix * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.getProjectionMatrix.html */ getProjectionMatrix ( /** Myopia point */ near: number, /** Remote point */ far: number ): Float32Array } /** vision kit Session * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html */ interface VKFrame { /** Generation time */ timestamp: number /** Camera object */ camera: VKCamera /** Get the current frame texture ,Currently only support YUV Texture * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html */ getCameraTexture(ctx: WebGLRenderingContext): VKFrame.getCameraTextureResult /** Get the texture adjustment matrix 。The texture obtained by default is the texture that has not been adjusted without cutting ,This matrix can be used to cut the texture in the color device according to the size of the frame object * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html */ getDisplayTransform(): Float32Array } namespace VKFrame { /** Frame texture object */ interface getCameraTextureResult { /** Y Component texture */ yTexture: WebGLTexture /** UV Component texture */ uvTexture: WebGLTexture } } /** vision kit Session * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.html */ interface VKSession { /** Session state */ state: keyof VKSession.State /** Session configuration */ config: VKSession.Config /** Camera size */ cameraSize: VKSession.Size /** Cancel requestAnimationFrame Added to the planned animation frame request * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html */ cancelAnimationFrame(requestID: number): void /** Destruction * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html */ destroy(): void /** Get frame object ,Each call will trigger a frame analysis process * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html */ getVKFrame( /** width */ width: number, /** high */ height: number ): VKFrame /** Touch detection ,v1 The version only supports single level (which is hitTest After generating a plane ,Follow -up hitTest Nothing will be reappeared into plane ,It is based on the plane generated before )。 * * If you need to re -identify other planes ,You can call this method reset Parameter to true。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.hitTest.html */ hitTest( /** Relative horizontal coordinates of the window ,The value of the value is [0, 1],0 For the left edge ,1 For the right edge */ x: number, /** Relative vertical coordinates of the window ,The value of the value is [0, 1],0 Upper edge ,1 For the lower edge */ y: number, /** Do you need to re -identify other planes ,v2 This version no longer needs this parameter */ reset?: boolean ): VKSession.hitTestResult[] /** Cancel the monitoring session incident 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html */ off( /** Event name */ eventName: string, /** Event monitoring function */ fn: Function ): void /** Monitoring session incident 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.on.html */ on( /** Event name */ eventName: string, /** Event monitoring function */ fn: Function ): void /** Perform the next time the re -painting 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html */ requestAnimationFrame( /** Execute function */ callback: Function ): number /** Open session 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html */ start( /** Open the session and call back */ callback: (status: keyof VKSession.StartStatus) => void ): void /** Stop session 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html */ stop(): void } namespace VKSession { /** state Legal value */ interface State { /** unavailable */ 0 /** In operation */ 1 /** Suspension */ 2 } /** Session configuration */ interface Config { /** unavailable */ version: keyof version /** In operation */ track: track } /** vision kit Version */ interface version { /** old version */ v1 /** v2 Version ,Currently only iOS Base library 2.22.0 The above support */ v2 } /** Tracking configuration */ interface track { /** Plane tracking configuration */ plane: plane } /** Plane tracking configuration */ interface plane { /** Plane tracking configuration mode */ mode: keyof PlaneMode } /** The legal value of the plane tracking configuration mode */ interface PlaneMode { /** Detecting horizontal plane */ 1 /** Detects vertical planes ,only v2 Version support */ 2 /** Detects horizontal and vertical planes ,only v2 Version support */ 3 } /** Camera size */ interface Size { /** width */ width: number /** high */ height: number } /** hitTest Test results */ interface hitTestResult { /** Contain 、Rotate 、The matrix of a shrinking information ,As the main order */ transform: Float32Array } /** start status Legal value */ interface StartStatus { /** success */ 0 /** system error */ 2000000 /** Parameter error */ 2000001 /** Device does not support */ 2000002 /** System does not support */ 2000003 /** Unused session */ 2003000 /** No system camera permissions */ 2003001 /** Unprovised camera permissions */ 2003002 } } interface VnmfStatic { /** Judgment support version * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html */ isVKSupport (version: keyof isVKSupport.Version): boolean /** Whether to support the corresponding version vision kit */ /** create vision kit Session * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html */ createVKSession (version: keyof createVKSession.Version): VKSession /** vision kit Session */ } }