public SkiaCanvasViewport(RootGraphic rootgfx, Size viewportSize) : base(rootgfx, viewportSize) { this.CalculateCanvasPages(); mySkCanvas = new PixelFarm.Drawing.Skia.MySkiaDrawBoard(0, 0, 0, 0, internalSizeW, internalSizwH); memdc = new Win32.NativeWin32MemoryDC(internalSizeW, internalSizwH); }
public void Dispose() { if (_nativeWin32DC != null) { _nativeWin32DC.Dispose(); _nativeWin32DC = null; } }
public WinGdiFontPrinter(GLPainterContext pcx, int w, int h) { _pcx = pcx; _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 CpuBlitAggCanvasRenderElement(RootGraphic rootgfx, int w, int h) : base(rootgfx, w, h) { //TODO: check if we can access raw rootGraphics buffer or not //1. gdi+ create backbuffer _nativeWin32DC = new Win32.NativeWin32MemoryDC(w, h); //2. create actual bitmap that share bitmap data from native _nativeWin32Dc _memBmp = new MemBitmap(w, h, _nativeWin32DC.PPVBits); //---------------------------------------------------------------- //3. create render surface from bitmap => provide basic bitmap fill operations AggRenderSurface aggsx = new AggRenderSurface(); aggsx.AttachDstBitmap(_memBmp); //4. painter wraps the render surface => provide advance operations AggPainter aggPainter = new AggPainter(aggsx); aggPainter.CurrentFont = new PixelFarm.Drawing.RequestFont("tahoma", 14); _painter = aggPainter; //---------------------------------------------------------------- }
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 _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(); } }