拍摄后如何立即在照片上绘画,然后保存到存储 [英] How to draw on a photo IMMEDIATELY after taking it, THEN save to storage

查看:112
本文介绍了拍摄后如何立即在照片上绘画,然后保存到存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我四处搜寻,找到了解决此问题的几种不同解决方案,但这些都不是我真正想要的.

I have searched around and found a few different solutions to this problem but none of them are really what I am looking for.

我正在开发一个应用程序,该应用程序允许用户通过MediaStore打开相机来拍摄图像.ACTION_IMAGE_CAPTURE意图...

I am developing an app that lets the user take an image by opening the camera via a MediaStore.ACTION_IMAGE_CAPTURE Intent as so...

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

然后使用

File photo = new File(Environment.getExternalStorageDirectory(), titleOfPhoto + ".jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));

我什至还获得了缩略图,并在onActivityResult()覆盖中为用户显示.

I even get the thumbnail back and display it for the user in the onActivityResult() Override.

正如标题所示,我想做的是允许用户在拍摄后立即在捕获的图像上进行绘制.但是我无法控制打开相机到返回保存已保存的图像的应用程序之间的情况.诸如SnapChat和WhatsApp之类的应用程序可以做到这一点,甚至更多,因此,我知道这是可能的,但Android似乎没有内置此功能.

As the title suggests, what I would like to do is allow the user to draw on the captured image immediately after taking it. But I have no control over what happens between opening the camera and returning to my app with the captured image already saved. Apps like SnapChat and WhatsApp are doing exactly this and so much more, so I know it is possible, but Android does not appear to have this capability built in.

要明确:事件的顺序必须是

To be clear: The sequence of events needs to be

1)打开相机

2)拍照

3)在图片上绘画

4)按确定"/完成"之类的

4) Press 'Ok'/'Done' or something

5)保存编辑的照片

6)返回缩略图

是否有向摄像机添加事件侦听器,或以其他方式打开摄像机以提供更多控制权的功能?任何帮助表示赞赏!谢谢!

Is there anyway to add an event listener to the camera, or open the camera in a different manner that gives more control? Any help is appreciated! Thanks!

推荐答案

为此,您必须使用基本操作是在应用程序的曲面视图"中渲染相机输出.然后,当用户拍照时,捕获表面视图的状态.从那里,您可以允许您的用户在图片上绘画.完成后,然后保存图片并显示其缩略图.

The basic of this is to render the camera output on a Surface View in your app. Then when the user takes a picture, capture the state of the surface view. From there you can allow your users to draw on the picture. When they are finished, THEN save the picture and display its thumbnail.

这篇关于拍摄后如何立即在照片上绘画,然后保存到存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆