{"id":343350,"date":"2022-12-30T09:01:09","date_gmt":"2022-12-30T09:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343350"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343350","title":{"rendered":"<span>\u0418\u0437\u043c\u043e\u0440\u043e\u0437\u044c \u043d\u0430 \u043f\u0438\u0446\u0446\u0435: \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u044e\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432 Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u043b\u0438\u0437\u043a\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u0435\u0439 \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u044b.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bbf\/9b6\/8ac\/bbf9b68ac4c24c3968fe6650ab8c8df4.png\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bbf\/9b6\/8ac\/bbf9b68ac4c24c3968fe6650ab8c8df4.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u0432 Dodo \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438, \u043d\u043e \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0430\u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/dododev\/blog\/584498\/\">\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u00ab\u041b\u0435\u0442\u0430\u044e\u0449\u0430\u044f \u041f\u0438\u0446\u0446\u0430\u00bb<\/a>, \u0438\u0433\u0440\u0443 \u00ab\u0425\u0432\u043e\u0441\u0442\u0438\u043a\u0438\u00bb, \u0430 \u0432 \u043a\u0430\u043d\u0443\u043d \u041d\u043e\u0432\u043e\u0433\u043e \u0433\u043e\u0434\u0430 \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u0447\u043d\u0443\u044e \u0437\u0438\u043c\u043d\u044e\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0418\u0437\u043c\u043e\u0440\u043e\u0437\u044c\u00bb.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78c\/1f5\/91c\/78c1f591c5a71c46940174bec06a911f.gif\" width=\"155\" height=\"332\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78c\/1f5\/91c\/78c1f591c5a71c46940174bec06a911f.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u0430\u0434 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0439 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u0438, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044d\u043a\u0440\u0430\u043d \u0437\u0430\u043c\u0451\u0440\u0437 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0435\u0451 \u043f\u0430\u043b\u044c\u0446\u0435\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438: \u043a\u0430\u043a \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432.  \u041d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435? \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435!<\/p>\n<p>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Canvas.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/56b\/fc1\/3e4\/56bfc13e4e3c0216f233a26880edc056.png\" width=\"1018\" height=\"748\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/56b\/fc1\/3e4\/56bfc13e4e3c0216f233a26880edc056.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>Let it snow!<\/h2>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u043a \u0446\u0435\u043d\u0442\u0440\u0443, \u0442\u0435\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u0435\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043d\u0435\u0436\u0438\u043d\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/11e\/af6\/499\/11eaf6499ba01dbbd1f2d0b2d5ecbc0a.png\" alt=\"\u0421\u043b\u0435\u0432\u0430 \u2014 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435.\" title=\"\u0421\u043b\u0435\u0432\u0430 \u2014 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435.\" width=\"1527\" height=\"1650\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/11e\/af6\/499\/11eaf6499ba01dbbd1f2d0b2d5ecbc0a.png\"\/><figcaption>\u0421\u043b\u0435\u0432\u0430 \u2014 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435.<\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  class RimeView constructor(context: Context) : View(context) {     \/\/ \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e   }<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432 bitmap \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onSizeChanged, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u044b  \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0432\u044c\u044e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    \/\/rime   rimeBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val rimeCanvas = Canvas(rimeBitmap)   val rimeDrawable = ContextCompat.getDrawable(context, R.drawable.bg)   rimeDrawable?.setBounds(0, 0, w, h)   rimeDrawable?.draw(rimeCanvas)    \/\/snow   snowBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val snowCanvas = Canvas(snowBitmap)   val snowDrawable = ContextCompat.getDrawable(context, R.drawable.snow)   snowDrawable?.setBounds(0, 0, w, h)   snowDrawable?.draw(snowCanvas)   }<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onDraw:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  val paint = Paint()      override fun onDraw(canvas: Canvas) {   super.onDraw(canvas)    \/\/rime   canvas.drawBitmap(rimeBitmap, 0f, 0f, paint)    \/\/snow   canvas.drawBitmap(snowBitmap, 0f, 0f, paint)      }<\/code><\/pre>\n<p>\u0425\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0443: \u043e\u043d\u0430 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f <strong><u>paint = Paint()<\/u><\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u0435\u043d \u0442\u0440\u0435\u0442\u0438\u0439 \u00ab\u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439\u00bb bitmap, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f.<\/p>\n<ol start=\"4\">\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 bitmap \u0432 onSizeChanged, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>scratchCanvas<\/strong> \u0432 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u043d\u0435\u0439 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u0435:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    \/\/buffer bitmap   scratchBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   scratchCanvas = Canvas(scratchBitmap)    \/\/rime   rimeBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val rimeCanvas = Canvas(rimeBitmap)   val rimeDrawable = ContextCompat.getDrawable(context, R.drawable.bg)   rimeDrawable?.setBounds(0, 0, w, h)   rimeDrawable?.draw(rimeCanvas)    \/\/snow   snowBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val snowCanvas = Canvas(snowBitmap)   val snowDrawable = ContextCompat.getDrawable(context, R.drawable.snow)   snowDrawable?.setBounds(0, 0, w, h)   snowDrawable?.draw(snowCanvas)    }<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 onDraw:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">canvas.drawBitmap(raimBitmap, 0f, 0f, paint)  canvas.drawBitmap(snowBitmap, 0f, 0f, paint)  \/\/buffer bitmap canvas.drawBitmap(scratchBitmap, 0f, 0f, paint)<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u043a\u0438\u0441\u0442\u043e\u0447\u0435\u043a,<\/p>\n<pre><code class=\"kotlin\">  override fun onDraw(canvas: Canvas) {   super.onDraw(canvas)      paint.xfermode = srcOverPorterDuffMode    canvas.drawBitmap(rimeBitmap, 0f, 0f, paint)    canvas.drawBitmap(snowBitmap, 0f, 0f, paint)    paint.xfermode= dstOutPorterDuffMode    canvas.drawBitmap(scratchBitmap, 0f, 0f, paint)    }<\/code><\/pre>\n<p>\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c<\/p>\n<pre><code>private val srcOverPorterDuffMode = PorterDuffXfermode(PorterDuff.Mode.SRC_OVER) private val dstOutPorterDuffMode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT) <\/code><\/pre>\n<p>\u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u043c\u0430\u0433\u0438\u044f \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/graphics\/PorterDuff.Mode\">\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Android<\/a> \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 Destination image \u0438 Source image:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8cf\/907\/e5c\/8cf907e5ce43ed8a6afa8587d4c36be9.jpg\" alt=\"\u0437\u0435\u043b\u0435\u043d\u044b\u0439 - Destination Image, \u0433\u043e\u043b\u0443\u0431\u043e\u0439 - Source image\" title=\"\u0437\u0435\u043b\u0435\u043d\u044b\u0439 - Destination Image, \u0433\u043e\u043b\u0443\u0431\u043e\u0439 - Source image\" width=\"800\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8cf\/907\/e5c\/8cf907e5ce43ed8a6afa8587d4c36be9.jpg\" data-blurred=\"true\"\/><figcaption>\u0437\u0435\u043b\u0435\u043d\u044b\u0439 &#8212; Destination Image, \u0433\u043e\u043b\u0443\u0431\u043e\u0439 &#8212; Source image<\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0438\u0445 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438:<\/p>\n<pre><code class=\"kotlin\">\/\/1  val paint = Paint() \/\/2\u00a0 canvas.drawBitmap(destinationImage, 0f, 0f, paint) \/\/3\u00a0 val mode = \/\/ choose a PorterDuff.Mode  \/\/4\u00a0 paint.xfermode = PorterDuffXfermode(mode) \/\/5\u00a0 canvas.drawBitmap(sourceImage, 0f, 0f, paint);<\/code><\/pre>\n<ol>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0443\u044e \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c Destination image.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e PorterDuff.Mode.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0451\u043c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434 \u0434\u043b\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c Source image.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e PorterDuff.Mode \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0434\u043b\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0438, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4a5\/311\/4a5\/4a53114a5e33c86f87be028acd8094eb.png\" width=\"2576\" height=\"3126\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4a5\/311\/4a5\/4a53114a5e33c86f87be028acd8094eb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442  PorterDuff.Mode = Destination Out, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u0432\u0435\u0440\u0445\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<ol start=\"6\">\n<li>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430 \u043f\u043e \u0444\u043e\u043d\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Path(), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u044c:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    ...       if (path == null) {       path = Path()     }   }<\/code><\/pre>\n<ol start=\"7\">\n<li>\n<p>\u0418 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c onTouchEvent, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0435\u0440\u0451\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0431\u0438\u0440\u0430\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430 \u0438 \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onTouchEvent(event: MotionEvent): Boolean {    val currentTouchX = event.x   val currentTouchY = event.y    when (event.action) {     MotionEvent.ACTION_DOWN -> {         path?.reset()         path?.moveTo(event.x, event.y)     }      MotionEvent.ACTION_UP -> {         path?.lineTo(currentTouchX, currentTouchY)     }      MotionEvent.ACTION_MOVE -> { \/\/\u043f\u043e\u043a\u0430 \u043f\u0443\u0441\u0442\u043e, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 }     }     scratchCanvas?.drawPath(path, innerPaint)     mLastTouchX = currentTouchX     mLastTouchY = currentTouchY     invalidate()     return true   }<\/code><\/pre>\n<p>innerPaint \u2014 \u044d\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0430.<\/p>\n<ol start=\"8\">\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u0430\u0448 RimeView<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:id=\"@+id\/container\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"     android:background=\"#9C3333\"     tools:context=\".MainActivity\"     \/><\/code><\/pre>\n<pre><code class=\"kotlin\">val container = findViewById&lt;FrameLayout>(R.id.container) val rimeView = RimeView(this) rimeView.layoutParams =  FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) container.addView(rimeView)<\/code><\/pre>\n<p>\u0418 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1e\/18d\/ccc\/d1e18dccc4eeeecf6db785a24525d720.gif\" width=\"258\" height=\"509\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1e\/18d\/ccc\/d1e18dccc4eeeecf6db785a24525d720.gif\"\/><figcaption><\/figcaption><\/figure>\n<ol start=\"9\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043f\u043e \u0445\u043e\u0434\u0443 \u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">MotionEvent.ACTION_MOVE -> {   val dx =abs(currentTouchX - mLastTouchX)   val dy =abs(currentTouchY - mLastTouchY)   if (dx >= 4 || dy >= 4) {     val x1 = mLastTouchX     val y1 = mLastTouchY     val x2 = (currentTouchX + mLastTouchX) \/ 2     val y2 = (currentTouchY + mLastTouchY) \/ 2     mPath?.quadTo(x1, y1, x2, y2)   } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D1%80%D0%B8%D0%B2%D0%B0%D1%8F_%D0%91%D0%B5%D0%B7%D1%8C%D0%B5\">\u043a\u0440\u0438\u0432\u0443\u044e \u0411\u0435\u0437\u044c\u0435<\/a>, \u0435\u0441\u043b\u0438 \u043f\u0430\u043b\u0435\u0446 \u043f\u0440\u043e\u0448\u0451\u043b \u0431\u043e\u043b\u0435\u0435 4 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c), \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u044d\u0444\u0444\u0435\u043a\u0442 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f. \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/704\/2e6\/f2a\/7042e6f2a9606b9fcadecec23d065d01.gif\" width=\"258\" height=\"509\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/704\/2e6\/f2a\/7042e6f2a9606b9fcadecec23d065d01.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0432\u0435\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432, \u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 \u043a\u0430\u043d\u0443\u043d \u043d\u043e\u0432\u043e\u0433\u043e \u0433\u043e\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0447\u0443\u0434\u0435\u0441\u0430. =)<\/p>\n<p>\u0412\u0441\u0435\u0445 \u0441 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u043c \u041d\u043e\u0432\u044b\u043c \u0433\u043e\u0434\u043e\u043c!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/company\/dododev\/blog\/708104\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u0411\u044b\u043b\u0438 \u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 PorterDuff.Mode?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             50%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0414\u0430<\/span> <span class=\"tm-article-poll__answer-votes\">             2           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:50%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             50%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041d\u0435\u0442<\/span> <span class=\"tm-article-poll__answer-votes\">             2           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:50%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 4 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.           \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 1 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.      <\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/dododev\/blog\/708104\/\"> https:\/\/habr.com\/ru\/company\/dododev\/blog\/708104\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u043b\u0438\u0437\u043a\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u0435\u0439 \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u044b.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u0432 Dodo \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438, \u043d\u043e \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0430\u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/dododev\/blog\/584498\/\">\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u00ab\u041b\u0435\u0442\u0430\u044e\u0449\u0430\u044f \u041f\u0438\u0446\u0446\u0430\u00bb<\/a>, \u0438\u0433\u0440\u0443 \u00ab\u0425\u0432\u043e\u0441\u0442\u0438\u043a\u0438\u00bb, \u0430 \u0432 \u043a\u0430\u043d\u0443\u043d \u041d\u043e\u0432\u043e\u0433\u043e \u0433\u043e\u0434\u0430 \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u0447\u043d\u0443\u044e \u0437\u0438\u043c\u043d\u044e\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0418\u0437\u043c\u043e\u0440\u043e\u0437\u044c\u00bb.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u0430\u0434 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0439 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u0438, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044d\u043a\u0440\u0430\u043d \u0437\u0430\u043c\u0451\u0440\u0437 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0435\u0451 \u043f\u0430\u043b\u044c\u0446\u0435\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438: \u043a\u0430\u043a \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432.  \u041d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435? \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435!<\/p>\n<p>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Canvas.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>Let it snow!<\/h2>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0427\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u043a \u0446\u0435\u043d\u0442\u0440\u0443, \u0442\u0435\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u0435\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043d\u0435\u0436\u0438\u043d\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><figcaption>\u0421\u043b\u0435\u0432\u0430 \u2014 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u044c, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435.<\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437\u043c\u043e\u0440\u043e\u0437\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  class RimeView constructor(context: Context) : View(context) {     \/\/ \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e   }<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0432 bitmap \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onSizeChanged, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u044b  \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0432\u044c\u044e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    \/\/rime   rimeBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val rimeCanvas = Canvas(rimeBitmap)   val rimeDrawable = ContextCompat.getDrawable(context, R.drawable.bg)   rimeDrawable?.setBounds(0, 0, w, h)   rimeDrawable?.draw(rimeCanvas)    \/\/snow   snowBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val snowCanvas = Canvas(snowBitmap)   val snowDrawable = ContextCompat.getDrawable(context, R.drawable.snow)   snowDrawable?.setBounds(0, 0, w, h)   snowDrawable?.draw(snowCanvas)   }<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onDraw:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  val paint = Paint()      override fun onDraw(canvas: Canvas) {   super.onDraw(canvas)    \/\/rime   canvas.drawBitmap(rimeBitmap, 0f, 0f, paint)    \/\/snow   canvas.drawBitmap(snowBitmap, 0f, 0f, paint)      }<\/code><\/pre>\n<p>\u0425\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0443: \u043e\u043d\u0430 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f <strong><u>paint = Paint()<\/u><\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u0435\u043d \u0442\u0440\u0435\u0442\u0438\u0439 \u00ab\u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439\u00bb bitmap, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f.<\/p>\n<ol start=\"4\">\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 bitmap \u0432 onSizeChanged, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>scratchCanvas<\/strong> \u0432 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u043d\u0435\u0439 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u0435:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    \/\/buffer bitmap   scratchBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   scratchCanvas = Canvas(scratchBitmap)    \/\/rime   rimeBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val rimeCanvas = Canvas(rimeBitmap)   val rimeDrawable = ContextCompat.getDrawable(context, R.drawable.bg)   rimeDrawable?.setBounds(0, 0, w, h)   rimeDrawable?.draw(rimeCanvas)    \/\/snow   snowBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)   val snowCanvas = Canvas(snowBitmap)   val snowDrawable = ContextCompat.getDrawable(context, R.drawable.snow)   snowDrawable?.setBounds(0, 0, w, h)   snowDrawable?.draw(snowCanvas)    }<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 onDraw:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">canvas.drawBitmap(raimBitmap, 0f, 0f, paint)  canvas.drawBitmap(snowBitmap, 0f, 0f, paint)  \/\/buffer bitmap canvas.drawBitmap(scratchBitmap, 0f, 0f, paint)<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u043a\u0438\u0441\u0442\u043e\u0447\u0435\u043a,<\/p>\n<pre><code class=\"kotlin\">  override fun onDraw(canvas: Canvas) {   super.onDraw(canvas)      paint.xfermode = srcOverPorterDuffMode    canvas.drawBitmap(rimeBitmap, 0f, 0f, paint)    canvas.drawBitmap(snowBitmap, 0f, 0f, paint)    paint.xfermode= dstOutPorterDuffMode    canvas.drawBitmap(scratchBitmap, 0f, 0f, paint)    }<\/code><\/pre>\n<p>\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c<\/p>\n<pre><code>private val srcOverPorterDuffMode = PorterDuffXfermode(PorterDuff.Mode.SRC_OVER) private val dstOutPorterDuffMode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT) <\/code><\/pre>\n<p>\u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u043c\u0430\u0433\u0438\u044f \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/graphics\/PorterDuff.Mode\">\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Android<\/a> \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 Destination image \u0438 Source image:<\/p>\n<figure class=\"full-width\"><figcaption>\u0437\u0435\u043b\u0435\u043d\u044b\u0439 &#8212; Destination Image, \u0433\u043e\u043b\u0443\u0431\u043e\u0439 &#8212; Source image<\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0438\u0445 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438:<\/p>\n<pre><code class=\"kotlin\">\/\/1  val paint = Paint() \/\/2\u00a0 canvas.drawBitmap(destinationImage, 0f, 0f, paint) \/\/3\u00a0 val mode = \/\/ choose a PorterDuff.Mode  \/\/4\u00a0 paint.xfermode = PorterDuffXfermode(mode) \/\/5\u00a0 canvas.drawBitmap(sourceImage, 0f, 0f, paint);<\/code><\/pre>\n<ol>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0443\u044e \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c Destination image.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e PorterDuff.Mode.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u0451\u043c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434 \u0434\u043b\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0438\u0441\u0443\u0435\u043c Source image.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e PorterDuff.Mode \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0434\u043b\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0438, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442  PorterDuff.Mode = Destination Out, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0441\u0432\u0435\u0440\u0445\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<ol start=\"6\">\n<li>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430 \u043f\u043e \u0444\u043e\u043d\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Path(), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u044c:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {   super.onSizeChanged(w, h, oldw, oldh)    ...       if (path == null) {       path = Path()     }   }<\/code><\/pre>\n<ol start=\"7\">\n<li>\n<p>\u0418 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c onTouchEvent, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0435\u0440\u0451\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0431\u0438\u0440\u0430\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430 \u0438 \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">  override fun onTouchEvent(event: MotionEvent): Boolean {    val currentTouchX = event.x   val currentTouchY = event.y    when (event.action) {     MotionEvent.ACTION_DOWN -> {         path?.reset()         path?.moveTo(event.x, event.y)     }      MotionEvent.ACTION_UP -> {         path?.lineTo(currentTouchX, currentTouchY)     }      MotionEvent.ACTION_MOVE -> { \/\/\u043f\u043e\u043a\u0430 \u043f\u0443\u0441\u0442\u043e, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 }     }     scratchCanvas?.drawPath(path, innerPaint)     mLastTouchX = currentTouchX     mLastTouchY = currentTouchY     invalidate()     return true   }<\/code><\/pre>\n<p>innerPaint \u2014 \u044d\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u043a\u0438\u0441\u0442\u043e\u0447\u043a\u0430.<\/p>\n<ol start=\"8\">\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u0430\u0448 RimeView<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:id=\"@+id\/container\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"     android:background=\"#9C3333\"     tools:context=\".MainActivity\"     \/><\/code><\/pre>\n<pre><code class=\"kotlin\">val container = findViewById&lt;FrameLayout>(R.id.container) val rimeView = RimeView(this) rimeView.layoutParams =  FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) container.addView(rimeView)<\/code><\/pre>\n<p>\u0418 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<ol start=\"9\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043f\u043e \u0445\u043e\u0434\u0443 \u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">MotionEvent.ACTION_MOVE -> {   val dx =abs(currentTouchX - mLastTouchX)   val dy =abs(currentTouchY - mLastTouchY)   if (dx >= 4 || dy >= 4) {     val x1 = mLastTouchX     val y1 = mLastTouchY     val x2 = (currentTouchX + mLastTouchX) \/ 2     val y2 = (currentTouchY + mLastTouchY) \/ 2     mPath?.quadTo(x1, y1, x2, y2)   } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D1%80%D0%B8%D0%B2%D0%B0%D1%8F_%D0%91%D0%B5%D0%B7%D1%8C%D0%B5\">\u043a\u0440\u0438\u0432\u0443\u044e \u0411\u0435\u0437\u044c\u0435<\/a>, \u0435\u0441\u043b\u0438 \u043f\u0430\u043b\u0435\u0446 \u043f\u0440\u043e\u0448\u0451\u043b \u0431\u043e\u043b\u0435\u0435 4 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c), \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u044d\u0444\u0444\u0435\u043a\u0442 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f. \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0432\u0435\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432, \u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 \u043a\u0430\u043d\u0443\u043d \u043d\u043e\u0432\u043e\u0433\u043e \u0433\u043e\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0447\u0443\u0434\u0435\u0441\u0430. =)<\/p>\n<p>\u0412\u0441\u0435\u0445 \u0441 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u043c \u041d\u043e\u0432\u044b\u043c \u0433\u043e\u0434\u043e\u043c!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/company\/dododev\/blog\/708104\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u0411\u044b\u043b\u0438 \u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 PorterDuff.Mode?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             50%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0414\u0430<\/span> <span class=\"tm-article-poll__answer-votes\">             2           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:50%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             50%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041d\u0435\u0442<\/span> <span class=\"tm-article-poll__answer-votes\">             2           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:50%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 4 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.           \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 1 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.      <\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/dododev\/blog\/708104\/\"> https:\/\/habr.com\/ru\/company\/dododev\/blog\/708104\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-343350","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343350"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343350\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}