Camera: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
Line 4: Line 4:
=== Description ===
=== Description ===
Renders live camera stream into a Texture
Renders live camera stream into a Texture
=== Examples ===
'''Example'''<br/>
<source lang="lua">require "camera"
-- Probe camera size (use a dummy 512x512 surface)
Camera.texture=Texture.new(nil,512,512)
cw,ch=Camera.start(Camera.texture)
Camera.stop()
-- Restart camera with a full sized texture
Camera.texture=Texture.new(nil,cw,ch,true)
cw,ch=Camera.start(Camera.texture)
application:setLogicalDimensions(ch,cw)
local b=Bitmap.new(Camera.texture)
stage:addChild(b)</source>
{|-
{|-
| style="width: 50%;"|
| style="width: 50%;"|

Revision as of 09:45, 23 August 2018

Supported platforms: android, ios, mac, pc
Available since: Gideros 2017.8

Description

Renders live camera stream into a Texture

Examples

Example

require "camera"

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

-- Restart camera with a full sized texture
Camera.texture=Texture.new(nil,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 - Return a list of available devices.
camera.start - Start streaming camera pictures to a Texture
camera.stop - Stop camera streaming.

Events

Constants