mirror of
https://onedev.site.tesses.net/crosslang/crosslang-gfx
synced 2026-02-09 01:55:45 +00:00
First commit
This commit is contained in:
35
src/webcam.cpp
Normal file
35
src/webcam.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "gfx.hpp"
|
||||
|
||||
namespace Tesses::CrossLang::GFX
|
||||
{
|
||||
TWebcam::TWebcam(uint8_t id, const Size& sz, uint8_t fps) : webcam(id,sz, fps)
|
||||
{
|
||||
|
||||
}
|
||||
TObject TWebcam::CallMethod(GCList& ls, std::string key, std::vector<TObject> args)
|
||||
{
|
||||
if(key == "Open")
|
||||
{
|
||||
this->webcam.Open();
|
||||
}
|
||||
if(key == "ReadFrame")
|
||||
{
|
||||
TImage* img;
|
||||
if(GetArgumentHeap(args,0,img))
|
||||
{
|
||||
this->webcam.ReadFrame(&img->img);
|
||||
}
|
||||
}
|
||||
|
||||
if(key == "Close")
|
||||
{
|
||||
this->webcam.Close();
|
||||
}
|
||||
|
||||
return Undefined();
|
||||
}
|
||||
std::string TWebcam::TypeName()
|
||||
{
|
||||
return "GFX.Webcam";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user