径向羽化 FingerTransparentView

前不久群里有人问怎么实现「类似 Instagram 径向模糊透露手指底部内容」的效果。device-2015-08-06-133045-d因为要实时用算法羽化其实挺麻烦的,效率也不见得好,于是我当即很快提供了一个思路便是通过 Ps 做一张中心透明,边缘羽化的图片,再结合 Android 自定义 View 常用的 Canvas 与 Paint 这两个类的混合模式 Xfermode,在白板上挖出一个能容纳这张羽化图片的洞,混合去除,再将羽化图片填充进去即可。

说来抽象,结果便是如右 GIF 图所示。正好那天比较闲,想得快,做得也快,一个钟头完全靠着自己就几乎完美实现了。

Maven:

dependencies {
    compile 'me.drakeet.fingertransparentview:fingertransparentview:1.0.1'
}

不过,一般人可能不会用到这个东西,之所以在这边写出来,觉得它还是挺不错的一个自定义 View 教程,开发者可以看看源码学习下也不错,主要可以学到的内容有:

  • 双指缩放 Bitmap
  • 触摸事件分发与传递
  • Android 提供的混合绘图接口 Xfermode
  • 自定义 View 的一些流程

源代码:https://github.com/drakeet/FingerTransparentView

遗留小问题:眼尖的同学可能会发现使劲看可以看得出图片边缘,这主要是 baseColor 我偷懒直接使用 Color.WHITE 衔接不完美导致的,可以通过调整这个变量获得完美衔接,或者重新 P 一张羽化图片也行。

  1. Pingback: buy dofollow High PR web 2.0 profile backlinks

  2. Pingback: what is new

  3. Pingback: what is new

  4. Pingback: what is new

  5. Pingback: what is new

  6. Pingback: read more

  7. Pingback: read more

  8. Pingback: read more

  9. Pingback: read more

  10. Pingback: click here

  11. Pingback: click here

  12. Pingback: click here

  13. Pingback: click here

  14. Pingback: have a peek at these guys

  15. Pingback: have a peek at these guys

  16. Pingback: news

  17. Pingback: navigate to this website

  18. Pingback: original site

  19. Pingback: check here

  20. Pingback: browse this site

  21. Pingback: click here now

  22. Pingback: read this article

  23. Pingback: Bonuses

  24. Pingback: find this

  25. Pingback: Homepage

  26. Pingback: how to get bigger boobs

  27. Pingback: see it here

  28. Pingback: find more info

  29. Pingback: click to read more

  30. Pingback: imp source

  31. Pingback: great post to read

  32. Pingback: this website

  33. Pingback: how to get bigger boobs naturally fast

  34. Pingback: how to get bigger boobs naturally fast

  35. Pingback: see here

  36. Pingback: Get More Info

  37. Pingback: get redirected here

  38. Pingback: my review here

  39. Pingback: click site

  40. Pingback: More about the author

  41. Pingback: check my blog

  42. Pingback: read more

  43. Pingback: sperrys khakis

  44. Pingback: minigun fallout 4 ammo

  45. Pingback: explanation

  46. Pingback: try this web-site

  47. Pingback: official statement

  48. Pingback: you could look here

  49. Pingback: More hints

  50. Pingback: why not try these out

  51. Pingback: i thought about this

  52. Pingback: my response

  53. Pingback: browse this site

  54. Pingback: find this

  55. Pingback: a fantastic read

  56. Pingback: Homepage

  57. Pingback: their explanation

  58. Pingback: i thought about this

  59. Pingback: useful reference

  60. Pingback: More about the author

  61. Pingback: Sperry boots for women

  62. Pingback: quality article

  63. Pingback: quality article

  64. Pingback: insight

  65. Pingback: where to look

  66. Pingback: where to look

  67. Pingback: what to do

  68. Pingback: continue reading

  69. Pingback: figure out

  70. Pingback: find

  71. Pingback: important

  72. Pingback: read more

  73. Pingback: givehermakeup.com

  74. Pingback: learn now

  75. Pingback: best news

  76. Pingback: new source

  77. Pingback: best value

  78. Pingback: More hints

  79. Pingback: Clicking Here

  80. Pingback: her latest blog

  81. Pingback: check these guys out

  82. Pingback: i thought about this

  83. Pingback: more news

  84. Pingback: read more

  85. Pingback: click here

  86. Pingback: read more

  87. Pingback: read more

  88. Pingback: read more

  89. Pingback: read more

  90. Pingback: click here

  91. Pingback: read more

  92. Pingback: important source

  93. Pingback: official statement

  94. Pingback: Get the facts

  95. Pingback: Learn More

  96. Pingback: you could try here

  97. Pingback: you could check here

  98. Pingback: check that

  99. Pingback: More Bonuses

  100. Pingback: their explanation

  101. Pingback: view publisher site

  102. Pingback: check these guys out

  103. Pingback: my response

  104. Pingback: a fantastic read

  105. Pingback: imp source

  106. Pingback: useful reference

  107. Pingback: about

  108. Pingback: how to

  109. Pingback: news

  110. Pingback: new website

  111. Pingback: best info

  112. Pingback: read more

  113. Pingback: look here

  114. Pingback: see post

  115. Pingback: content

  116. Pingback: pop over to this website

  117. Pingback: click resources

  118. Pingback: Discover More

  119. Pingback: Continued

  120. Pingback: More Bonuses

  121. Pingback: additional hints

  122. Pingback: navigate to these guys

  123. Pingback: you can try this out

  124. Pingback: check these guys out

  125. Pingback: look at this site

  126. Pingback: why not try these out

  127. Pingback: original site

  128. Pingback: a fantastic read

  129. Pingback: my company

  130. Pingback: useful reference

  131. Pingback: click here

  132. Pingback: Read More

  133. Pingback: interserver coupon

  134. Pingback: interserver coupon

  135. Pingback: water slide

  136. Pingback: hotels in burlington nc

  137. Pingback: pickleball ball

  138. Pingback: Double glazing window

  139. Pingback: How are contributions made to the 403b account

  140. Pingback: where can i get garcinia cambogia extract

  141. Pingback: What is the use of coconut oil

  142. Pingback: Skydiving NYC