The use of anti-aliasing when drawing images and images in custom views

Source: Internet
Author: User

Generally, a horizontal line or a vertical line does not have a sawtooth effect. However, if a diagonal line is drawn using a canvas, the effect may be displayed, which may affect the vision, this is caused by Pixel problems! This is also the case when drawing a graph. The Sawtooth effect is only displayed when the image is rotated, moved, or zoomed in. Normally, it will not appear when the image is placed! Of course, the same is true for images! The effect of eliminating the teeth will consume memory. Generally, if there is no effect of the teeth or it is not necessary, you do not need to use the effect of eliminating the teeth! So how can we eliminate the effect of the Sawtooth?
 
Method 1 (this method is only applicable to eliminating drawn images and not to images (such as Bitmap )):
 
This method is: Set the paint brush:

View code

1 //Anti-aliasing2Paint. setantialias (True);

Method 2 (applicable to all ):

View code

1Canvas. setdrawfilter (NewPaintflagsdrawfilter (0, Paint. anti_alias_flag2| Paint. filter_bitmap_flag ));

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.