procedure TForm2.DoDidFinish(Image: TBitmap);
begin
//image.SaveToFile(ExpandFileName('~/Test.jpg'));
Image1.Bitmap.Assign(Image);
end;
procedure TForm2.DoMessageListener(const Sender: TObject;
const M: TMessage);
begin
if M is TMessageDidFinishTakingImageFromLibrary then
Image1.Bitmap.Assign(TMessageDidFinishTakingImageFromLibrary(M).Value);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
bstream:=tmemorystream.create;
end;
procedure TForm2.SpeedButton1Click(Sender: TObject);
var
Service: IFMXCameraService;
Params: TParamsPhotoQuery;
begin
if
TPlatformServices.Current.SupportsPlatformService(IFMXCameraService,
Service) then
begin
Params.Editable := false;
// Specifies whether to save a picture to devicePhoto Library
Params.NeedSaveToAlbum := true;
Params.RequiredResolution := TSize.Create(2000,2000);
Params.OnDidFinishTaking := DoDidFinish;
Service.TakePhoto(SpeedButton1, Params);
end
else
ShowMessage('This device does not support the camera service');
end;
end.
[/mw_shl_code]