Difference between revisions of "Camera.queryCamera"

From GiderosMobile
(Created page with "__NOTOC__ <languages /> '''<translate>Available since</translate>:''' Gideros 2021.8<br/> '''<translate>Class</translate>:''' camera<br/> === <tr...")
 
Line 15: Line 15:
 
=== <translate>Return values</translate> ===
 
=== <translate>Return values</translate> ===
 
'''<translate>Returns</translate>''' (table) The camera capabilities
 
'''<translate>Returns</translate>''' (table) The camera capabilities
 +
 +
=== <translate>Examples</translate> ===
 +
'''Example'''<br/>
 +
<source lang="lua">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
 +
</source>
  
 
{{Camera}}
 
{{Camera}}

Revision as of 15:14, 18 August 2021


Available since: Gideros 2021.8
Class: camera

Description

Returns the capabilities of a camera, as a table containing 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
(table) = camera.queryCamera(device)

Parameters

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

Return values

Returns (table) The camera capabilities

Examples

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