textureview

SurfaceTexture AttachToGLContext and Surface

只谈情不闲聊 提交于 2021-02-18 08:48:31
问题 I'm trying to find out whether I need to remake a Surface if I want to call the attachToGLContext method from a SurfaceTexture. I tried to look in the android documentation, but there is no mention. I'm guessing not because as far as I'm aware, Surface is a buffer for a SurfaceTexture which can act as an external texture for an OpenGL context. So attaching the SurfaceTexture to a different context should not affect this. Does anybody know for sure? 回答1: The internal name for SurfaceTexture is

How to draw a rectangle on the screen using coordinates with texture view?

空扰寡人 提交于 2020-06-29 03:41:18
问题 I am previewing camera feed to texture view using cameraX. How to draw a rectangle on the screen using coordinates that i have? I don't want a complex function. I simply want to draw a rectangle. I am using kotlin and android studio 4.0. 回答1: I would go for an ImageView overlapping on top of the Textureview at the same xml. This imageview will load a transparent bitmap that will have only the rectangle drawn. If you have the coordinates u have to do: val myRectPaint = Paint() myRectPaint

Android 开发技术周报 Issue#274

青春壹個敷衍的年華 提交于 2020-04-06 11:39:01
新闻/News Play Store搜索结果中现显示APP评分、容量和下载量信息 谷歌发布安卓GPU工具:优化手机GPU性能 可OTA更新驱动 Android-x86 9.0-r2 稳定版发布 在PC上运行 Android 教程 抖音包大小优化-资源优化 两步使用 LiveData 替换 Observable Field Android模拟器检测体系梳理 开源库/Librarys LoadingImagesAnimation Android loading animation with images changing simiasque A developer tool to hide Android status bar under an overlay mask CustomBottomSheetBehavior Custom BottomSheetBehavior for Android that mimic Google Maps behavior CornerSheet Behavior to make a view expands from corner StarrySky 🔥A Powerful and Streamline MusicLibrary(一个丰富的音乐播放封装库,支持多种音频格式,完美解决你的问题。) CrashReporter

OpenGL中 Canvas 性能分析

此生再无相见时 提交于 2020-04-06 02:02:44
本文将通过分析部分源码,描述 Android 里面的 Canvas 的大致实现。并且会对 Canvas 的性能做一定分析,提供对 Canvas 的使用建议。 GLES20RecordingCanvas 类 这个类是什么?为什么我从没用过? 我们来看看它的代码: class GLES20RecordingCanvas extends GLES20Canvas { ... } class GLES20Canvas extends HardwareCanvas { ... } public abstract class HardwareCanvas extends Canvas { ... } 它是不暴露给开发者的,所以我们也使用不了它。 而由 extends Canvas 可见,它是 Canvas 的一个实现类,所以应当也提供和 Canvas 一样的功能。那么它在哪里被使用了呢? 它是在 Android framework 源码处的,我们可以自定义一个 view,在 debug 时,断点到 @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); } 就可以看到这个 canvas 的实例是 GLES21RecordingCanvas 了。 也就是说,几乎 Android 的所有 View

android视频适配与裁剪

。_饼干妹妹 提交于 2020-03-01 20:29:31
首先说下基本背景, 当我们使用android系统原生的VideoView播放视频时, 在XML中给它设置的一个尺寸, 但最终视频开始播放后, VideoView实际的尺寸可能并不是这个尺寸设置的大小. VideoView在测量自身的尺寸时会依据视频的真实尺寸来调整自己的大小, 遵循以下规则: 1. 实际视频在VideoView上播放时所有部分都是可见的,或缩小或放大, 总之一定要全部显示出来,不会裁剪实际视频. 2. 尽量保持实际视频的长宽比例, 具体是首先以我们用户定义的长度为标准, 等比例缩放视频大小, 直到长度达到我们定义的长度, 然后宽度(等比例缩放后的宽度)与我们定义的宽比较, 大于则以我们定义的宽度为准, 这样视频会在竖直方向上压缩, 最终播放时也就不会成比例了; 小于则它以视频缩放后的宽度为准, 这样它会比我们定义的高度小,最终播放的效果是等比例的. 最近开发有如下需求: 视频等比例放大,直至一边铺满VideoView(或屏幕)的某一边,另一边超出View的另一边,再移动到View的正中央,这样长边两边会被裁剪掉同样大小的区域,视频看起来不会变形,也即是:先把视频区(实际的大小显示区)与View(定义的大小)区的两个中心点重合, 然后等比例放大或缩小视频区,直至一条边与View的一条边相等,另一条边超过View的另一条边,这时再裁剪掉超出的边,

Camera2使用textureView支持

旧城冷巷雨未停 提交于 2020-01-24 05:41:17
SurfaceView 绘制会有独立窗口, TextureView 没有独立的窗口,可以像普通的 View 一样,更高效更方便 public class MainActivity extends AppCompatActivity { private TextureView textureView; private String TAG = "测试"; private HandlerThread mThreadHandler; private Handler mHandler; private CaptureRequest.Builder mPreviewBuilder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mThreadHandler = new HandlerThread("CAMERA2"); mThreadHandler.start(); mHandler = new Handler(mThreadHandler.getLooper()); textureView = (TextureView) findViewById(R.id.tv

TextureView播放本地视频

耗尽温柔 提交于 2020-01-18 03:56:10
1.效果图: 2.清单文件:文件读取权限 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> 3.主界面: package com.example.administrator.testz; import androidx.appcompat.app.AppCompatActivity; import android.graphics.Matrix; import android.graphics.SurfaceTexture; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.Surface; import android.view.TextureView; import java.io.IOException; public class MainActivity extends AppCompatActivity implements TextureView.SurfaceTextureListener, MediaPlayer.OnPreparedListener

Camera2使用textureView支持

旧城冷巷雨未停 提交于 2020-01-06 06:27:41
SurfaceView 绘制会有独立窗口, TextureView 没有独立的窗口,可以像普通的 View 一样,更高效更方便 public class MainActivity extends AppCompatActivity { private TextureView textureView; private String TAG = "测试"; private HandlerThread mThreadHandler; private Handler mHandler; private CaptureRequest.Builder mPreviewBuilder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mThreadHandler = new HandlerThread("CAMERA2"); mThreadHandler.start(); mHandler = new Handler(mThreadHandler.getLooper()); textureView = (TextureView) findViewById(R.id.tv

TextureView with camera preview

家住魔仙堡 提交于 2019-12-31 01:34:06
问题 I would like to use TextureView to show camera preview in it. Finally i want to set opacity for camera preview, using TextureView. But i have problem: 10-22 12:21:14.773: W/TextureView(5126): A TextureView or a subclass can only be used with hardware acceleration enabled. Here is my class code: public class CameraService extends Service implements android.view.TextureView.SurfaceTextureListener { private LayoutInflater layoutInflater; private Camera mCamera; private View mCameraView; private