Camera: Difference between revisions

From GiderosMobile
No edit summary
Line 11: Line 11:


-- 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 25: Line 25:
{|-
{|-
| style="width: 50%; vertical-align:top;"|
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
=== <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.availableDevices|camera.availableDevices]] ''<translate>Return a list of available devices.</translate>''<br/><!-- GIDEROSMTD:camera.availableDevices() Return a list of available devices. -->

Revision as of 13:41, 18 August 2021


Supported platforms:
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=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 Return a list of available devices.
camera.start Start streaming camera pictures to a Texture
camera.stop Stop camera streaming.

Events

Constants