feat: texture rgba interface

This commit is contained in:
Kingtous 2023-02-19 19:14:48 -08:00
parent 44d3a78b9b
commit 6fd900c479
4 changed files with 78 additions and 34 deletions

View file

@ -55,8 +55,22 @@ public class TextureRgbaRendererPlugin: NSObject, FlutterPlugin {
} else {
result(textureRgba!.markFrameAvaliable(data: data.data, width: width, height: height))
}
case "getTexturePtr":
let args = call.arguments as! Dictionary<String, Any?>
let key = args["key"] as! Int64
let textureRgba = renderer[key]
if (textureRgba == nil) {
result(0)
} else {
let ptr = withUnsafePointer(to: textureRgba!) { p in
return UnsafeRawPointer(p);
};
let intAddr = UInt(bitPattern: ptr)
result(intAddr)
}
default:
result(FlutterMethodNotImplemented)
}
}
}