Graphics for Android graphical user Interface (ii) Introduction to the main methods of paint class

Source: Internet
Author: User

  1. /**

  2. * Paint Class Introduction

  3.      * 

  4. * Paint is a brush, plays a very important role in the drawing process, the brush mainly preserves the color,

  5. * style, such as drawing information, specify how to draw text and graphics, brush objects have many settings methods,

  6. * Can be broadly divided into two categories, one is related to graphic drawing, the other is related to text rendering.

  7.      * 

  8. * 1. Graphic drawing

  9. * SETARGB (int a,int r,int g,int b);

  10. * Set the color to be drawn, a for transparency, and r,g,b for the color value.

  11.      * 

  12. * SETALPHA (int a);

  13. * Set the transparency of the drawing drawing.

  14.      * 

  15. * setcolor (int color);

  16. * Sets the color of the drawing, which is represented by a color value that includes transparency and RGB colors.

  17.      * 

  18. * Setantialias (boolean aa);

  19. * Set whether anti-aliasing is used, consumes large resources, and the drawing speed slows down.

  20.      * 

  21. * Setdither (Boolean dither);

  22. * Set whether to use Image jitter processing, will make the picture color more smooth and full, image clearer

  23.      * 

  24. * Setfilterbitmap (boolean filter);

  25. * If the item is set to True, the image will filter out the optimized operation of the bitmap image during animation to speed up the display

  26. * speed, this setting depends on the settings of dither and Xfermode

  27.      * 

  28. * Setmaskfilter (Maskfilter maskfilter);

  29. * Set Maskfilter, can use different maskfilter to achieve the effect of filter, such as filter, stereo, etc.

  30.      * 

  31. * Setcolorfilter (Colorfilter colorfilter);

  32. * Set the color filter to achieve a color-free conversion effect when drawing colors

  33.      * 

  34. * Setpatheffect (Patheffect effect);

  35. * Set the effect of drawing path, such as point drawing line, etc.

  36.      * 

  37. * Setshader (Shader Shader);

  38. * Set the image effect, use shader can draw a variety of gradient effect

  39.      * 

  40. * Setshadowlayer (float radius, float dx,float dy,int color);

  41. * Set the shadow layer below the graph, create a shadow effect, radius is the angle of the shadow, DX and dy are the distance from the shadow on the x-axis and the y-axis, color is the shade of the shadow

  42.      * 

  43. * SetStyle (Paint.style Style);

  44. * Set the style of the brush for Fill,fill_or_stroke, or STROKE

  45.      * 

  46. * SETSTROKECAP (Paint.cap Cap);

  47. * When the brush style is stroke or fill_or_stroke, set the brush's graphic style, such as the circle style

  48. * Cap.round, or square style cap.square

  49.      * 

  50. * Setsrokejoin (Paint.join Join);

  51. * Set how the shapes are combined when drawing, such as smoothing effects, etc.

  52.      * 

  53. * Setstrokewidth (float width);

  54. * When the brush style is stroke or fill_or_stroke, set the thickness of the brush

  55.      * 

  56. * Setxfermode (Xfermode xfermode);

  57. * Set the process of drawing overlap, such as merging, taking intersection or union, often used to make eraser effect.

  58.      * 

  59. * 2. Text rendering

  60. * Setfakeboldtext (Boolean fakeboldtext);

  61. * Simulation To implement bold text, set in small font effect will be very poor

  62.      * 

  63. * Setsubpixeltext (Boolean subpixeltext);

  64. * Setting this to True will help to display the text on the LCD screen

  65.      * 

  66. * SetTextAlign (paint.align Align);

  67. * Set the alignment direction of the drawing text

  68.      * 

  69. * Settextscalex (float scaleX);

  70. * Set the scale of the drawing text x axis, can achieve the effect of the text stretching

  71.      * 

  72. * Settextsize (float textSize);

  73. * Set font size for drawing text

  74.      * 

  75. * SETTEXTSKEWX (float skewx);

  76. * Set italic text, skewx to oblique radians

  77.      * 

  78. * Settypeface (Typeface Typeface);

  79. * Set typeface object, that is, font style, including bold, italic and liner body, non-liner body, etc.

  80.      * 

  81. * Setunderlinetext (Boolean underlinetext);

  82. * Set underlined text effects

  83.      * 

  84. * Setstrikethrutext (Boolean strikethrutext);

  85. * Set the effect with strikethrough

  86.      * 

  87.      */


Graphics for Android graphical user Interface (ii) Introduction to the main methods of paint class

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.