{"id":427977,"date":"2024-07-31T21:02:06","date_gmt":"2024-07-31T21:02:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=427977"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=427977","title":{"rendered":"<span>\u0421\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/997\/138\/a3a\/997138a3a81519b46e0ef992ddfd0d00.png\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/997\/138\/a3a\/997138a3a81519b46e0ef992ddfd0d00.png\"\/><\/figure>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/articles\/832360\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u043f\u0430\u043d\u0435\u043b\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0446\u0432\u0435\u0442\u0430 &#8212; \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430, \u043e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439, \u043e\u043d \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430. \u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043b\u0435\u0433\u043a\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a &#8212; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043c\u044f\u0433\u0447\u0430\u044e\u0449\u0438\u0445 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0438\u0437\u0433\u0438\u0431\u0430\u0445 \u043b\u0438\u043d\u0438\u0439, \u0434\u0443\u0433, \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u0440\u0443\u0431\u043e \u0438 \u0443\u0433\u043b\u043e\u0432\u0430\u0442\u043e, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0438\u0434\u043d\u0430 \u0438\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430.<\/p>\n<p>\u041e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 &#8212; \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438\u0437\u043e\u0433\u043d\u0443\u0442\u044b\u0445 \u043b\u0438\u043d\u0438\u0439 \u0438 \u043a\u043e\u043d\u0442\u0443\u0440\u043e\u0432 \u0432 \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u043f\u0440\u0438 \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435. \u0414\u0440\u0443\u0433\u043e\u0439, \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u043a\u0430\u043a antialiasing. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u043c\u043d\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 C# \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"cs\">\/\/ decoder Bitmap stringToBitmap(Color pen, string s) {     byte basecode = s[0];     byte w = s[1] - basecode;     byte h = s[2] - basecode;     Bitmap bmp = new Bitmap(w, h);     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             bmp.SetPixel(x, y, ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent);     return bmp; }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 s. \u0417\u0430\u0434\u0430\u0432\u0430\u044f \u0432\u0441\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c, \u0447\u0435\u0439 \u0431\u0438\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0440\u0430\u0432\u0435\u043d 1 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 pen, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0436\u0435 Color.Transparent.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 &#8212; \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043e\u0437\u043b\u0435 \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0442\u0440\u0451\u0445 \u0437\u0430\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0446\u0432\u0435\u0442, \u043d\u043e \u043d\u0430 3\/4 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0446\u0432\u0435\u0442 pen, \u043d\u043e \u0441 pen.alpha \/ 4. \u0421\u043e\u0441\u0435\u0434\u044f\u043c\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441\u0432\u0435\u0440\u0445\u0443, \u0441\u043d\u0438\u0437\u0443, \u0441\u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u043b\u0435\u0432\u0430. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d 4, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 s \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">\/\/ decoder with antialiasing Bitmap stringToBitmap(Color pen, string s) {     Color ppart = Color.FromArgb(pen.A \/ 4, pen.R, pen.G, pen.B);     int basecode = s[0];     int w = s[1] - basecode;     int h = s[2] - basecode;     var data = new Color[h, w];     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             data[y, x] = ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent;       \/\/ antialiasing     Bitmap bmp = new Bitmap(w, h);     for (int y = 1; y &lt; h - 1; y++)         for (int x = 1; x &lt; w - 1; x++)         {             int q = 0;             if (data[y - 1, x] == pen) q++;             if (data[y + 1, x] == pen) q++;             if (data[y, x - 1] == pen) q++;             if (data[y, x + 1] == pen) q++;             if ((q == 2 || q == 3) &amp;&amp; data[y, x] == Color.Transparent) data[y, x] = ppart;             bmp.SetPixel(x, y, data[y, x]);         }     return bmp; }<\/code><\/pre>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/24c\/bc4\/7e4\/24cbc47e4bcc69581f55e4994fd4c88b.png\" alt=\"\u043f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" title=\"\u043f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" width=\"118\" height=\"119\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/24c\/bc4\/7e4\/24cbc47e4bcc69581f55e4994fd4c88b.png\"\/><\/p>\n<div><figcaption>\u043f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d61\/62d\/623\/d6162d623928ca2a6f9f19394c08fac7.png\" alt=\"\u0442\u0430 \u0436\u0435 \u043f\u0430\u043d\u0435\u043b\u044c, \u043d\u043e \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c\" title=\"\u0442\u0430 \u0436\u0435 \u043f\u0430\u043d\u0435\u043b\u044c, \u043d\u043e \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c\" width=\"115\" height=\"118\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d61\/62d\/623\/d6162d623928ca2a6f9f19394c08fac7.png\"\/><\/p>\n<div><figcaption>\u0442\u0430 \u0436\u0435 \u043f\u0430\u043d\u0435\u043b\u044c, \u043d\u043e \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9a7\/ba9\/c7e\/9a7ba9c7e7504c1379d5baa5455fd2c5.png\" alt=\"\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" title=\"\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" width=\"187\" height=\"31\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9a7\/ba9\/c7e\/9a7ba9c7e7504c1379d5baa5455fd2c5.png\"\/><\/p>\n<div><figcaption>\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ab1\/71a\/f37\/ab171af37e47cc5bbab2a3056d7dca9a.png\" alt=\"\u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c\" title=\"\u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c\" width=\"186\" height=\"31\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ab1\/71a\/f37\/ab171af37e47cc5bbab2a3056d7dca9a.png\"\/><\/p>\n<div><figcaption>\u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p><em>(\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &#171;\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f&#187; \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0438 &#171;\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435&#187;, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u0448\u0430\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442 100%)<\/em><\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u0438\u0432\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u0438 \u0433\u043b\u0430\u0434\u043a\u0438\u043c\u0438, \u043d\u043e \u0438 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u043e\u0442\u043d\u044b\u043c\u0438, \u0437\u0430 \u0441\u0447\u0451\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445, \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0438\u0437\u0433\u0438\u0431\u0430\u043c, \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0441 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0446\u0432\u0435\u0442\u0430. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0432\u0438\u0434 \u0442\u043e\u043d\u043a\u0438\u0445 \u043b\u0438\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c.<\/p>\n<p>\u0425\u043e\u0442\u044f, \u0438\u043d\u043e\u0433\u0434\u0430, \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043c\u043e\u0436\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u043a\u0438, \u0438\u043b\u0438 \u043c\u0435\u043b\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u0430\u043c\u044b\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">\/\/ decoder with antialiasing option Bitmap stringToBitmap(Color pen, string s, bool antialiasing) {     Color ppart = Color.FromArgb(pen.A \/ 4, pen.R, pen.G, pen.B);     int basecode = s[0];     int w = s[1] - basecode;     int h = s[2] - basecode;     var data = new Color[h, w];     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             data[y, x] = ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent;       \/\/ antialiasing and image fill     Bitmap bmp = new Bitmap(w, h);     for (int y = 1; y &lt; h - 1; y++)         for (int x = 1; x &lt; w - 1; x++)         {             if (antialiasing)             {                 int q = 0;                 if (data[y - 1, x] == pen) q++;                 if (data[y + 1, x] == pen) q++;                 if (data[y, x - 1] == pen) q++;                 if (data[y, x + 1] == pen) q++;                 if ((q == 2 || q == 3) &amp;&amp; data[y, x] == Color.Transparent) data[y, x] = ppart;             }             bmp.SetPixel(x, y, data[y, x]);         }     return bmp; }<\/code><\/pre>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0435 \u0441 \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0430 \u0441 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u043e\u0439, \u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0433\u043b\u0430\u0434\u043a\u0438\u0435 \u043a\u0440\u0438\u0432\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u0442\u0443\u0442 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0425\u043e\u0442\u044f, \u043c\u043e\u0436\u0435\u0442 \u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438, \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b?<\/p>\n<p>\u0414\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f BitImageTool, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c BitImageTool \u043c\u043e\u0436\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/questfulcat\/BitImageTool\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/832924\/\"> https:\/\/habr.com\/ru\/articles\/832924\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/articles\/832360\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u043f\u0430\u043d\u0435\u043b\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0446\u0432\u0435\u0442\u0430 &#8212; \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430, \u043e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439, \u043e\u043d \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430. \u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043b\u0435\u0433\u043a\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a &#8212; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043c\u044f\u0433\u0447\u0430\u044e\u0449\u0438\u0445 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0438\u0437\u0433\u0438\u0431\u0430\u0445 \u043b\u0438\u043d\u0438\u0439, \u0434\u0443\u0433, \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u0440\u0443\u0431\u043e \u0438 \u0443\u0433\u043b\u043e\u0432\u0430\u0442\u043e, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0438\u0434\u043d\u0430 \u0438\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430.<\/p>\n<p>\u041e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 &#8212; \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438\u0437\u043e\u0433\u043d\u0443\u0442\u044b\u0445 \u043b\u0438\u043d\u0438\u0439 \u0438 \u043a\u043e\u043d\u0442\u0443\u0440\u043e\u0432 \u0432 \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u043f\u0440\u0438 \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435. \u0414\u0440\u0443\u0433\u043e\u0439, \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u043e\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u043a\u0430\u043a antialiasing. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u043c\u043d\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 C# \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"cs\">\/\/ decoder Bitmap stringToBitmap(Color pen, string s) {     byte basecode = s[0];     byte w = s[1] - basecode;     byte h = s[2] - basecode;     Bitmap bmp = new Bitmap(w, h);     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             bmp.SetPixel(x, y, ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent);     return bmp; }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 s. \u0417\u0430\u0434\u0430\u0432\u0430\u044f \u0432\u0441\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c, \u0447\u0435\u0439 \u0431\u0438\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0440\u0430\u0432\u0435\u043d 1 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 pen, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0436\u0435 Color.Transparent.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 &#8212; \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043e\u0437\u043b\u0435 \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0442\u0440\u0451\u0445 \u0437\u0430\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0446\u0432\u0435\u0442, \u043d\u043e \u043d\u0430 3\/4 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0446\u0432\u0435\u0442 pen, \u043d\u043e \u0441 pen.alpha \/ 4. \u0421\u043e\u0441\u0435\u0434\u044f\u043c\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441\u0432\u0435\u0440\u0445\u0443, \u0441\u043d\u0438\u0437\u0443, \u0441\u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u043b\u0435\u0432\u0430. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d 4, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 s \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">\/\/ decoder with antialiasing Bitmap stringToBitmap(Color pen, string s) {     Color ppart = Color.FromArgb(pen.A \/ 4, pen.R, pen.G, pen.B);     int basecode = s[0];     int w = s[1] - basecode;     int h = s[2] - basecode;     var data = new Color[h, w];     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             data[y, x] = ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent;       \/\/ antialiasing     Bitmap bmp = new Bitmap(w, h);     for (int y = 1; y &lt; h - 1; y++)         for (int x = 1; x &lt; w - 1; x++)         {             int q = 0;             if (data[y - 1, x] == pen) q++;             if (data[y + 1, x] == pen) q++;             if (data[y, x - 1] == pen) q++;             if (data[y, x + 1] == pen) q++;             if ((q == 2 || q == 3) &amp;&amp; data[y, x] == Color.Transparent) data[y, x] = ppart;             bmp.SetPixel(x, y, data[y, x]);         }     return bmp; }<\/code><\/pre>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437:<\/p>\n<figure class=\"\">\n<div><figcaption>\u043f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\">\n<div><figcaption>\u0442\u0430 \u0436\u0435 \u043f\u0430\u043d\u0435\u043b\u044c, \u043d\u043e \u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\">\n<div><figcaption>\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\">\n<div><figcaption>\u0441\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p><em>(\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &#171;\u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f&#187; \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0438 &#171;\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435&#187;, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u0448\u0430\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442 100%)<\/em><\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0440\u0438\u0432\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u0438 \u0433\u043b\u0430\u0434\u043a\u0438\u043c\u0438, \u043d\u043e \u0438 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u043e\u0442\u043d\u044b\u043c\u0438, \u0437\u0430 \u0441\u0447\u0451\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445, \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0438\u0437\u0433\u0438\u0431\u0430\u043c, \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0441 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0446\u0432\u0435\u0442\u0430. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u0434\u0430\u0436\u0435 \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0432\u0438\u0434 \u0442\u043e\u043d\u043a\u0438\u0445 \u043b\u0438\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0438\u043a\u0442\u043e\u0433\u0440\u0430\u043c\u043c.<\/p>\n<p>\u0425\u043e\u0442\u044f, \u0438\u043d\u043e\u0433\u0434\u0430, \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043c\u043e\u0436\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0435\u0437 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u043a\u0438, \u0438\u043b\u0438 \u043c\u0435\u043b\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u0430\u043c\u044b\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">\/\/ decoder with antialiasing option Bitmap stringToBitmap(Color pen, string s, bool antialiasing) {     Color ppart = Color.FromArgb(pen.A \/ 4, pen.R, pen.G, pen.B);     int basecode = s[0];     int w = s[1] - basecode;     int h = s[2] - basecode;     var data = new Color[h, w];     for (int y = 0; y &lt; h; y++)         for (int x = 0; x &lt; w; x++)             data[y, x] = ((s[3 + (y * w + x) \/ 6] - basecode) &amp; (1 &lt;&lt; (y * w + x) % 6)) &gt; 0 ? pen : Color.Transparent;       \/\/ antialiasing and image fill     Bitmap bmp = new Bitmap(w, h);     for (int y = 1; y &lt; h - 1; y++)         for (int x = 1; x &lt; w - 1; x++)         {             if (antialiasing)             {                 int q = 0;                 if (data[y - 1, x] == pen) q++;                 if (data[y + 1, x] == pen) q++;                 if (data[y, x - 1] == pen) q++;                 if (data[y, x + 1] == pen) q++;                 if ((q == 2 || q == 3) &amp;&amp; data[y, x] == Color.Transparent) data[y, x] = ppart;             }             bmp.SetPixel(x, y, data[y, x]);         }     return bmp; }<\/code><\/pre>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0435 \u0441 \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043d\u0430 \u0441\u0435\u0442\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0430 \u0441 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u043e\u0439, \u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0433\u043b\u0430\u0434\u043a\u0438\u0435 \u043a\u0440\u0438\u0432\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u0442\u0443\u0442 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0425\u043e\u0442\u044f, \u043c\u043e\u0436\u0435\u0442 \u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438, \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b?<\/p>\n<p>\u0414\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f BitImageTool, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c BitImageTool \u043c\u043e\u0436\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/questfulcat\/BitImageTool\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/832924\/\"> https:\/\/habr.com\/ru\/articles\/832924\/<\/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-427977","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427977","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=427977"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/427977\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}