原圖漸變平滑,Canvas.drawBitmap() 繪製後出現明顯色帶(條紋)。
Android 預設將 Bitmap 配置為 ARGB_8888(32 位),但部分設備/系統版本在解碼/繪製時會隱式轉為 RGB_565(16 位,每通道 5/6/5 位),色彩深度驟降導致漸變階梯化。
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.id.xxx, opts);Paint.setDither(true)。LinearGradient / SweepGradient 替代位圖,完全避免量化誤差。參考詳解:Android 圖片色彩模式與條紋問題。