surfaceview

Capture screen of SurfaceView

依然范特西╮ 提交于 2019-12-06 08:25:30
In above image i have one SurfaceView and one Button named Capture . SurfaceView is showing camera preview. So, I want screenshot of surfaceview when i click on Capture button. I had tried many examples and answers but none of them works. I just get Black Screenshot image . In some posts i also found it is impossible to take screenshot of surfaceview . So please help me any alternative solution with example. Here are some answers I already seen: how to create and save a screenshot from a surfaceview? Taking screenshot programmatically doesnt capture the contents of surfaceVIew How to capture

SurfaceView sample code

偶尔善良 提交于 2019-12-06 07:44:43
I need a sample tutorial for the android SurfaceView , or sample code using it that can be shared. The API demos are difficult for me to understand. Does anyone have alternatives? This commit of my WorldMap demo app shows you the changes necessary to convert from an android.view.View to an android.view.SurfaceView with an android.view.SurfaceHolder.Callback . It cheats a bit by using the View 's onDraw() from within the SurfaceView 's DrawThread and by calling the View 's onSizeChanged() from within the SurfaceView 's surfaceChanged . It just makes the diff smaller and easier to understand. I

using zxing barcode reader through surfaceview

这一生的挚爱 提交于 2019-12-06 07:41:48
问题 I am creating a Barcode Scanner app and I want to use Zxing to read barcodes, my app has a surfaceview and showing camera into that, but now I want to scan barcode from my SurfaceView camera , the reason that I use it, is that I have two Edittexts under the surface view in my layout to show content of barcode. How should I create an app like, the main problem is that how can I set zxing into surface. If there's any way I would appreciate. Layout screenshot: 回答1: Customize your zxing layout

Color_FormatSurface implementation

心不动则不痛 提交于 2019-12-06 07:30:50
问题 Is there any available documentation about Color_FormatSurface (AndroidOpaque) color format? My video encoder currently does not support this format, and I am supposed to add that feature, but I cannot find anything about it. Any help would be appreciated. 回答1: There is no documentation on it, because it is opaque. That's "opaque" in the programming sense, not the alpha-blending sense. The idea behind the "opaque" format is that it's whatever the device manufacturer decides is most

Android camera preview freezes when switching cameras?

元气小坏坏 提交于 2019-12-06 07:17:54
I am writing a custom camera for my app. It's working fine when opening the activity with either of the back or front cameras. But I'm really struggling with switching cameras inside the activity. When I tap the switching camera button, the preview freezes and nothing happens. I have tried the answers and tips suggested in other questions related to the camera and the preview, but nothing works. Here is my activity: public class CameraActivity extends Activity implements SurfaceHolder.Callback { //================================================================================ // Properties //

Scaling bitmaps on SurfaceView = no antialiasing?

六眼飞鱼酱① 提交于 2019-12-06 07:02:40
I am trying to scale DOWN a high resolution .png bitmap on my SurfaceView canvas like so: Bitmap player = BitmapFactory.decodeResource(getResources(), R.drawable.player); Paint paint; paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setFlags(Paint.ANTI_ALIAS_FLAG); //then in onDraw: canvas.drawBitmap(player, null, frame, paint); The problem is that the antialiasing works perfectly when I use a View, but it fails to work when I use a SurfaceView, and the quality looks horrible. I've tried everything. Some guy even posted this question 3 years ago on various

subclassing SurfaceView and overriding onDraw() to change SurfaceView parameters to generate preview of desired size

扶醉桌前 提交于 2019-12-06 06:45:32
问题 I have subclassed the SurfaceView and instantiating it in onCreate of the Activity. The preview is generated but the control never enters onDraw() which is overriden in the subclass of SurfaceView. Why is that? class ActivityClass extends Activity{ onCreate(){ mPreview = new Preview(this); setContentView(mPreview); } public void startPreview(){ rec = new MediaRecorder(); rec.setVideoSource();....... rec.setPreviewDisplay(mPreview.getSurfaceHolder.getSurface()); } } class Preview extends

Z-order issue with MediaCodec and TextureView

你。 提交于 2019-12-06 05:52:48
In my Android app I have the need to render three views with the following Z-order: At bottom, the output surface of a MediaCodec decoder covering the whole screen. I have the requirement that I have to transform the image produced by MediaCodec (e.g. scale it) In the middle, a GLSurfaceView (or other surface/view running GL shaders I define), covering the whole screen. Obviously some of the pixels in this layer will be transparent, in order to see the MediaCodec output beneath. On top, any other view - say an ImageView . Not sure if I will require transparency for these topmost views, maybe

SurfaceView or TextureView combination

岁酱吖の 提交于 2019-12-06 05:51:12
I am trying to apply real-time effects to camera preview and show in multiple views , how can I do? (just like the camera2 ) ( snapshot ) I know 2 approaches to show real-time effects on camera preivew if no ScrollView involved on the left side. Use GLSurfaceView and setRenderer . Bind SurfaceTexture as GLES external texture, and use GLSL(OpenGL Shading Language) to apply effects. Use TextureView . It is more complex because need to setup EGLContext/EGLSurface and do thread management. However, I don't know how to make ScrollView with real-time effect items overlay GLES composition. Should I

Android: How to draw on a Surfaceview which already is displaying a Camara Preview

本秂侑毒 提交于 2019-12-06 05:07:39
I am trying to program an application which has to display on the mobile phone's screen what is being filmed by the front camera [The application is not recording/saving anything in the memory of the phone]. Also in case a face is filmed (and detected), it has to appear sourrended by a rectangle. To do so I'm using: A Surfaceview to display what is being filmed by the front camera. A FaceDetectionListener to detect faces in the camera input. So far the application displays properly what is being filmed by the front camera. It also detects correctly faces. But I'm not able to draw the boundary