コード例 #1
0
        public GdiPlusRenderSurface(int width, int height)
        {
#if DEBUG
            debug_canvas_id   = dbug_canvasCount + 1;
            dbug_canvasCount += 1;
#endif

            //2. dimension
            _left            = 0;
            _top             = 0;
            _right           = _left + width;
            _bottom          = _top + height;
            _currentClipRect = new System.Drawing.Rectangle(0, 0, width, height);

            //--------------
            _win32MemDc = new NativeWin32MemoryDC(width, height, false);
            _win32MemDc.PatBlt(NativeWin32MemoryDC.PatBltColor.White);
            _win32MemDc.SetBackTransparent(true);
            _win32MemDc.SetClipRect(0, 0, width, height);
            //--------------
            _memBmp = new CpuBlit.MemBitmap(width, height, _win32MemDc.PPVBits);


            _originalHdc = _win32MemDc.DC;
            _gx          = System.Drawing.Graphics.FromHdc(_win32MemDc.DC);


            //--------------
            //TODO: review here how to set default font***
            //set default font
            Win32.Win32Font font = Win32.FontHelper.CreateWin32Font("Tahoma", 10, false, false);
            _hFont = font.GetHFont();
            _win32MemDc.SetFont(_hFont);
            //---------------------

            //--------------
            //set default font and default text color
            this.CurrentFont      = new RequestFont("tahoma", 14);
            this.CurrentTextColor = Color.Black;
            //-------------------------------------------------------
            //managed object
            _internalPen        = new System.Drawing.Pen(System.Drawing.Color.Black);
            _internalSolidBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
            this.StrokeWidth    = 1;
        }
コード例 #2
0
        internal void ReleaseUnManagedResource()
        {
            if (_win32MemDc != null)
            {
                _win32MemDc.Dispose();
                _win32MemDc  = null;
                _originalHdc = IntPtr.Zero;
            }

            if (_hFont != IntPtr.Zero)
            {
                Win32.MyWin32.DeleteObject(_hFont);
                _hFont = IntPtr.Zero;
            }

            _clipRectStack.Clear();
            _currentClipRect = new System.Drawing.Rectangle(0, 0, this.Width, this.Height);



#if DEBUG
            debug_releaseCount++;
#endif
        }
コード例 #3
0
 static WinGdiTextService()
 {
     s_en            = Encoding.Default; //use platform's default encoding
     s_win32MemDc    = new NativeWin32MemoryDC(2, 2);
     s_whitespace[0] = ' ';
 }