PixelFarm.Drawing.DrawBoard CreateSoftwareDrawBoard(int width, int height, InnerViewportKind innerViewportKind)
        {
            PixelFarm.Drawing.WinGdi.GdiPlusRenderSurface gdiRenderSurface = new PixelFarm.Drawing.WinGdi.GdiPlusRenderSurface(width, height);
            var drawBoard = new PixelFarm.Drawing.WinGdi.GdiPlusDrawBoard(gdiRenderSurface);

            drawBoard.CurrentFont = new PixelFarm.Drawing.RequestFont("Tahoma", 10);
            return(drawBoard);
        }
Beispiel #2
0
        protected override void SetupCpuBlitRenderSurface()
        {
            //don't call base
            //1. we create gdi plus draw board
            var renderSurface = new PixelFarm.Drawing.WinGdi.GdiPlusRenderSurface(_width, _height);

            _gdiDrawBoard             = new PixelFarm.Drawing.WinGdi.GdiPlusDrawBoard(renderSurface);
            _gdiDrawBoard.CurrentFont = new RequestFont("Tahoma", 10);

            //2. create actual bitmap that share 'bitmap mem' with gdiPlus Render surface
            _memBmp = renderSurface.GetMemBitmap();
            //3. create painter from the agg bmp (then we will copy the 'client' gdi mem surface to the GL)
            _aggPainter = renderSurface.GetAggPainter();//**

            //***
            //
            //...
            //
            _memBitmapBinder = new MemBitmapBinder(_memBmp, false);
            _memBitmapBinder.BitmapFormat = BitmapBufferFormat.BGR;//**
        }
Beispiel #3
0
        void SoftAggControl_Load(object sender, EventArgs e)
        {
            if (_useGdiPlusOutput)
            {
                // This example assumes the existence of a form called Form1.
                // Gets a reference to the current BufferedGraphicsContext
                //BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
                //_myBuffGfx = currentContext.Allocate(this.CreateGraphics(),
                //   this.DisplayRectangle);

                // Creates a BufferedGraphics instance associated with Form1, and with
                // dimensions the same size as the drawing surface of Form1.
                thisGfx       = this.CreateGraphics(); //for render to output
                bufferBmpRect = this.DisplayRectangle;
                //bufferBmp = new Bitmap(bufferBmpRect.Width, bufferBmpRect.Height);


                sx = new PixelFarm.Drawing.WinGdi.GdiPlusRenderSurface(0, 0, bufferBmpRect.Width, bufferBmpRect.Height);
                var gdiPlusCanvasPainter = new PixelFarm.Drawing.WinGdi.GdiPlusPainter(sx);

                gdiPlusCanvasPainter.SmoothingMode = _gdiAntiAlias ? PixelFarm.Drawing.SmoothingMode.AntiAlias : PixelFarm.Drawing.SmoothingMode.HighSpeed;
                painter             = gdiPlusCanvasPainter;
                painter.CurrentFont = new PixelFarm.Drawing.RequestFont("tahoma", 14);
            }
            else
            {
                AggRenderSurface aggsx      = CreateAggRenderSurface(myWidth, myHeight, 32);
                AggPainter       aggPainter = new AggPainter(aggsx);
                //set text printer for agg canvas painter
                aggPainter.CurrentFont = new PixelFarm.Drawing.RequestFont("tahoma", 14);

                //TODO: review text printer here again***
                VxsTextPrinter textPrinter = new VxsTextPrinter(aggPainter, YourImplementation.BootStrapWinGdi.GetFontLoader());
                aggPainter.TextPrinter = textPrinter;
                painter = aggPainter;
            }
            painter.Clear(PixelFarm.Drawing.Color.White);
        }