This shows you the differences between two versions of the page.
built_in:cameraview [2015/03/08 10:40] octazid [Description] |
built_in:cameraview [2016/06/24 21:13] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== CameraView control ====== | ||
- | // | ||
- | |||
- | ===== Description ===== | ||
- | Create a camera preview control using the **CreateCameraView** function of the **[[built_in: | ||
- | < | ||
- | This control allows your program to show a live feed of what is currently being seen by the phone/ | ||
- | |||
- | You will need to call the **StartPreview** function of the CameraView control to start the preview\\ (Note: On some phones it is neccessary to wait at least one second before calling the StartPreview function). | ||
- | < | ||
- | |||
- | Use the **TakePicture** function to take a picture and save it to a given location. | ||
- | < | ||
- | |||
- | Use the **SetPictureSize** function to set the dimensions in pixels of the pictures taken (eg. 1024 x 768). | ||
- | < | ||
- | |||
- | For more sophisticated examples including motion detection and video streaming, check out the **' | ||
- | |||
- | ---- | ||
- | ===== Methods ===== | ||
- | Some controls use the same methods.\\ | ||
- | For examples of the **[[same methods]]** look here. | ||
- | ^Method ^Description ^ | ||
- | |CameraView.AutoCapture( folder, fileName, maxCount ) | | | ||
- | |CameraView.Destroy() | | | ||
- | |CameraView.FindFaces( max )| | | ||
- | |CameraView.Focus() | | | ||
- | |CameraView.GetAbsHeight() | | | ||
- | |CameraView.GetAbsWidth() | | | ||
- | |CameraView.GetCameraCount() | | | ||
- | |CameraView.GetColorEffects()| use in SetOnReady| | ||
- | |CameraView.GetHeight() | | | ||
- | |CameraView.GetImageHeight() | | | ||
- | |CameraView.GetImageWidth() | | | ||
- | |CameraView.GetPictureSizes() | | | ||
- | |CameraView.GetPixelData( format, | ||
- | |CameraView.GetPosition() | | | ||
- | |CameraView.GetType() | | | ||
- | |CameraView.GetVisibility() | | | ||
- | |CameraView.GetWidth() | | | ||
- | |CameraView.MotionMosaic( xtiles, ytiles, sensitivity, | ||
- | |CameraView.Release() | | | ||
- | |CameraView.ReportColors( list, | ||
- | |CameraView.SetBackColor( color ) | | | ||
- | |CameraView.SetBackGradient( color1, | ||
- | |CameraView.SetBackGradientRadial( x, | ||
- | |CameraView.SetBackground( imagefile, | ||
- | |CameraView.SetColorEffect( effect )| use in SetOnReady| | ||
- | |CameraView.SetFlash( onoff ) |set to true or false| | ||
- | |CameraView.SetFocusMode( mode ) | | | ||
- | |CameraView.SetMargins( left, | ||
- | |CameraView.SetOnMotion( callback ) | | | ||
- | |CameraView.SetOnPicture( callback ) | | | ||
- | |CameraView.SetOnReady( callback ) | | | ||
- | |CameraView.SetPadding( left, | ||
- | |CameraView.SetPictureSize( width, | ||
- | |CameraView.SetPosition( left, top, width, height ) | | | ||
- | |CameraView.SetPreviewImage( imageObj ) | | | ||
- | |CameraView.SetScale( x,y ) | | | ||
- | |CameraView.SetSize( width, height ) | | | ||
- | |CameraView.SetSound( onoff ) | | | ||
- | |CameraView.SetVisibility( HideShow ) | | | ||
- | |CameraView.StartPreview() | | | ||
- | |CameraView.StopPreview() | | | ||
- | |CameraView.Stream( ip, | ||
- | |CameraView.TakePicture( fileName ) | | | ||
- | |||
- | ---- | ||
- | |||
- | ====Example - Show camera preview==== | ||
- | |||
- | <code javascript> | ||
- | function OnStart() | ||
- | { | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | cam = app.CreateCameraView( 0.8, 0.4 ); | ||
- | lay.AddChild( cam ); | ||
- | setTimeout( " | ||
- | |||
- | app.AddLayout( lay ); | ||
- | } | ||
- | </ | ||
- | |||
- | ====Example - Take pictures==== | ||
- | |||
- | <code javascript> | ||
- | function OnStart() | ||
- | { | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | cam = app.CreateCameraView( 0.8, 0.4 ); | ||
- | lay.AddChild( cam ); | ||
- | cam.SetPictureSize( 1024, 768 ); | ||
- | setTimeout( " | ||
- | |||
- | btn = app.CreateButton( " | ||
- | btn.SetOnTouch( Snap ); | ||
- | lay.AddChild( btn ); | ||
- | |||
- | app.AddLayout( lay ); | ||
- | } | ||
- | |||
- | function Snap() | ||
- | { | ||
- | cam.TakePicture( "/ | ||
- | app.ShowPopup(" | ||
- | } | ||
- | </ |