2

我有以下方法:

protected void onDraw(Canvas i_Canvas) {            
        int x = (int) m_X;
        int y = (int) m_Y;

        Path path = new Path();
        path.addCircle(
            m_Cx,
            m_Cy,
            m_Radius,
            Path.Direction.CCW);
        i_Canvas.clipPath(path);

        Rect rect = new Rect(x, y, x + 240, y + 240);

        i_Canvas.drawBitmap(m_FullImageBitmap, rect, rect, m_Paint);
    }

使用这个我试图在圆形中创建一些位图的裁剪区域。

我还想模糊那个圆形区域的边缘。例如:从边缘到形状中心的 5px 将被模糊。我该如何实施?

4

1 回答 1

1

I think you would have to apply a BlurMaskFilter when drawing the image:

m_Paint = new Paint(0);
m_Paint.setColor(0xffffffff);
m_Paint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL));
于 2012-10-21T15:12:02.883 回答