Difference between revisions of "Camera.queryCamera"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2021.8<br/>
'''<translate>Available since</translate>:''' Gideros 2021.8<br/>
+
'''Class:''' [[camera]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/camera|camera]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
Returns the capabilities of a camera, as a table containing the following fields:
+
Returns the capabilities of a camera.
* previewSizes: an array of integers listing the supported preview dimensions (two integers, width and height, per dimension)
+
<syntaxhighlight lang="lua">
* pictureSizes: same as above but for full picture dimensions
 
* flashModes: an array of integers listing the supported flash modes
 
<source lang="lua">
 
 
(table) = camera.queryCamera(device)
 
(table) = camera.queryCamera(device)
</source>
+
</syntaxhighlight>
=== <translate>Parameters</translate> ===
+
 
'''<translate>device</translate>''' (string) The camera device name, or nil to query the default one<br/>
+
The table contains the following fields:
=== <translate>Return values</translate> ===
+
*'''"previewSizes"''': an array of integers listing the supported preview dimensions (two integers, width and height, per dimension)
'''<translate>Returns</translate>''' (table) The camera capabilities
+
*'''"pictureSizes"''': same as above but for full picture dimensions
 +
*'''"flashModes"''': an array of integers listing the supported flash modes
 +
 
 +
=== Parameters ===
 +
'''device''' (string) the camera device name, or nil to query the default one<br/>
 +
 
 +
=== Return values ===
 +
'''Returns''' (table) the camera capabilities<br/>
  
=== <translate>Examples</translate> ===
+
=== Example ===
'''Example'''<br/>
+
<syntaxhighlight lang="lua">
<source lang="lua">require "camera"
+
require "camera"
 
--Camera Info
 
--Camera Info
 
local caminfo=Camera.queryCamera()
 
local caminfo=Camera.queryCamera()
Line 33: Line 37:
 
print("-",caminfo.flashModes[i])
 
print("-",caminfo.flashModes[i])
 
end
 
end
</source>
+
</syntaxhighlight>
  
 
{{Camera}}
 
{{Camera}}

Latest revision as of 14:27, 13 July 2023

Available since: Gideros 2021.8
Class: camera

Description

Returns the capabilities of a camera.

(table) = camera.queryCamera(device)

The table contains the following fields:

  • "previewSizes": an array of integers listing the supported preview dimensions (two integers, width and height, per dimension)
  • "pictureSizes": same as above but for full picture dimensions
  • "flashModes": an array of integers listing the supported flash modes

Parameters

device (string) the camera device name, or nil to query the default one

Return values

Returns (table) the camera capabilities

Example

require "camera"
--Camera Info
local caminfo=Camera.queryCamera()
print("Preview Sizes")
for i=1,#caminfo.previewSizes,2 do
	print("-",caminfo.previewSizes[i],caminfo.previewSizes[i+1])
end
print("Picture Sizes")
for i=1,#caminfo.pictureSizes,2 do
	print("-",caminfo.pictureSizes[i],caminfo.pictureSizes[i+1])
end
print("Flash Modes")
for i=1,#caminfo.flashModes do
	print("-",caminfo.flashModes[i])
end