本讲是android camera专题系列的第45讲,我们介绍android camera2 api专题的手动对焦实战。
更多资源:
资源 | 描述 |
---|---|
在线课程 | |
知识星球 | 星球名称:深入浅出android camera 星球id: 17296815 |
极客笔记圈 |
手动对焦(manual focus)
判断手动对焦是否支持
- lens_info_minimum_focus_distance是否大于0
- cameracontrollermanager2#printfocuscapability
设置af mode为off
geekcamera代码逻辑
popupview
|--> preview#updatefocus
|----> preview#setfocusvalue
|------> cameracontroller2#setfocusvalue //更新focus mode或focus distance
|--------> camerasettings#setfocusmode
|--------> camerasettings#setfocusdistance
|------> cameracontroller2#setrepeatingrequest
调整focus distance
manualfocusseekbar#onprogresschanged // maniactivity
|--> preview#setfocusdistance
|----> cameracontroller2#setfocusdistance
|------> camerasettings#setfocusdistance
|------> cameracontroller2#setrepeatingrequest
setfocusdistance
private void setfocusdistance(capturerequest.builder builder) {
if( mydebug.log )
log.i(tag, "[af_practise] setfocusdistance change focus distance to " focus_distance);
builder.set(capturerequest.lens_focus_distance, focus_distance);
}