Usually samples that I see,use this methods when try to draw bitmaps on canvas.For example:
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
But I do not know what those three methods do?When I have to use them?
I want to explain that how anti-alias produces a smooth edge, it works by blending the foreground and background colors to create a smoother edge. like if background color is transparent and the foreground color is blue, anti aliasing will make the pixels on the edge go from blue to transparent gradually. This makes the edge look smooth to the eye.
From the doc
Paint.setAntiAlias
Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape. See setDither() and setFilterBitmap() to affect how colors are treated.
Paint.setFilterBitmap
Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit. Filtering affects the sampling of bitmaps when they are transformed. Filtering does not affect how the colors in the bitmap are converted into device pixels. That is dependent on dithering and xfermodes.
Paint.setDither
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With