public void Dispose()
 {
     if (nativeWin32Dc != null)
     {
         nativeWin32Dc.Dispose();
         nativeWin32Dc = null;
     }
 }
Пример #2
0
        public WinGdiFontPrinter(int w, int h)
        {
            _width = w;
            _height = h;
            bmpWidth = w;
            bmpHeight = h;

            memdc = new Win32.NativeWin32MemoryDc(bmpWidth, bmpHeight);
            //TODO: review here
            //use default font from current platform
            InitFont("tahoma", 14);
            memdc.SetTextColor(0);
        }
Пример #3
0
        public void Initialize(int width, int height, int bitDepth, ActualImage actualImage)
        {
            if (width > 0 && height > 0)
            {
                this.width       = width;
                this.height      = height;
                nativeWin32Dc    = new Win32.NativeWin32MemoryDc(width, height, false);
                this.actualImage = actualImage;

                return;
            }
            throw new NotSupportedException();
        }
Пример #4
0
        public WinGdiFontPrinter(CanvasGL2d canvas, int w, int h)
        {
            this.canvas = canvas;
            _width      = w;
            _height     = h;
            bmpWidth    = w;
            bmpHeight   = h;

            memdc = new Win32.NativeWin32MemoryDc(bmpWidth, bmpHeight);
            //TODO: review here
            //use default font from current platform
            InitFont("tahoma", 14);
            memdc.SetTextColor(0);
        }
        public WinGdiFontPrinter(GLRenderSurface glsx, int w, int h)
        {
            this._glsx = glsx;
            _width     = w;
            _height    = h;
            bmpWidth   = w;
            bmpHeight  = h;

            memdc = new Win32.NativeWin32MemoryDc(bmpWidth, bmpHeight);
            //TODO: review here
            //use default font from current platform
            InitFont("tahoma", 14);
            memdc.SetTextColor(0);
        }
        public void Initialize(int width, int height, int bitDepth, ActualImage actualImage)
        {
            if (width > 0 && height > 0)
            {
                this.width  = width;
                this.height = height;

                //if (bitDepth != 32)
                //{
                //    throw new NotImplementedException("Don't support this bit depth yet.");
                //}
                //else
                //{
                //    actualImage = new ActualImage(width, height, PixelFormat.ARGB32);
                this.actualImage = actualImage;
                nativeWin32Dc    = new Win32.NativeWin32MemoryDc(width, height, true);
                //    return Graphics2D.CreateFromImage(actualImage);
                //}
                return;
            }
            throw new NotSupportedException();
        }
        public override void CopyOutputPixelBuffer(int x, int y, int w, int h, IntPtr outputBuffer)
        {
            //1. This version support on Win32 only
            //2. this is an example, to draw directly into the memDC, not need to create control
            //3. x and y set to 0
            //4. w and h must be the width and height of the viewport


            unsafe
            {
                //create new memdc
                Win32.NativeWin32MemoryDc memDc = new Win32.NativeWin32MemoryDc(w, h);
                memDc.PatBlt(Win32.NativeWin32MemoryDc.PatBltColor.White);
                //TODO: check if we need to set init font/brush/pen for the new DC or not
                gdiPlusViewport.FullMode = true;
                //pain to the destination dc
                this.gdiPlusViewport.PaintMe(memDc.DC);
                IntPtr outputBits = memDc.PPVBits;
                //Win32.MyWin32.memcpy((byte*)outputBuffer, (byte*)memDc.PPVBits, w * 4 * h);
                memDc.CopyPixelBitsToOutput((byte *)outputBuffer);
                memDc.Dispose();
            }
        }
        public void Initialize(int width, int height, int bitDepth, ActualImage actualImage)
        {
            if (width > 0 && height > 0)
            {
                this.width = width;
                this.height = height;

                //if (bitDepth != 32)
                //{
                //    throw new NotImplementedException("Don't support this bit depth yet.");
                //}
                //else
                //{
                //    actualImage = new ActualImage(width, height, PixelFormat.ARGB32);
                this.actualImage = actualImage;
                nativeWin32Dc = new Win32.NativeWin32MemoryDc(width, height, true);
                //    return Graphics2D.CreateFromImage(actualImage);
                //}
                return;
            }
            throw new NotSupportedException();
        }