PorterduffXfermode: Clear a section of a bitmap

前端 未结 3 1393
北恋
北恋 2020-12-02 20:36

The goal is to draw a bitmap and over the top of something, and draw shapes that ERASE the underlying area of the bitmap.

I have a proof of concept to try and underst

3条回答
  •  臣服心动
    2020-12-02 21:06

    The problem is hardware acceleration. Turn it OFF for the particular View that you are painting with CLEAR. If you're using a custom view, do this in the constructors:

    if (android.os.Build.VERSION.SDK_INT >= 11) 
    {
         setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    

    You can also call setLayerType on a view reference.

提交回复
热议问题