Android Paint Detailed

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, you can use different maskfilter to achieve the effect of filter, such as filter, stereo, etc. *

  30. * Setcolorfilter (Colorfilter colorfilter);

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

  32. *

  33. * Setpatheffect (Patheffect effect);

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

  35. *

  36. * Setshader (Shader Shader);

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

  38. *

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

  40. * 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

  41. *

  42. * SetStyle (Paint.style Style);

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

  44. *

  45. * SETSTROKECAP (Paint.cap Cap);

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

  47. * Cap.round, or square style Cap.square

  48. *

  49. * Setsrokejoin (Paint.join Join);

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

  51. *

  52. * Setstrokewidth (float width);

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

  54. *

  55. * Setxfermode (Xfermode xfermode);

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

  57. Avoidxfermode Avoid = new Avoidxfermode (Color.Blue, Avoidxfermode.mode.  AVOID);

  58. 1.porterduff.mode.clear

    the drawing is not submitted to the canvas.
    2.porterduff.mode.src

    show top Draw picture
    3.PORTERDUFF.MODE.DST

    Show lower drawing pictures
    4.porterduff.mode.src_over

    Normal drawing shows that the upper and lower layers are drawn with overlapping covers.
    5.porterduff.mode.dst_over

    The upper and lower layers are displayed. The lower level is shown on the home.
    6.porterduff.mode.src_in

    draw the intersection of two layers. Displays the upper layer.
    7.porterduff.mode.dst_in

    draw the intersection of two layers. Displays the lower layer.
    8.porterduff.mode.src_out

    draw the non-intersecting portion of the upper layer.
    9.porterduff.mode.dst_out

    remove the layer to draw the non-intersecting part.
    10.porterduff.mode.src_atop

    Remove the non-intersecting part of the layer from the upper intersection section
    11.porterduff.mode.dst_atop

    take the upper non-intersecting part and the lower part of the intersection
    12.porterduff.mode.xor

      
    13.porterduff.mode.darken


    14.porterduff.mode.lighten


    15.porterduff.mode.multiply


    16.porterduff.mode.screen

  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. */

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.