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;

相关推荐
MengFly_3 分钟前
Compose中rememberUpdatedState的作用
android·kotlin·compose
韩立学长16 分钟前
【开题答辩实录分享】以《志愿者公益网站的设计与实现》为例进行选题答辩实录分享
android·java·开发语言
%xiao Q9 小时前
GESP C++五级-202406
android·开发语言·c++
二哈喇子!10 小时前
JavaWeb+Vue分离项目实现增删改查讲解
android
2501_9445215910 小时前
Flutter for OpenHarmony 微动漫App实战:推荐动漫实现
android·开发语言·前端·javascript·flutter·ecmascript
2501_9445215912 小时前
Flutter for OpenHarmony 微动漫App实战:图片加载实现
android·开发语言·前端·javascript·flutter·php
新镜12 小时前
【Flutter】LTR/RTL 阿拉伯语言/希伯来语言
android·flutter·ios·客户端
初级代码游戏15 小时前
android开发:获取手机IP和UDP广播
android·udp·获取ip
阿杰 AJie16 小时前
MySQL 聚合函数
android·数据库·mysql
孟秋与你17 小时前
【安卓】开发一个读取文件信息的简易apk
android