キャンバスに描画する必要がある Path オブジェクトのテクスチャとして機能する画面全体にまたがるビットマップがあります。次に、このテクスチャ パスを上に描画する必要がある背景画像があります。
PorterDuff モードを使用してみましたが、何も正しく動作していないようです。PorterDuff モードがどのように動作するかを正確に理解するのに苦労していました。
このテスト コードを使用して、パスをテクスチャ化する方法を見つけました。
Paint paint = new Paint();
//draw the texture
canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.texture),0,0,paint);
//construct the Path with an inverse even-odd fill
Path p = new Path();
p.setFillType(Path.FillType.INVERSE_EVEN_ODD);
p.addCircle(this.getHeight()/2, this.getWidth()/2, 200, Path.Direction.CCW);
//use CLEAR to remove inverted fill, thus showing only the originally filled section
paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
//draw path
canvas.drawPath(p, paint);
しかし、それを背景画像の上に配置する方法がわかりません。PorterDuff モードを間違って使用しているだけですか?