标签:getconf find vat out pre rri rac cat boolean
撕衣服案例
public class MainActivity extends AppCompatActivity { private ImageView iv; @SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); iv = findViewById(R.id.iv); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.pre19); final Bitmap bitmap1 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig()); Paint paint = new Paint(); final Canvas canvas = new Canvas(bitmap1); canvas.drawBitmap(bitmap, new Matrix(), paint); iv.setImageBitmap(bitmap1); iv.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); switch (action) { case MotionEvent.ACTION_MOVE: for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { try { bitmap1.setPixel((int) event.getX() + i, (int) event.getY() + j, Color.TRANSPARENT); } catch (Exception e) { e.printStackTrace(); } } } iv.setImageBitmap(bitmap1); } return true; } }); } }
标签:getconf find vat out pre rri rac cat boolean
原文地址:https://www.cnblogs.com/nangongyibin/p/10252683.html