public void Draw( DestBitmapRasterizer bmpRast, ScanlineRasterizer ras, Scanline sl, PixelProcessing.IBitmapBlender destImage, Color color, double x, double y) { #if DEBUG //low-level scanline rasterizer example ras.Reset(); ras.dbugDevMoveTo(x * _size, y * _size); ras.dbugDevLineTo(x * _size + _size, y * _size); ras.dbugDevLineTo(x * _size + _size, y * _size + _size); ras.dbugDevLineTo(x * _size, y * _size + _size); bmpRast.RenderWithColor(destImage, ras, sl, color); #endif }
public override void Draw(Painter p) { //this specific for agg #if DEBUG //low-level scanline rasterizer example if (p is AggPainter) { AggPainter p2 = (AggPainter)p; AggRenderSurface aggsx = p2.RenderSurface; PixelProcessing.SubBitmapBlender subImg = PixelProcessing.BitmapBlenderExtension.CreateSubBitmapBlender(aggsx.DestBitmapBlender, aggsx.GetClippingRect()); //TODO: review here again PixelBlenderBGRA blenderWithGamma = new PixelProcessing.PixelBlenderBGRA(); SubBitmapBlender rasterGamma = new SubBitmapBlender(subImg, blenderWithGamma); ClipProxyImage clippingProxyNormal = new ClipProxyImage(subImg); ClipProxyImage clippingProxyGamma = new ClipProxyImage(rasterGamma); clippingProxyNormal.Clear(Color.White); ScanlineRasterizer rasterizer = aggsx.ScanlineRasterizer; var sl = new ScanlineUnpacked8(); int size_mul = this.PixelSize; var sclineToBmpEn2 = new CustomRas_EnlargeV2(size_mul, aggsx.DestBitmap); rasterizer.Reset(); rasterizer.dbugDevMoveTo(_x[0] / size_mul, _y[0] / size_mul); rasterizer.dbugDevLineTo(_x[1] / size_mul, _y[1] / size_mul); rasterizer.dbugDevLineTo(_x[2] / size_mul, _y[2] / size_mul); sclineToBmpEn2.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black); DestBitmapRasterizer bmpRas = aggsx.BitmapRasterizer; bmpRas.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black); //----------------------------------------------------------------------------------------------------------- rasterizer.ResetGamma(new GammaNone()); using (Tools.BorrowVxs(out var v1, out var v2)) using (Tools.BorrowPathWriter(v1, out PathWriter ps)) { ps.Clear(); ps.MoveTo(_x[0], _y[0]); ps.LineTo(_x[1], _y[1]); ps.LineTo(_x[2], _y[2]); ps.LineTo(_x[0], _y[0]); rasterizer.AddPath((new Stroke(2)).MakeVxs(v1, v2)); bmpRas.RenderWithColor(clippingProxyNormal, rasterizer, sl, new Color(200, 0, 150, 160)); } } #endif }
public override void Draw(Painter p) { //specific for agg #if DEBUG //low-level scanline rasterizer example if (p is PixelFarm.CpuBlit.AggPainter p2) { AggRenderSurface aggsx = p2.RenderSurface; ScanlineRasterizer rasterizer = aggsx.ScanlineRasterizer; var widgetsSubImage = PixelProcessing.BitmapBlenderExtension.CreateSubBitmapBlender(aggsx.DestBitmapBlender, aggsx.GetClippingRect()); aggsx.UseSubPixelLcdEffect = false; PixelProcessing.PixelBlenderBGRA normalBlender = new PixelProcessing.PixelBlenderBGRA(); PixelProcessing.PixelBlenderBGRA gammaBlender = new PixelProcessing.PixelBlenderBGRA(); //TODO: revisit, and fix this again gammaBlender.GammaValue = this.GammaValue; gammaBlender.EnableGamma = true; var rasterGamma = new PixelProcessing.SubBitmapBlender(widgetsSubImage, gammaBlender); ClipProxyImage clippingProxyNormal = new ClipProxyImage(widgetsSubImage); ClipProxyImage clippingProxyGamma = new ClipProxyImage(rasterGamma); clippingProxyNormal.Clear(Color.White); ScanlineUnpacked8 sl = new ScanlineUnpacked8(); int size_mul = (int)this.PixelSize; CustomScanlineRasToBmp_EnlargedSubPixelRendering ren_en = new CustomScanlineRasToBmp_EnlargedSubPixelRendering(size_mul, aggsx.DestBitmap); rasterizer.Reset(); rasterizer.dbugDevMoveTo(_x[0] / size_mul, _y[0] / size_mul); rasterizer.dbugDevLineTo(_x[1] / size_mul, _y[1] / size_mul); rasterizer.dbugDevLineTo(_x[2] / size_mul, _y[2] / size_mul); ren_en.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black); //---------------------------------------- DestBitmapRasterizer sclineRasToBmp = aggsx.BitmapRasterizer; aggsx.UseSubPixelLcdEffect = false; sclineRasToBmp.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black); rasterizer.ResetGamma(new GammaNone()); aggsx.UseSubPixelLcdEffect = false; //---------------------------------------- using (Tools.BorrowVxs(out var v1, out var v2)) using (Tools.BorrowPathWriter(v1, out PathWriter ps)) { ps.Clear(); ps.MoveTo(_x[0], _y[0]); ps.LineTo(_x[1], _y[1]); ps.LineTo(_x[2], _y[2]); ps.LineTo(_x[0], _y[0]); rasterizer.AddPath(_stroke.MakeVxs(v1, v2)); } //---------------------------------------- //Stroke stroke = new Stroke(ps); //stroke.Width = 2; //rasterizer.AddPath(stroke.MakeVxs(ps.MakeVxs())); //---------------------------------------- sclineRasToBmp.RenderWithColor(clippingProxyNormal, rasterizer, sl, new Color(200, 0, 150, 160)); } #endif }