Winsoft Camera for iOS v1.4 for Delphi/C++ Builder XE8-10.3 Full Source

Winsoft Camera for iOS v1.4 for Delphi/C++ Builder XE8-10.3 Full Source

Winsoft Camera for iOS v1.4 for Delphi/C++ Builder XE8-10.3 Full Source
Winsoft Camera for iOS v1.4 for Delphi/C++ Builder XE8-10.3 Full Source


Delphi and C++ Builder camera component for iOS.
uses AVFoundation framework
supports native video preview
supports native barcode detection (EAN, QR Code, Data Matrix, Aztec, UPC-E, PDF417, ITF 14, etc.)
supports native face detection
available for Delphi/C++ Builder XE8 - 10.3
source code included in registered version
royalty free distribution in applications

type
  TICameraError = record
    property Code: LongInt read;
    property Domain: string read;
    property Error: NSError read;
    property IsError: Boolean read;
    property LocalizedDescription: string read;
  end;

  EICameraError = class(Exception)
  end;

  EICameraOSError = class(EICameraError)
    constructor Create(Error: NSError);
    property Error: TICameraError read;
  end;

  TICameraAuthorizationStatus = (asNotDetermined, asRestricted, asDenied, asAuthorized);

  TICameraExposureMode = (exUnknown, exLocked, exAutoExpose, exContinuousAutoExposure);

  TICameraFocusMode = (foUnknown, foLocked, foAutoFocus, foContinuousAutoFocus);

  TICameraFlashMode = (flUnknown, flOff, flOn, flAuto);

  TICameraTorchMode = (toUnknown, toOff, toOn, toAuto);

  TICameraWhiteBalanceMode = (wbUnknown, wbLocked, wbAutoWhiteBalance, wbContinuousAutoWhiteBalance);

  TICameraPosition = (poUnknown, poBack, poFront);

  TICameraAspectRatio = (arUnknown, arFit, arFill, arResize);

  TICameraRangeRestriction = (rrUnknown, rrNone, rrNear, rrFar);

  TICameraSmoothAutoFocus = (saUnknown, saOff, saOn);

  TICameraVideoMirrored = (vmUnknown, vmOff, vmOn);

  TICameraVideoOrientation = (voUnknown, voPortrait, voPortraitUpsideDown, voLandscapeLeft, voLandscapeRight);

  TICameraSymbology = (syUnknown, syAztec, syCode128, syCode39, syCode39Mod43,
   syCode93, syDataMatrix, syEan13, syEan8, syInterleaved2of5, syItf14,
   syPdf417, syQRCode, syUpce);

  TICameraSymbologies = set of TICameraSymbology;

  TICameraBarcode = record
    Symbology: TICameraSymbology;
    Bounds: TRectF;
    Text: string;
  end;

  TICameraBarcodeDetectedEvent = procedure(Sender: TObject; const Barcode: TICameraBarcode) of object;

  TICameraFace = record
    Bounds: TRectF;
    FaceID: Integer;
    HasRollAngle: Boolean;
    RollAngle: Double;
    HasYawAngle: Boolean;
    YawAngle: Double;
  end;

  TICameraFaceDetectedEvent = procedure(Sender: TObject; const Face: TICameraFace) of object;

  TICameraFrameRate = record
    Max: Double;
    Min: Double;
  end;

  TICameraCaptureFormat = record
    property Binned: Boolean read;
    property FieldOfView: Single read;
    property Format: AVCaptureDeviceFormat read;
    property FrameRates: TArray<TICameraFrameRate> read;
    property MaxZoom: Double read;
    property MediaSubType: string read;
    property MediaType: string read;
    property Size: TSize read;
    property Stabilization: Boolean read;
    property Upscale: Double read;
  end;

  TICameraCaptureDevice = record
    property ActiveFormat: TICameraCaptureFormat read;
    property Device: AVCaptureDevice read;
    property Formats: TArray<TICameraCaptureFormat> read;
    property Model: string read;
    property Name: string read;
    property Position: TICameraPosition read;
    property UniqueID: string read;
  end;

  TICameraAuthorizationEvent = procedure(Sender: TObject; Granted: Boolean) of object;

  TICamera = class(TComponent)
    constructor Create(AOwner: TComponent);
    function IsExposureModeSupported(ExposureMode: TICameraExposureMode): Boolean;
    function IsFlashModeSupported(FlashMode: TICameraFlashMode): Boolean;
    function IsFocusModeSupported(FocusMode: TICameraFocusMode): Boolean;
    function IsTorchModeSupported(TorchMode: TICameraTorchMode): Boolean;
    function IsWhiteBalanceModeSupported(WhiteBalanceMode: TICameraWhiteBalanceMode): Boolean;
    procedure RequestAccess;
    function SampleBufferToBitmap(const Bitmap: TBitmap; const SetSize: Boolean): Boolean;
    procedure Start;
    procedure Stop;

    property ActiveFormat: TICameraCaptureFormat read write;
    property CaptureMetadataOutput: AVCaptureMetadataOutput read;
    property CaptureVideoDevices: TArray<TICameraCaptureDevice> read;
    property DefaultCaptureVideoDevice: TICameraCaptureDevice read;
    property Device: AVCaptureDevice read write;
    property DeviceInput: AVCaptureDeviceInput read;
    property DeviceName: string read;
    property ExposurePointOfInterest: TPointF read write;
    property FocusPointOfInterest: TPointF read write;
    property Formats: TArray<TICameraCaptureFormat> read;
    property HasFlash: Boolean read;
    property HasTorch: Boolean read;
    property IsAdjustingExposure: Boolean read;
    property IsAdjustingFocus: Boolean read;
    property IsAdjustingWhiteBalance: Boolean read;
    property IsAutoFocusRangeRestrictionSupported: Boolean read;
    property IsConnected: Boolean read;
    property IsExposurePointOfInterestSupported: Boolean read;
    property IsFocusPointOfInterestSupported: Boolean read;
    property IsLowLightBoostEnabled: Boolean read;
    property IsLowLightBoostSupported: Boolean read;
    property Iso: Single read;
    property IsPreviewMirroringSupported: Boolean read;
    property IsPreviewOrientationSupported: Boolean read;
    property IsRunning: Boolean read;
    property IsSmoothAutoFocusSupported: Boolean read;
    property IsVideoMirroringSupported: Boolean read;
    property IsVideoOrientationSupported: Boolean read;
    property LensAperture: Single read;
    property LensPosition: Single read;
    property MaxFrameRate: Double read write;
    property MinFrameRate: Double read write;
    property Model: string read;
    property Position: TICameraPosition read;
    property SampleBuffer: CMSampleBufferRef read;
    property Session: AVCaptureSession read;
    property UniqueID: string read;
    property VideoDataOutput: AVCaptureVideoDataOutput read;
    property VideoDataOutputConnection: AVCaptureConnection read;
    property VideoPreviewLayer: AVCaptureVideoPreviewLayer read;
    property View: UIView read;
  published
    property About: string read write stored False;
    property Active: Boolean read write default False;
    property AutoFocusRangeRestriction: TICameraRangeRestriction read write default rrUnknown;
    property ExposureMode: TICameraExposureMode read write default exUnknown;
    property FlashMode: TICameraFlashMode read write default flUnknown;
    property FocusMode: TICameraFocusMode read write default foUnknown;
    property Preview: Boolean read write default False;
    property PreviewAspectRatio: TICameraAspectRatio read write default arUnknown;
    property PreviewAutoMirroring: TICameraVideoMirrored read write default vmUnknown;
    property PreviewFrame: TBounds read write;
    property PreviewMirrored: TICameraVideoMirrored read write default vmUnknown;
    property PreviewOrientation: TICameraVideoOrientation read write default voUnknown;
    property RectOfInterest: TRectF read write;
    property SmoothAutoFocus: TICameraSmoothAutoFocus read write default saUnknown;
    property Symbologies: TICameraSymbologies read write default
      [syUnknown, syAztec, syCode128, syCode39, syCode39Mod43, syCode93, syDataMatrix,
       syEan13, syEan8, syInterleaved2of5, syItf14, syPdf417, syQRCode, syUpce];
    property TorchMode: TICameraTorchMode read write default toUnknown;
    property VideoMirrored: TICameraVideoMirrored read write default vmUnknown;
    property VideoOrientation: TICameraVideoOrientation read write default voUnknown;
    property WhiteBalanceMode: TICameraWhiteBalanceMode read write default wbUnknown;

    property OnAuthorization: TICameraAuthorizationEvent read write;
    property OnBarcodeDetected: TICameraBarcodeDetectedEvent read write;
    property OnFaceDetected: TICameraFaceDetectedEvent read write;
    property OnSampleBufferReady: TNotifyEvent read write;
  end;


Version 1.4

added TICameraCaptureFormat.Binned item
added TICameraCaptureFormat.FieldOfView item
added TICameraCaptureFormat.MaxZoom item
added TICameraCaptureFormat.MediaSubType item
added TICameraCaptureFormat.Stabilization item
added TICameraCaptureFormat.Upscale item
added TICamera.PreviewAutoMirroring property
added TICamera.PreviewMirrored property
added TICamera.RateOfInterest property
changed TICamera.MaxFrameRate type to Double
changed TICamera.MinFrameRate type to Double
added C++ Builder support
added C++ Builder demo example
bugfixes


Only for V.I.P
Warning! You are not allowed to view this text.