Android SurfaceView将所有内容翻转为镜像

时间:2017-05-04 21:16:41

标签: android surfaceview flip mirror

我有一个表面视图,我在上面绘制位图。我怎样才能使surfaceview上的所有内容都像< | >

我的seBitmap方法就像,

if (bmp != null)
    {
        m_canvas = m_holder.lockCanvas(rect);
        if (m_canvas == null)
            return;
        m_paint = new Paint();

        m_canvas.drawBitmap(bmp, null, rect, m_paint);

        if (m_holder != null)
            m_holder.unlockCanvasAndPost(m_canvas);
    }

1 个答案:

答案 0 :(得分:0)

您只需将位图缩放-1即可翻转。例如:

m_canvas.scale(-1.0f, 1.0f, rect.width()/2, rect.height()/2);
m_canvas.drawBitmap(bmp, null, rect, m_paint);