Difference between revisions of "Camera"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Supported platforms:''' android, ios, mac, pc<br/>
+
<!-- GIDEROSOBJ:camera -->
 +
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
 
'''Available since:''' Gideros 2017.8<br/>
 
'''Available since:''' Gideros 2017.8<br/>
 +
 
=== Description ===
 
=== Description ===
<translate>Renders live camera stream into a Texture</translate>
+
Renders live camera stream into a Texture.
=== Examples ===
+
<syntaxhighlight lang="lua">
'''Example'''<br/>
+
require "camera"
<source lang="lua">require "camera"
+
</syntaxhighlight>
 +
 
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
require "camera"
  
 
-- Probe camera size (use a dummy 512x512 surface)
 
-- Probe camera size (use a dummy 512x512 surface)
Camera.texture=Texture.new(nil,512,512)
+
Camera.texture=RenderTargert.new(512,512)
 
cw,ch=Camera.start(Camera.texture)
 
cw,ch=Camera.start(Camera.texture)
 
Camera.stop()
 
Camera.stop()
  
 
-- Restart camera with a full sized texture
 
-- Restart camera with a full sized texture
Camera.texture=Texture.new(nil,cw,ch,true)
+
Camera.texture=RenderTarget.new(cw,ch,true)
 
cw,ch=Camera.start(Camera.texture)
 
cw,ch=Camera.start(Camera.texture)
  
Line 20: Line 26:
  
 
local b=Bitmap.new(Camera.texture)  
 
local b=Bitmap.new(Camera.texture)  
stage:addChild(b)</source>
+
stage:addChild(b)
 +
</syntaxhighlight>
 +
 
 
{|-
 
{|-
| style="width: 50%;"|
+
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
=== Methods ===
[[camera.availableDevices]] {{<translate>Return a list of available devices.</translate>}}<br/>
+
[[camera.availableDevices]] ''returns a list of available devices''<br/><!--GIDEROSMTD:camera.availableDevices() returns a list of available devices-->
[[camera.start]] {{<translate>Start streaming camera pictures to a Texture</translate>}}<br/>
+
[[camera.isAvailable]] ''checks if camera can be accessed''<br/><!--GIDEROSMTD:camera.isAvailable() checks if camera can be accessed-->
[[camera.stop]] {{<translate>Stop camera streaming.</translate>}}<br/>
+
[[camera.queryCamera]] ''gets information about the given camera''<br/><!--GIDEROSMTD:camera.queryCamera(device) gets information about the given camera-->
| style="width: 50%;"|
+
[[camera.setFlash]] ''selects the flash mode to use''<br/><!--GIDEROSMTD:camera.setFlash(mode) selects the flash mode to use-->
 +
[[camera.setOrientation]] ''selects the camera orientation''<br/><!--GIDEROSMTD:camera.setOrientation(orientation) selects the camera orientation-->
 +
[[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-->
 +
 
 +
| style="width: 50%; vertical-align:top;"|
 +
 
 
=== Events ===
 
=== Events ===
 
=== Constants ===
 
=== Constants ===
 
|}
 
|}
 +
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 14:27, 13 July 2023

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.isAvailable checks if camera can be accessed
camera.queryCamera gets information about the given camera
camera.setFlash selects the flash mode to use
camera.setOrientation selects the camera orientation
camera.start starts streaming camera pictures to a Texture
camera.stop stops camera streaming
camera.takePicture takes a picture

Events

Constants