Difference between revisions of "Camera.takePicture"

From GiderosMobile
(Created page with "__NOTOC__ <languages /> '''<translate>Available since</translate>:''' Gideros 2021.8<br/> '''<translate>Class</translate>:''' camera<br/> === <tr...")
 
Line 4: Line 4:
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/camera|camera]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/camera|camera]]<br/>
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate>Take a picture.
+
Take a picture.
 
This function must be called while preview is active, that is Camera.start() has been called.
 
This function must be called while preview is active, that is Camera.start() has been called.
 
If it returns true, then the platform will asynchronously take a picture from the Camera (eventually using flash) then call Camera.onEvent callback one or more times.
 
If it returns true, then the platform will asynchronously take a picture from the Camera (eventually using flash) then call Camera.onEvent callback one or more times.
Line 16: Line 16:
 
- 1: uncompressed image ready, data contains the uncompressed image (android only, optional)
 
- 1: uncompressed image ready, data contains the uncompressed image (android only, optional)
 
- 2: jpeg image ready, data contains jpeg image. This event is always fired if takePicture() was successful
 
- 2: jpeg image ready, data contains jpeg image. This event is always fired if takePicture() was successful
</translate>
 
 
<source lang="lua">
 
<source lang="lua">
 
(boolean) = camera.takePicture()
 
(boolean) = camera.takePicture()
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
=== <translate>Return values</translate> ===
 
=== <translate>Return values</translate> ===

Revision as of 16:01, 18 August 2021


Available since: Gideros 2021.8
Class: camera

Description

Take a picture. This function must be called while preview is active, that is Camera.start() has been called. If it returns true, then the platform will asynchronously take a picture from the Camera (eventually using flash) then call Camera.onEvent callback one or more times. It is your responsability to define Camera.onEvent before calling Camera.takePicture(). Camera.onEvent function takes two arguments: - a number, indicating the type of event - a data buffer (string) depending on the event type

Event types are: - 0: shutter sound is triggered, data is empty (if supported) - 1: uncompressed image ready, data contains the uncompressed image (android only, optional) - 2: jpeg image ready, data contains jpeg image. This event is always fired if takePicture() was successful

(boolean) = camera.takePicture()

Parameters

Return values

Returns (number) False if an error occured