Android学习札记18:Drawable中的setDither()方法

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);


最后调用本地类库进行处理。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值