4.0.4 r1.2中android.graphics.drawable.Drawable源代码
Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per
color component. This can improve the look on those devices, but can also slow down the drawing a
little.
public void setDither(boolean dither) {}
4.0.4 r1.2中android.graphics.drawable.BitmapDrawable源代码
@Override
public void setDither(boolean dither) {
mBitmapState.mPaint.setDither(dither);
invalidateSelf();
}
4.0.4 r1.2中android.graphics.Paint源代码
Helper for setFlags(), setting or clearing the DITHER_FLAG bit Dithering affects how colors that are
higher precision than the device are down-sampled. No dithering is generally faster, but higher
precision colors are just truncated down (e.g. 8888 -> 565). Dithering tries to distribute the error
inherent in this process, to reduce the visual artifacts.
Parameters:
dither true to set the dithering bit in flags, false to clear it
public native void setDither(boolean dither);
最后调用本地类库进行处理。
本文介绍了Android中Drawable类及其子类BitmapDrawable的dither属性的作用,该属性决定在颜色位数较低的设备上绘制时是否使用抖动算法。抖动算法可以改善颜色显示效果,但可能会降低绘制速度。

被折叠的 条评论
为什么被折叠?



