Difference between revisions of "Camera"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
 
 
<!-- GIDEROSOBJ:camera -->
 
<!-- GIDEROSOBJ:camera -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
+
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2017.8<br/>
+
'''Available since:''' Gideros 2017.8<br/>
=== <translate>Description</translate> ===
+
 
<translate>Renders live camera stream into a Texture</translate>
+
=== Description ===
=== <translate>Examples</translate> ===
+
Renders live camera stream into a Texture.
'''Example'''<br/>
+
<source lang="lua">
<source lang="lua">require "camera"
+
require "camera"
 +
</source>
 +
 
 +
=== Example ===
 +
<source lang="lua">
 +
require "camera"
  
 
-- Probe camera size (use a dummy 512x512 surface)
 
-- Probe camera size (use a dummy 512x512 surface)
Line 22: Line 26:
  
 
local b=Bitmap.new(Camera.texture)  
 
local b=Bitmap.new(Camera.texture)  
stage:addChild(b)</source>
+
stage:addChild(b)
 +
</source>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 +
=== Methods ===
 +
[[camera.availableDevices]] ''returns a list of available devices''<br/><!--GIDEROSMTD:camera.availableDevices() returns a list of available devices-->
 +
[[camera.queryCamera]] ''gets information about the given camera''<br/><!--GIDEROSMTD:camera.queryCamera(device) gets information about the given camera-->
 +
[[camera.setFlash]] ''selects the flash mode to use''<br/><!--GIDEROSMTD:camera.setFlash(mode) selects the flash mode to use-->
 +
[[camera.start]] ''starts streaming camera pictures to a Texture''<br/><!--GIDEROSMTD:camera.start(texture,device) starts streaming camera pictures to a Texture-->
 +
[[camera.stop]] ''stops camera streaming''<br/><!--GIDEROSMTD:camera.stop() stops camera streaming-->
 +
[[camera.takePicture]] ''takes a picture''<br/><!--GIDEROSMTD:camera.takePicture() takes a picture-->
  
=== <translate>Methods</translate> ===
 
[[Special:MyLanguage/camera.availableDevices|camera.availableDevices]] ''<translate>Return a list of available devices.</translate>''<br/><!-- GIDEROSMTD:camera.availableDevices() Return a list of available devices. -->
 
[[Special:MyLanguage/camera.queryCamera|camera.queryCamera]] ''<translate>Get information about the given camera</translate>''<br/><!-- GIDEROSMTD:camera.queryCamera(device) Get information about the given camera -->
 
[[Special:MyLanguage/camera.setFlash|camera.setFlash]] ''<translate>Select the flash mode to use</translate>''<br/><!-- GIDEROSMTD:camera.setFlash(mode) Select the flash mode to use -->
 
[[Special:MyLanguage/camera.start|camera.start]] ''<translate>Start streaming camera pictures to a Texture</translate>''<br/><!-- GIDEROSMTD:camera.start(texture,device) Start streaming camera pictures to a Texture -->
 
[[Special:MyLanguage/camera.stop|camera.stop]] ''<translate>Stop camera streaming.</translate>''<br/><!-- GIDEROSMTD:camera.stop() Stop camera streaming. -->
 
[[Special:MyLanguage/camera.takePicture|camera.takePicture]] ''<translate>Take a picture</translate>''<br/><!-- GIDEROSMTD:camera.takePicture() Take a picture -->
 
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
+
=== Events ===
=== <translate>Events</translate> ===
+
=== Constants ===
=== <translate>Constants</translate> ===
 
 
|}
 
|}
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Revision as of 00:27, 19 October 2022

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.png
Available since: Gideros 2017.8

Description

Renders live camera stream into a Texture.

require "camera"

Example

require "camera"

-- Probe camera size (use a dummy 512x512 surface)
Camera.texture=RenderTargert.new(512,512)
cw,ch=Camera.start(Camera.texture)
Camera.stop()

-- Restart camera with a full sized texture
Camera.texture=RenderTarget.new(cw,ch,true)
cw,ch=Camera.start(Camera.texture)

application:setLogicalDimensions(ch,cw)

local b=Bitmap.new(Camera.texture) 
stage:addChild(b)

Methods

camera.availableDevices returns a list of available devices
camera.queryCamera gets information about the given camera
camera.setFlash selects the flash mode to use
camera.start starts streaming camera pictures to a Texture
camera.stop stops camera streaming
camera.takePicture takes a picture

Events

Constants