FAQ09934:相机prevew时候出现水印问题

描述:使用基于mtk camera修改的app,发现preview时候出现水印,而在mtk自带的camera上没有该现象

解决:使用DDMS截图和layer dump工具均能发现有有水印图片出现。

比对有水印和没有水印的layer dump log,发现出问题的时候的SurfaceView:

  • Layer 0x42505008 (SurfaceView) activeBuffer= 720x1280: 736, 4, colorformat 是RGB565.

而正常时候的SurfaceView:

  • Layer 0x42505789 (SurfaceView) activeBuffer= 720x1280: 736, 5, colorformat 是RGB888.

review修改camera ap部分发现在preview时候设定的color format就是RGB565, 这里导致颜色丢失而引发水印现象。需要做如下修改:

  1. 在GLRootView.java中:

public GLRootView(Context context, AttributeSet attrs) { ......

if(USE_RGB888)

getHolder().setFormat(PixelFormat.RGB_888);

else

getHolder().setFormat(PixelFormat.RGB_565);

}

在GalleryEGLConfigChooser.java中:增加RGB888的配置:

private final int mConfigSpec565\[\] = new int\[\] {

EGL10.EGL_RED_SIZE, 5,

EGL10.EGL_GREEN_SIZE, 6,

EGL10.EGL_BLUE_SIZE, 5,

EGL10.EGL_ALPHA_SIZE, 0,

EGL10.EGL_NONE

};

private final int mConfigSpec888\[\] = new int\[\] {

EGL10.EGL_RED_SIZE, 8,

EGL10.EGL_GREEN_SIZE, 8,

EGL10.EGL_BLUE_SIZE, 8,

EGL10.EGL_ALPHA_SIZE, 0,

EGL10.EGL_NONE

};

private boolean USE_RGB888 = true;

public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {

int mConfigSpec\[\] = (USE_RGB888 == true)? mConfigSpec888 : mConfigSpec565;

相关推荐
牛哇网络工作室7 小时前
UnityHDRP写实数字人全流程基础5—语音输入和语音识别
android·unity·c#·游戏引擎·aigc·语音识别·xcode
一笑的小酒馆7 小时前
Androidiot蓝牙配网简单封装
android
愚公搬代码10 小时前
【愚公系列】《Android应用案例开发大全》016-LBS类应用掌上杭州(辅助工具类的开发)
android·前端
g105655913911 小时前
LAMP博客平台Wordpress实战
android·mysql·nginx·php
hunterandroid12 小时前
[Android 从零到一] Compose LazyColumn 性能优化:key、稳定性与重组治理
android·前端
pengyu12 小时前
【Kotlin 协程修仙录 · 元婴境 · 中阶】 | 操作符真解:Flow 中间操作符与数据流变幻术
android·kotlin
pengyu13 小时前
【Kotlin 协程修仙录 · 元婴境 · 初阶】 | 冷流初啼:Flow 的基础与响应式编程的入门
android·kotlin
wawo0014 小时前
Kuikly实践-从Android compose迁移到kuikly compose
android
Carson带你学Android16 小时前
Android 版 MCP 正式登场:AppFunctions
android·ai编程·jetbrains
古法安卓18 小时前
Android-Direct Boot 阶段与 getFilesDir() 路径变更问题深度分析
android·java·android studio