zoukankan      html  css  js  c++  java
  • Android 照相

    XE6 控件太强了CameraComponent就可以了

    CameraComponent1.Active := True;
    
    procedure TCameraComponentForm.CameraComponent1SampleBufferReady(Sender: TObject; const ATime: Int64);
    begin
      TThread.Synchronize(TThread.CurrentThread, GetImage);
      // imgCameraView.Width := imgCameraView.Bitmap.Width;
      // imgCameraView.Height := imgCameraView.Bitmap.Height;
    end;
    
    
    procedure TCameraComponentForm.GetImage;
    begin
      CameraComponent1.SampleBufferToBitmap(imgCameraView.Bitmap, True);
    end;
    
    
    procedure TCameraComponentForm.btnSaveClick(Sender: TObject);
    var
      filename: string;
    begin
      filename := FormatDateTime('yymmddHHmmss', Now()) + '.jpg';
      filename := TPath.GetPicturesPath + PathDelim + filename;
      imgCameraView.Bitmap.SaveToFile(filename);
    end;
    前后照相机切换,自拍模式
    procedure TCameraComponentForm.btnBackCameraClick(Sender: TObject);
    begin
      { select Back Camera }
      CameraComponent1.Active := False;
      CameraComponent1.Kind := FMX.Media.TCameraKind.BackCamera;
      CameraComponent1.Active := True;
    end;

    procedure TCameraComponentForm.btnFrontCameraClick(Sender: TObject);
    begin
      { select Front Camera }
      CameraComponent1.Active := False;
      CameraComponent1.Kind := FMX.Media.TCameraKind.FrontCamera;
      CameraComponent1.Active := True;
    end;

     Image1.Bitmap.Assign(Image2.Bitmap);

    ImageViewer1.Bitmap.LoadFromStream(stream)

  • 相关阅读:
    18.9.22 noip模拟赛
    POJ 2299 Ultra-QuickSort
    美团2018年CodeM大赛-初赛B轮 B 配送(最短路)
    Wannafly挑战赛18 E 极差(线段树、单调栈)
    Foj 2299 Prefix(AC自动机、DP)
    求独立矩形个数
    Zoj 3777 Problem Arrangement
    Luogu 2444 [POI2000]病毒 & Zoj 3784
    [ZJOI2007]Hide 捉迷藏
    双联通分量学习笔记
  • 原文地址:https://www.cnblogs.com/cb168/p/3897757.html
Copyright © 2011-2022 走看看