From b59c248f6a870c3859c9e6a2b54225b01a9ae8d8 Mon Sep 17 00:00:00 2001 From: Mathias Westerdahl Date: Fri, 24 Feb 2017 14:52:40 +0100 Subject: [PATCH] Update README.md --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c76944..a496490 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,67 @@ # extension-camera -Example of interacting with the camera through native extensions + +Example of interacting with the camera through native extensions. + +# Disclaimer + +Although we aim to provide good example functionality in this example, we cannot guarantee the quality/stability at all times. +Please regard it as just that, an example, and don't rely on this as a dependency for your production code. + +# Known issues + +The currently supported platforms are: OSX + iOS + + +# FAQ + +## How do I use this extension? + +Add the package link (https://github.com/defold/extension-camera/archive/master.zip) +to the project setting `project.dependencies`, and you should be good to go. + +See the [manual](http://www.defold.com/manuals/libraries/) for further info. + + +# Lua API + +## Type constants + +Describes what camera should be used + + camera.CAMERA_TYPE_FRONT -- Selfie + camera.CAMERA_TYPE_BACK + +## Quality constants + + camera.CAPTURE_QUALITY_HIGH + camera.CAPTURE_QUALITY_MEDIUM + camera.CAPTURE_QUALITY_LOW + +## camera.start_capture(type, quality) + +Returns true if the capture starts well + + if camera.start_capture(camera.CAMERA_TYPE_BACK, camera.CAPTURE_QUALITY_HIGH) then + -- do stuff + end + +## camera.stop_capture() + +Stops a previously started capture session + +## camera.get_info() + +Gets the info from the current capture session + + local info = camera.get_info() + print("width", info.width) + print("height", info.height) + +## camera.get_frame() + +Retrieves the camera pixel buffer +This buffer has one stream named "rgb", and is of type buffer.VALUE_TYPE_UINT8 and has the value count of 1 + + self.cameraframe = camera.get_frame() + +