{"id":164705,"date":"2013-01-04T14:30:03","date_gmt":"2013-01-04T10:30:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=164705"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=164705","title":{"rendered":"<span class=\"post_title\">WPF, WinForms: \u0440\u0438\u0441\u0443\u0435\u043c Bitmap c &gt;15000 FPS. \u0425\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u044b\u0435 \u0442\u0440\u044e\u043a\u0438 \u0447.1<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0421\u0440\u0430\u0437\u0443 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: Bitmap 200&#215;100 \u043d\u0430 \u043a\u043e\u043c\u043f\u0435 \u0441 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 3930K \u043d\u0430 1366. \u041d\u043e, \u044d\u0442\u043e System.Drawing.Bitmap.<br \/>  \u0412\u0432\u043e\u0434\u043d\u0430\u044f: \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u0444\u0430. \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u043e\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/>  \u041a\u0430\u043a \u0436\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d? <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.media.imaging.writeablebitmap.aspx\">WriteableBitmap<\/a> \u0445\u043e\u0440\u043e\u0448, \u0431\u044b\u0441\u0442\u0440, \u0438 \u043e\u043d \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f WP, WinRT, WPF. \u041d\u043e \u0437\u0430\u043d\u0443\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u043f\u0451\u0440\u0430-\u043a\u043e\u0434\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u043b\u043d\u0443\u0435\u0442 WinForms, .Net 2.0, Win2K (\u0434\u0430-\u0434\u0430, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u043e\u0441.\u043e\u0440\u0433\u0430\u043d\u0430\u0445 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 <s>\u0442\u0435\u043f\u043b\u044b\u0439 \u043b\u0430\u043c\u043f\u043e\u0432\u044b\u0439<\/s> Win2K).<br \/>  \u0414\u0430\u043b\u0435\u0435, \u044f \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 DirectX, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u0434\u043b\u044f WPF \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.interop.d3dimage.aspx\">D3DImage<\/a>. \u042f \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043d\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0434\u0430\u0432\u0430\u043b \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u0437\u044f\u0449\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c GDI+ Bitmap \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 DX10-11. \u0411\u043b\u0438\u0436\u0435 \u0432\u0441\u0435\u0445 \u043a \u0446\u0435\u043b\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f <a href=\"http:\/\/slimdx.org\/\">SlimDX<\/a>. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0434\u0432\u0438\u0436\u043a\u0438\u2026 \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b, \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418, \u043a \u043c\u043e\u0435\u043c\u0443 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u044e \u043e\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c, \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u043d\u0430 Win2K \u0438 .Net 2.0.<br \/>  \u041a\u043e\u0433\u0434\u0430 \u044f \u0431\u044b\u043b \u043c\u043e\u043b\u043e\u0434\u044b\u043c, \u0438 \u0443 \u043c\u0435\u043d\u044f \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0431\u044b\u043b 5-\u0442\u0438 \u0434\u044e\u0439\u043c\u043e\u0432\u044b\u0439 \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0434, \u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f BitBlt \u0438 SetDIBitsToDevice. \u041f\u043e\u0442\u043e\u043c, \u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043d\u0430 .Net \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0438\u043c\u0438 \u0438 Win32 GDI BITMAP, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u043c\u0438 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438, \u043f\u043e\u0442\u043e\u043c \u0432\u0441\u0451 \u0437\u0430\u0431\u044b\u043b\u043e\u0441\u044c. \u041d\u043e \u0432\u0434\u0440\u0443\u0433, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0441 \u043f\u043e\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u0434\u0430 \u043f\u043b\u044e\u0441 \u0441 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439. \u0412\u043e\u0442 \u0442\u0430\u043a \u044f \u0438 \u043f\u043e\u043f\u0430\u043b \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0443\u043f\u0438\u043a.<br \/>  GDI+ Bitmap \u0447\u0435\u0440\u0442\u043e\u0432\u0441\u043a\u0438 \u0443\u0434\u043e\u0431\u0435\u043d \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0430\u043d\u0442\u0438\u0430\u043b\u0438\u0430\u0441\u0438\u043d\u0433\u043e\u043c, \u0438 \u0430\u043b\u044c\u0444\u043e\u0439. \u041e\u0447\u0435\u043d\u044c \u0432\u043a\u0443\u0441\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f. \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 Bitmap \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u0434\u0430\u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e, \u0435\u0441\u043b\u0438 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431<b>\u043e<\/b>\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438\u0445 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043d\u0435\u0442.<\/p>\n<p>  \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439:  <\/p>\n<pre><code class=\"cs\">[DllImport(&quot;gdi32&quot;)] extern static int SetDIBitsToDevice(HandleRef hDC, int xDest, int yDest, int dwWidth, int dwHeight, int XSrc, int YSrc, int uStartScan, int cScanLines, ref int lpvBits, ref BITMAPINFO lpbmi, uint fuColorUse); <\/code><\/pre>\n<p>  \u0418 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c:  <\/p>\n<pre><code class=\"cs\">public void Paint(HandleRef hRef, Bitmap bitmap) { \tif (bitmap.Width != _width || bitmap.Height != _height) \t\tRealloc(bitmap.Width, bitmap.Height); \t\/\/_gcHandle = GCHandle.Alloc(pArray, GCHandleType.Pinned); \tBitmapData BD = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),  \t\t\t\t\t\t\t\t\tImageLockMode.ReadOnly,  \t\t\t\t\t\t\t\t\tPixelFormat.Format32bppArgb); \tMarshal.Copy(BD.Scan0, _pArray, 0, _width * _height); \tSetDIBitsToDevice(hRef, 0, 0, _width, _height, 0, 0, 0, _height, ref _pArray[0], ref _BI, 0); \tbitmap.UnlockBits(BD); \t\/\/if (gcHandle.IsAllocated) \t\/\/\t_gcHandle.Free(); } <\/code><\/pre>\n<p>  \u041f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0447\u0435\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a. \u0412\u043e\u043e\u0431\u0449\u0435, \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c GC, \u043d\u043e \u0440\u0430\u0434\u0438 \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u044b\u0445 FPS, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 _pArray \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0441\u044f, GCHandle \u0443 \u043c\u0435\u043d\u044f \u043f\u0438\u043d\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 Realloc(). \u0425\u043e\u0442\u044f\u2026 \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0443 \u043d\u0430\u0441 15000, \u043f\u043b\u044e\u0441-\u043c\u0438\u043d\u0443\u0441 \u043f\u0430\u0440\u0430 \u0441\u043e\u0442\u0435\u043d FPS \u0440\u043e\u043b\u0438 \u0443\u0436\u0435 \u043d\u0435 \u0438\u0433\u0440\u0430\u044e\u0442. \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0442\u044c \u0432 Paint() \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0442\u044c \u0432 Realloc(). <br \/>  \u0412\u043e\u0442 \u0442\u0430\u043a, \u0446\u0435\u043d\u043e\u0439 \u0432\u0441\u0435\u0433\u043e 100 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 (\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u0432 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0438\u0436\u0435) \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 FPS, \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432. \u0412\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0433\u043d\u0435\u0432 \u0435\u0432\u0430\u043d\u0433\u0435\u043b\u0438\u0441\u0442\u043e\u0432 Microsoft \u00ab\u0422\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u044d\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432 \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb, \u043d\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c.<br \/>  \u0412\u0435\u0441\u044c \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u0438\u0437\u044f\u0449\u043d\u043e \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0430\u043c:  <\/p>\n<pre><code class=\"cs\">RazorPainter RP = new RazorPainter(); graphics = Control1.CreateGraphics(); hDCRef = new HandleRef(graphics, graphics.GetHdc());  public void Render() {     RP.Paint(hDCRef, BMP); }  ((System.Drawing.Graphics)hDCRef.Wrapper).ReleaseHdc(); RP.Dispose(); graphics.Dispose(); <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0447\u0435\u043d\u044c\u043a\u0438! \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u043c\u044b \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b \u043a UI Thread \u0438 Invoke \u0435\u0433\u043e. \u0420\u0430\u0434\u0438 \u0440\u0435\u043a\u043e\u0440\u0434\u043d\u044b\u0445 FPS \u0441\u043c\u0435\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 Thread \u0438 \u0432 \u043d\u0435\u043c \u0436\u0435\u0441\u0442\u043e\u043a\u043e:  <\/p>\n<pre><code class=\"cs\">renderthread = new Thread(() =&gt; { \twhile (true) \t\tRender(); }); renderthread.Start(); <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u041e\u0421 \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0445\u0443\u043b\u0438\u0433\u0430\u043d\u0441\u0442\u0432\u0430 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0442\u043e \u0432 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 WndProc \u043e\u043d\u0430 \u0443\u043f\u0440\u044f\u043c\u043e \u0437\u0430\u0442\u0438\u0440\u0430\u0435\u0442 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b Background Color. \u0418\u0437\u0431\u0430\u0432\u0438\u043c \u041e\u0421 \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0439 \u043c\u0443\u0447\u0435\u043d\u0438\u0439 (\u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u043c FPS) \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cs\">public RazorBackend() { \tInitializeComponent();  \tSetStyle(ControlStyles.DoubleBuffer, false); \tSetStyle(ControlStyles.UserPaint, true); \tSetStyle(ControlStyles.AllPaintingInWmPaint, true); \tSetStyle(ControlStyles.Opaque, true); } <\/code><\/pre>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e FPS \u0443 \u0432\u0441\u0435\u0445 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0439, \u0438 \u0434\u0435\u043b\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0435 \u2014 \u0442\u0443\u0442 \u0440\u043e\u044f\u043b\u044f\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0448\u0438\u043d\u044b, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0445 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u044f \u0434\u043e\u0431\u0438\u043b\u0441\u044f 15600 FPS, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 ~30\u041c\u0431 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u0432\u043e\u0442 \u0443\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 8% \u043c\u0435\u043d\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0430. \u041c\u044f\u0433\u043a\u043e \u0432\u044b\u0440\u0430\u0436\u0430\u044f\u0441\u044c, \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u0434\u043b\u044f 3930K. \u0418 \u0442\u0443\u0442 \u0432 \u043c\u043e\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u0435 \u00ab\u0432\u043e\u0437\u0432\u043e\u043f\u0438\u043b\u00bb \u0432\u0438\u0434\u0435\u043e\u0434\u0440\u0430\u0439\u0432\u0435\u0440: \u00ab\u0425\u043e\u0437\u044f\u0438\u043d, \u0443 \u043c\u0435\u043d\u044f \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u044d\u043f\u0438\u043b\u0435\u043f\u0441\u0438\u044f!\u00bb, \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440: \u00ab\u0410 \u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u0442\u043e\u043b\u044c\u043a\u043e 60Hz \u0443\u043c\u0435\u044e!\u00bb. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0430\u043c \u0442\u0430\u043a\u043e\u0439 FPS \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:  <\/p>\n<pre><code class=\"cs\">rendertimer = new DispatcherTimer(); rendertimer.Interval = TimeSpan.FromMilliseconds(15); \/* ~60 FPS on my PC *\/ rendertimer.Tick += (o, args) =&gt; Render(); rendertimer.Start(); <\/code><\/pre>\n<p>  \u041d\u0443 \u0438\u043b\u0438 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043d\u0430 \u0432\u0430\u0448 \u0432\u043a\u0443\u0441. \u0423\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 \u043d\u0443\u043b\u044f. <br \/>  \u0414\u0430\u043b\u0435\u0435 WPF. \u0412\u0441\u0451 \u0441\u043b\u043e\u0436\u043d\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u00ab\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044b\u00bb WPF \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430\u043c\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f (\u0430 \u0438\u043d\u0430\u0447\u0435 \u0431\u044b \u043c\u044b \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0438\u0445 \u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0438 \u043f\u043b\u044e\u0449\u0438\u0442\u044c), \u0438 \u0443 \u043d\u0438\u0445 \u043d\u0435\u0442 DC. \u0412\u0441\u0435 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u043e\u043c WindowsForms \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u0432 WPF \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 WindowsFormsHost. \u0412 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043c\u0435\u043d\u043d\u043e WPF \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 WindowsForms, \u0431\u043b\u0430\u0433\u043e \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u043f\u0440\u043e\u0441\u0442 \u043a\u0430\u043a \u0441\u0430\u043f\u043e\u0433. <br \/>  \u0426\u0438\u043a\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 Bitmap \u0432 \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"cs\">GFX.Clear((drawred = !drawred) ? System.Drawing.Color.Red : System.Drawing.Color.Blue); <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f FPS \u0446\u0438\u043a\u043b\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0438\u0441\u0443\u0435\u043c\u043e\u0433\u043e Bitmap, \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432 \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2014 \u044d\u0442\u043e \u0434\u0438\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0431\u043b\u043e\u0447\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f.<\/p>\n<p>  \u041f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0438 \u0437\u0430\u0447\u0435\u043c. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438 \u0431\u0438\u043b\u0434, \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 CodePlex:<br \/>  <a href=\"http:\/\/razorgdipainter.codeplex.com\/\">http:\/\/razorgdipainter.codeplex.com\/<\/a><br \/>  (\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u043d\u0435\u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 CodePlex, \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u043e\u043e\u0444\u043e\u0440\u043c\u043b\u044e \u0434\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e OpenSource) \t\t\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\/164705\/\"> http:\/\/habrahabr.ru\/post\/164705\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0421\u0440\u0430\u0437\u0443 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: Bitmap 200&#215;100 \u043d\u0430 \u043a\u043e\u043c\u043f\u0435 \u0441 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 3930K \u043d\u0430 1366. \u041d\u043e, \u044d\u0442\u043e System.Drawing.Bitmap.<br \/>  \u0412\u0432\u043e\u0434\u043d\u0430\u044f: \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u0444\u0430. \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u043e\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/>  \u041a\u0430\u043a \u0436\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d? <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.media.imaging.writeablebitmap.aspx\">WriteableBitmap<\/a> \u0445\u043e\u0440\u043e\u0448, \u0431\u044b\u0441\u0442\u0440, \u0438 \u043e\u043d \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f WP, WinRT, WPF. \u041d\u043e \u0437\u0430\u043d\u0443\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u043f\u0451\u0440\u0430-\u043a\u043e\u0434\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u043b\u043d\u0443\u0435\u0442 WinForms, .Net 2.0, Win2K (\u0434\u0430-\u0434\u0430, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u043e\u0441.\u043e\u0440\u0433\u0430\u043d\u0430\u0445 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 <s>\u0442\u0435\u043f\u043b\u044b\u0439 \u043b\u0430\u043c\u043f\u043e\u0432\u044b\u0439<\/s> Win2K).<br \/>  \u0414\u0430\u043b\u0435\u0435, \u044f \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 DirectX, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u0434\u043b\u044f WPF \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.interop.d3dimage.aspx\">D3DImage<\/a>. \u042f \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043d\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0434\u0430\u0432\u0430\u043b \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u0437\u044f\u0449\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c GDI+ Bitmap \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 DX10-11. \u0411\u043b\u0438\u0436\u0435 \u0432\u0441\u0435\u0445 \u043a \u0446\u0435\u043b\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f <a href=\"http:\/\/slimdx.org\/\">SlimDX<\/a>. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0434\u0432\u0438\u0436\u043a\u0438\u2026 \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b, \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.  <\/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-164705","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164705","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=164705"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164705\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}