//---------------------------------------------------------------------------
#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <FMX.Controls.hpp>
#include <FMX.Forms.hpp>
#include <FMX.Controls.Presentation.hpp>
#include <FMX.StdCtrls.hpp>
#include <FMX.Types.hpp>
#include <FMX.Colors.hpp>
#include "Winsoft.Android.Camera.hpp"
#include "Winsoft.Android.Obr.hpp"
//---------------------------------------------------------------------------
class TFormMain : public TForm
{
__published:	// IDE-managed Components
  TACamera *ACamera;
  TPanel *Panel;
  TToolBar *ToolBar;
  TButton *ButtonSettings;
  TButton *ButtonStartStop;
  TButton *ButtonTakePicture;
  TColorBox *ColorBox;
  TLabel *LabelBarcode;
  void __fastcall ButtonSettingsClick(TObject *Sender);
  void __fastcall ButtonStartStopClick(TObject *Sender);
  void __fastcall ButtonTakePictureClick(TObject *Sender);
  void __fastcall PanelResize(TObject *Sender);
  void __fastcall FormCreate(TObject *Sender);
  void __fastcall ACameraDataReady(TObject *Sender);
    void __fastcall ACameraPermission(TObject *Sender);
  void __fastcall FormDestroy(TObject *Sender);
private:	// User declarations
  TBarcodeDecoder *BarcodeDecoder;
  volatile bool Paused;
  _di_IFMXApplicationEventService FMXApplicationEventService;
  volatile int RgbaDataWidth;
  volatile int RgbaDataHeight;
  DynamicArray<Cardinal> RgbaData;
  TBitmap *ScanBitmap;
  int Scanning;
  void __fastcall ACameraPictureTaken(TObject *Sender, System::DynamicArray<System::Byte> Data);
  void __fastcall ACameraDisplayRationale(TObject *Sender, const _di_TProc APostRationaleProc);
  bool __fastcall HandleAppEvent(TApplicationEvent AAppEvent, TObject *AContext);
public:		// User declarations
  __fastcall TFormMain(TComponent* Owner);
  void __fastcall Start();
  void __fastcall Stop();
};
//---------------------------------------------------------------------------
extern PACKAGE TFormMain *FormMain;
//---------------------------------------------------------------------------
#endif
