Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ビットマップを単色に着色し、アルファ > 0 を持つすべてのピクセルを特定の RGB 値に効果的に置き換えるにはどうすればよいでしょうか? さらに、同じことを行う方法ですが、すべてのピクセルのアルファを維持しますか? ピクセルごとの操作は遅くなる傾向があるため、探していません。
ビットマップを着色する ColorMatrixColorFilter と ColorFilter を使用してみましたが、100% の着色を実行する代わりに色付けします。
PorterDuffColorFilter を使用してこれを解決しました
Paint paint = new Paint(); paint.setColorFilter(new PorterDuffColorFilter(targetColor, PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(resource, matrix, paint);