{"id":176717,"date":"2013-04-15T13:38:03","date_gmt":"2013-04-15T09:38:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=176717"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=176717","title":{"rendered":"<span class=\"post_title\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 1\u0421 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 .Net framework \u043f\u0440\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t1\u0421: \u041f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0432\u043e\u0434\u044f\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 1\u0421 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0441 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c\u0438. \u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438 \u0432\u044b\u0437\u043e\u0432 \u0443\u0442\u0438\u043b\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442, \u043f\u043b\u044e\u0441 \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 .Net framework \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b System.Drawing, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043b\u044e\u0431\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f .Net framework 4.0 \u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0435\u0433\u043e \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u0441 1\u0421 .Net bridge 4.<\/p>\n<h2>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u041a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 1\u0421, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 .Net Framework \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0431\u043e\u0440\u043a\u0443 System.Drawing 4\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"1c\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0412\u043d\u0435\u0448\u043d\u044e\u044e\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443(&quot;Elisy.NetBridge4&quot;); AddIn = New(&quot;AddIn.ElisyNetBridge4&quot;); net = AddIn.GetNet(); net.LoadAssembly(&quot;System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot;); <\/code><\/pre>\n<h2>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c\u0438<\/h2>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 .Net Framework \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Bitmap, \u0430 \u0432\u043d\u0443\u0442\u0440\u0438 1C \u0437\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u0438\u043f \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 Bitmap.<\/p>\n<p>  \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 1\u0421 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435() \u0434\u043b\u044f \u0442\u0438\u043f\u0430 \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430. \u0414\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0422\u043e\u0440\u0433\u043e\u0432\u043b\u0435\u0439 10.3 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<pre><code class=\"1c\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0443(\u041d\u043e\u043c\u0435\u043d\u043a\u043b\u0430\u0442\u0443\u0440\u0430) \u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0415\u0441\u043b\u0438 \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e(\u041d\u043e\u043c\u0435\u043d\u043a\u043b\u0430\u0442\u0443\u0440\u0430.\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435) \u0422\u043e\u0433\u0434\u0430     \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u041d\u043e\u043c\u0435\u043d\u043a\u043b\u0430\u0442\u0443\u0440\u0430.\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c().\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435(); \u0418\u043d\u0430\u0447\u0435     \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 = \u041d\u043e\u0432\u044b\u0439 \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430();     \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430.\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435(); \u041a\u043e\u043d\u0435\u0446\u0415\u0441\u043b\u0438; \u041a\u043e\u043d\u0435\u0446\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0432\u0435\u0440\u043d\u0435\u0442 1\u0421-\u0442\u0438\u043f \u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 .Net-\u0442\u0438\u043f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"1c\">bytes = net.CallStatic(&quot;System.Convert&quot;, &quot;FromBase64String&quot;, Base64String(\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430)); bitmap = net.New(&quot;System.Drawing.Bitmap&quot;, net.New(&quot;System.IO.MemoryStream&quot;, bytes)); <\/code><\/pre>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f width, height \u0438 \u0435\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 Bitmap, \u0442\u043e \u0432 1\u0421 \u043a\u043e\u0434 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code class=\"1c\">outputBitmap = net.New(&quot;System.Drawing.Bitmap&quot;, width, height); g = net.CallStatic(&quot;System.Drawing.Graphics&quot;, &quot;FromImage&quot;, outputBitmap); g.CompositingQuality = net.New(&quot;System.Drawing.Drawing2D.CompositingQuality&quot;).HighQuality; g.SmoothingMode = net.New(&quot;System.Drawing.Drawing2D.SmoothingMode&quot;).HighQuality; g.InterpolationMode = net.New(&quot;System.Drawing.Drawing2D.InterpolationMode&quot;).HighQualityBicubic; g.Clear(net.GetStatic(&quot;System.Drawing.Color&quot;, &quot;WhiteSmoke&quot;));  sx = width \/ Bitmap.Width; sy = height \/ Bitmap.Height; scale = \u041c\u0438\u043d(sx, sy); g.DrawImage(bitmap, \u041e\u043a\u0440((outputBitmap.Width - scale * bitmap.Width) \/ 2, 0), \u041e\u043a\u0440((outputBitmap.Height - scale * bitmap.Height) \/ 2, 0), \u041e\u043a\u0440(scale * bitmap.Width, 0), \u041e\u043a\u0440(scale * bitmap.Height, 0));  \u0415\u0441\u043b\u0438 width &gt;= 100 \u0418\u041b\u0418 height &gt;= 100 \u0422\u043e\u0433\u0434\u0430 \t\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0412\u043e\u0434\u044f\u043d\u043e\u0439\u0417\u043d\u0430\u043a(net, g, watermark, width, height); \u041a\u043e\u043d\u0435\u0446\u0415\u0441\u043b\u0438; <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 g \u0442\u0438\u043f\u0430 Graphics, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f outputBitmap \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 width \u0438 height. \u0412\u044b\u0437\u043e\u0432 g.Clear \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u0444\u043e\u043d \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 WhiteSmoke). \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 g \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0412\u043e\u0434\u044f\u043d\u043e\u0439\u0417\u043d\u0430\u043a \u0437\u0434\u0435\u0441\u044c \u0436\u0435, \u0433\u0434\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 watermark. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<p>  <code>g.Dispose(); <\/code><\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434 Dispose \u043b\u0443\u0447\u0448\u0435 \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 IDisposable \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043f\u0430\u043b\u0430: Bitmap, outputBitmap, \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 MemoryStream.<\/p>\n<h2>\u041d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u044f\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430<\/h2>\n<p>  \u0412\u043e\u0434\u044f\u043d\u043e\u0439 \u0437\u043d\u0430\u043a \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 System.Drawing. \u0414\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u0435 g. MeasureString, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u0421\u043f\u043e\u0441\u043e\u0431 1<\/h3>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u043d\u043e\u0441\u0438\u0442 \u0432\u043e\u0434\u044f\u043d\u043e\u0439 \u0437\u043d\u0430\u043a \u0432\u043d\u0438\u0437\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0448\u0440\u0438\u0444\u0442\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 72 \u0438 \u043d\u0438\u0436\u0435, \u043f\u043e\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u043e\u0434\u044f\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430 \u043d\u0435 \u0432\u043e\u0439\u0434\u0435\u0442 \u0432 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0421\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u0440\u0430\u0437\u0430: \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0439 \u0447\u0435\u0440\u043d\u043e\u0439 \u043a\u0438\u0441\u0442\u044c\u044e \u0438 \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0439 \u0431\u0435\u043b\u043e\u0439 \u043a\u0438\u0441\u0442\u044c\u044e \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/www.richmedia.us\/image.axd?picture=2013%2f4%2fwatermark1.jpg\" alt=\"\u041e\u0431\u0440\u0430\u0437\u0435\u0446 \u0432\u043e\u0434\u044f\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0443 1\"\/><\/p>\n<pre><code class=\"1c\">sizes = net.New(&quot;System.Collections.Generic.List&quot;, net.T(&quot;System.Int32&quot;)); sizes.Add(72); sizes.Add(36); sizes.Add(24); sizes.Add(16); sizes.Add(14); sizes.Add(12); sizes.Add(10); sizes.Add(8); sizes.Add(6); sizes.Add(4); \t\t crFont = null; crSize = net.New(&quot;System.Drawing.SizeF&quot;); \u0414\u043b\u044f i = 0 \u043f\u043e 8 \u0446\u0438\u043a\u043b     crFont = net.New(&quot;System.Drawing.Font&quot;, &quot;arial&quot;, sizes.get_Item(i),  net.New(&quot;System.Drawing.FontStyle&quot;).Bold);     crSize = g.MeasureString(Watermark, crFont);      \u0415\u0441\u043b\u0438 crSize.Width &lt; width \u0442\u043e\u0433\u0434\u0430         \u041f\u0440\u0435\u0440\u0432\u0430\u0442\u044c;     \u041a\u043e\u043d\u0435\u0446\u0415\u0441\u043b\u0438; \u041a\u043e\u043d\u0435\u0446\u0426\u0438\u043a\u043b\u0430;  yPixlesFromBottom = \u041e\u043a\u0440(height * 0.05, 0); yPosFromBottom = ((height - yPixlesFromBottom) - (crSize.Height \/ 2)); xCenterOfImg = width \/ 2;  StrFormat = net.New(&quot;System.Drawing.StringFormat&quot;); StrFormat.Alignment = net.New(&quot;System.Drawing.StringAlignment&quot;).Center;  semiTransBrush2 = net.New(&quot;System.Drawing.SolidBrush&quot;, net.CallStatic(&quot;System.Drawing.Color&quot;, &quot;FromArgb&quot;, 153, 0, 0, 0));  g.DrawString(watermark,     crFont,     semiTransBrush2,     net.New(&quot;System.Drawing.PointF&quot;, \u041e\u043a\u0440(xCenterOfImg + 1, 0), \u041e\u043a\u0440(yPosFromBottom + 1, 0)),     StrFormat);  semiTransBrush = net.New(&quot;System.Drawing.SolidBrush&quot;, net.CallStatic(&quot;System.Drawing.Color&quot;, &quot;FromArgb&quot;, 153, 255, 255, 255)); \t\t\t g.DrawString(watermark,     crFont,     semiTransBrush,     net.New(&quot;System.Drawing.PointF&quot;, \u041e\u043a\u0440(xCenterOfImg, 0), \u041e\u043a\u0440(yPosFromBottom, 0)),     StrFormat); <\/code><\/pre>\n<h2>\u0421\u043f\u043e\u0441\u043e\u0431\u043e 2<\/h2>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432\u043e\u0434\u044f\u043d\u043e\u0439 \u0437\u043d\u0430\u043a \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0421 \u0441\u043e\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0448\u0440\u0438\u0444\u0442\u0430 \u0432\u043d\u0438\u0437 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0443\u0434\u0430\u0447\u043d\u0430\u044f, \u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c \u0441 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u0443\u0433\u043b\u043e\u043c \u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0447\u0443\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u0431\u0435\u043b\u043e\u0439 \u043a\u0438\u0441\u0442\u044c\u044e.<\/p>\n<pre><code class=\"1c\">font = net.New(&quot;System.Drawing.Font&quot;, &quot;Tahoma&quot;, 40); color = net.CallStatic(&quot;System.Drawing.Color&quot;, &quot;FromArgb&quot;, 25, 255, 255, 255); tangent = height \/ width; angle = ATan(tangent) * (180 \/ 3.1415); halfHypotenuse = Sqrt((Height * Height) + (Width * Width)) \/ 2; \u0414\u043b\u044f i2 = 0 \u043f\u043e 99 \u0446\u0438\u043a\u043b i = 100 - i2; \t\t \tfont = net.New(&quot;System.Drawing.Font&quot;, &quot;Tahoma&quot;, i, net.New(&quot;System.Drawing.FontStyle&quot;).Bold); sizef = g.MeasureString(watermark, font, net.GetStatic(&quot;System.Int32&quot;, &quot;MaxValue&quot;));  sin = Sin(angle * (3.1415 \/ 180)); \tcos = Cos(angle * (3.1415 \/ 180)); \topp1 = sin * sizef.Width; \tadj1 = cos * sizef.Height; \topp2 = sin * sizef.Height; \tadj2 = cos * sizef.Width;  \t\u0415\u0441\u043b\u0438 opp1 + adj1 &lt; height \u0418 opp2 + adj2 &lt; width \u0442\u043e\u0433\u0434\u0430 \t\t\u041f\u0440\u0435\u0440\u0432\u0430\u0442\u044c; \t\u041a\u043e\u043d\u0435\u0446\u0415\u0441\u043b\u0438;  \u041a\u043e\u043d\u0435\u0446\u0426\u0438\u043a\u043b\u0430; \t stringFormat = net.New(&quot;System.Drawing.StringFormat&quot;); stringFormat.Alignment = net.New(&quot;System.Drawing.StringAlignment&quot;).Center; stringFormat.LineAlignment = net.New(&quot;System.Drawing.StringAlignment&quot;).Center;  g.SmoothingMode = net.New(&quot;System.Drawing.Drawing2D.SmoothingMode&quot;).AntiAlias; g.RotateTransform(\u041e\u043a\u0440(angle, 0)); g.DrawString(watermark,         font,         net.New(&quot;System.Drawing.SolidBrush&quot;, color),         net.New(&quot;System.Drawing.PointF&quot;, \u041e\u043a\u0440(halfHypotenuse, 0), 0),         stringFormat); <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f 2\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430:<br \/>  <img decoding=\"async\" src=\"http:\/\/www.richmedia.us\/image.axd?picture=2013%2f4%2fwatermark2.jpg\" alt=\"\u041e\u0431\u0440\u0430\u0437\u0435\u0446 \u0432\u043e\u0434\u044f\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0443 2\"\/>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/176717\/\"> http:\/\/habrahabr.ru\/post\/176717\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t1\u0421: \u041f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0432\u043e\u0434\u044f\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 1\u0421 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0441 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c\u0438. \u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438 \u0432\u044b\u0437\u043e\u0432 \u0443\u0442\u0438\u043b\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442, \u043f\u043b\u044e\u0441 \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/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-176717","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/176717","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=176717"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/176717\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}