如何让一个特殊的SurfaceView只绘制部分区域?

zero15 2015-09-14 12:12:01
这个SurfaceView是被用来显示摄像头的Preview的,不知道有什么办法可以裁剪这个SurfaceView
...全文
476 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Birds2018 2015-09-14
  • 打赏
  • 举报
回复
用GLSurfaceView Render,回调函数里面用OpenGL 去处理 想怎么处理都能弄。
zero15 2015-09-14
  • 打赏
  • 举报
回复
引用 2 楼 x13945 的回复:
[quote=引用 1 楼 x13945 的回复:] matrix

    /**
     * <p>Sets the transform to associate with this texture view.
     * The specified transform applies to the underlying surface
     * texture and does not affect the size or position of the view
     * itself, only of its content.</p>
     * 
     * <p>Some transforms might prevent the content from drawing
     * all the pixels contained within this view's bounds. In such
     * situations, make sure this texture view is not marked opaque.</p>
     * 
     * @param transform The transform to apply to the content of
     *        this view.
     * 
     * @see #getTransform(android.graphics.Matrix) 
     * @see #isOpaque() 
     * @see #setOpaque(boolean) 
     */
    public void setTransform(Matrix transform) {
        mMatrix.set(transform);
        mMatrixChanged = true;
        invalidateParentIfNeeded();
    }
[/quote] 有办法在摄像头把预览图渲染到surfaceView上之前把数据改掉么。。。
zero15 2015-09-14
  • 打赏
  • 举报
回复
引用 2 楼 x13945 的回复:
[quote=引用 1 楼 x13945 的回复:] matrix

    /**
     * <p>Sets the transform to associate with this texture view.
     * The specified transform applies to the underlying surface
     * texture and does not affect the size or position of the view
     * itself, only of its content.</p>
     * 
     * <p>Some transforms might prevent the content from drawing
     * all the pixels contained within this view's bounds. In such
     * situations, make sure this texture view is not marked opaque.</p>
     * 
     * @param transform The transform to apply to the content of
     *        this view.
     * 
     * @see #getTransform(android.graphics.Matrix) 
     * @see #isOpaque() 
     * @see #setOpaque(boolean) 
     */
    public void setTransform(Matrix transform) {
        mMatrix.set(transform);
        mMatrixChanged = true;
        invalidateParentIfNeeded();
    }
[/quote] 能麻烦讲得详细点么,怎么样才能达到裁剪的效果,我只知道矩阵可以处理纹理的各种效果,可不知道怎么裁剪掉surfaceView的一部分不进行绘制啊
hn_刘潇 2015-09-14
  • 打赏
  • 举报
回复
引用 1 楼 x13945 的回复:
matrix

    /**
     * <p>Sets the transform to associate with this texture view.
     * The specified transform applies to the underlying surface
     * texture and does not affect the size or position of the view
     * itself, only of its content.</p>
     * 
     * <p>Some transforms might prevent the content from drawing
     * all the pixels contained within this view's bounds. In such
     * situations, make sure this texture view is not marked opaque.</p>
     * 
     * @param transform The transform to apply to the content of
     *        this view.
     * 
     * @see #getTransform(android.graphics.Matrix) 
     * @see #isOpaque() 
     * @see #setOpaque(boolean) 
     */
    public void setTransform(Matrix transform) {
        mMatrix.set(transform);
        mMatrixChanged = true;
        invalidateParentIfNeeded();
    }
hn_刘潇 2015-09-14
  • 打赏
  • 举报
回复
matrix

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧