package org.jetbrains.skia
import org.jetbrains.skia.impl.NativePointer

import kotlinx.cinterop.COpaquePointer
import platform.ArkTS.ArkTS_Napi_NativeModule.napi_env
import platform.ArkTS.ArkTS_Napi_NativeModule.napi_value
import kotlin.native.SymbolName

public object OHRenderNode {
    fun createRootRenderNode(context: NativePointer?, callback: COpaquePointer?): napi_value{
        val node = OHRenderNode_nCreateRootRenderNode(context, callback)
        return node
    }

    fun setNodeConstructor(env: napi_env, func: napi_value) {
        OHRenderNode_nSetNodeConstructor(env, func)
        return
    }

    fun renderNodeDraw(env: napi_env, jsCanvas: napi_value, jsNode: napi_value) {
        OHRenderNode_nRenderNodeDraw(env, jsCanvas, jsNode)
        return
    }

    fun renderNodeNotifyRedraw(env: napi_env, jsNode: napi_value) {
        OHRenderNode_nRenderNodeNotifyRedraw(env, jsNode)
        return
    }

    fun setPixelRatio(ratio: Double) {
        OHRenderNode_nSetPixelRatio(ratio)
        return
    }

    fun buildInstance(env: napi_env, func: napi_value) {
        OHRenderNode_nBuildInstance(env, func)
        return
    }

}



@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nCreateRootRenderNode")
private external fun OHRenderNode_nCreateRootRenderNode(context: NativePointer?, callback: COpaquePointer?): napi_value

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nSetNodeConstructor")
private external fun OHRenderNode_nSetNodeConstructor(env: napi_env, func: napi_value)

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nRenderNodeDraw")
private external fun OHRenderNode_nRenderNodeDraw(env: napi_env, jsCanvas: napi_value, jsNode: napi_value)

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nRenderNodeNotifyRedraw")
private external fun OHRenderNode_nRenderNodeNotifyRedraw(env: napi_env, jsNode: napi_value)

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nSetPixelRatio")
private external fun OHRenderNode_nSetPixelRatio(ratio: Double)

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nBuildInstance")
private external fun OHRenderNode_nBuildInstance(env: napi_env, func: napi_value)

@ExternalSymbolName("org_jetbrains_skia_OHRenderNode__1nGetCurrentTimeMicros")
private external fun OHRenderNode_nGetCurrentTimeMicros(): Long

