示例#1
0
        public void OnDraw(Graphics2D graphics2D)
        {
            var childImage = ImageHelper.CreateChildImage(graphics2D.DestImage, graphics2D.GetClippingRect());

            //IRecieveBlenderByte rasterBlender = new BlenderBGRA();
            var rasterGamma = new ChildImage(childImage, new PixelBlenderGammaBGRA(this.GammaValue));

            ClipProxyImage clippingProxyNormal = new ClipProxyImage(childImage);
            ClipProxyImage clippingProxyGamma  = new ClipProxyImage(rasterGamma);

            clippingProxyNormal.Clear(ColorRGBA.White);

            var rasterizer = graphics2D.ScanlineRasterizer;
            var sl         = new ScanlineUnpacked8();


            int size_mul = this.PixelSize;

            CustomScanlineRasToBmp_EnlargedV2 sclineToBmpEn2 = new CustomScanlineRasToBmp_EnlargedV2(size_mul, graphics2D.DestActualImage);

            rasterizer.Reset();
            rasterizer.MoveTo(m_x[0] / size_mul, m_y[0] / size_mul);
            rasterizer.LineTo(m_x[1] / size_mul, m_y[1] / size_mul);
            rasterizer.LineTo(m_x[2] / size_mul, m_y[2] / size_mul);

            sclineToBmpEn2.RenderWithColor(clippingProxyGamma, rasterizer, sl, ColorRGBA.Black);


            ScanlineRasToDestBitmapRenderer sclineRasToBmp = graphics2D.ScanlineRasToDestBitmap;

            sclineRasToBmp.RenderWithColor(clippingProxyGamma, rasterizer, sl, ColorRGBA.Black);

            //-----------------------------------------------------------------------------------------------------------
            rasterizer.ResetGamma(new GammaNone());

            PathWriter ps = new PathWriter();

            ps.Clear();
            ps.MoveTo(m_x[0], m_y[0]);
            ps.LineTo(m_x[1], m_y[1]);
            ps.LineTo(m_x[2], m_y[2]);
            ps.LineTo(m_x[0], m_y[0]);

            rasterizer.AddPath((new Stroke(2)).MakeVxs(ps.Vxs));
            sclineRasToBmp.RenderWithColor(clippingProxyNormal, rasterizer, sl, new ColorRGBA(0, 150, 160, 200));
        }
示例#2
0
        public override void Draw(Painter p)
        {
            //this specific for agg
            if (p is AggPainter)
            {
                AggPainter       p2     = (AggPainter)p;
                AggRenderSurface aggsx  = p2.RenderSurface;
                SubImageRW       subImg = ImageHelper.CreateSubImgRW(aggsx.DestImage, aggsx.GetClippingRect());

                //TODO: review here again
                PixelBlenderBGRA blenderWithGamma = new PixelBlenderBGRA();

                SubImageRW     rasterGamma         = new SubImageRW(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 CustomScanlineRasToBmp_EnlargedV2(size_mul, aggsx.DestActualImage);
                rasterizer.Reset();
                rasterizer.MoveTo(m_x[0] / size_mul, m_y[0] / size_mul);
                rasterizer.LineTo(m_x[1] / size_mul, m_y[1] / size_mul);
                rasterizer.LineTo(m_x[2] / size_mul, m_y[2] / size_mul);
                sclineToBmpEn2.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black);
                ScanlineRasToDestBitmapRenderer sclineRasToBmp = aggsx.ScanlineRasToDestBitmap;
                sclineRasToBmp.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black);
                //-----------------------------------------------------------------------------------------------------------
                rasterizer.ResetGamma(new GammaNone());
                PathWriter ps = new PathWriter();
                ps.Clear();
                ps.MoveTo(m_x[0], m_y[0]);
                ps.LineTo(m_x[1], m_y[1]);
                ps.LineTo(m_x[2], m_y[2]);
                ps.LineTo(m_x[0], m_y[0]);

                VectorToolBox.GetFreeVxs(out var v1);
                rasterizer.AddPath((new Stroke(2)).MakeVxs(ps.Vxs, v1));
                sclineRasToBmp.RenderWithColor(clippingProxyNormal, rasterizer, sl, new Color(200, 0, 150, 160));
                VectorToolBox.ReleaseVxs(ref v1);
            }
        }
示例#3
0
 public override void Draw(CanvasPainter p)
 {
     //this specific for agg
     if (p is PixelFarm.Agg.AggCanvasPainter)
     {
         PixelFarm.Agg.AggCanvasPainter p2 = (PixelFarm.Agg.AggCanvasPainter)p;
         Graphics2D gx         = p2.Graphics;
         var        childImage = ImageHelper.CreateChildImage(gx.DestImage, gx.GetClippingRect());
         //IRecieveBlenderByte rasterBlender = new BlenderBGRA();
         var            rasterGamma         = new ChildImage(childImage, new PixelBlenderGammaBGRA(this.GammaValue));
         ClipProxyImage clippingProxyNormal = new ClipProxyImage(childImage);
         ClipProxyImage clippingProxyGamma  = new ClipProxyImage(rasterGamma);
         clippingProxyNormal.Clear(Color.White);
         var rasterizer     = gx.ScanlineRasterizer;
         var sl             = new ScanlineUnpacked8();
         int size_mul       = this.PixelSize;
         var sclineToBmpEn2 = new CustomScanlineRasToBmp_EnlargedV2(size_mul, gx.DestActualImage);
         rasterizer.Reset();
         rasterizer.MoveTo(m_x[0] / size_mul, m_y[0] / size_mul);
         rasterizer.LineTo(m_x[1] / size_mul, m_y[1] / size_mul);
         rasterizer.LineTo(m_x[2] / size_mul, m_y[2] / size_mul);
         sclineToBmpEn2.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black);
         ScanlineRasToDestBitmapRenderer sclineRasToBmp = gx.ScanlineRasToDestBitmap;
         sclineRasToBmp.RenderWithColor(clippingProxyGamma, rasterizer, sl, Color.Black);
         //-----------------------------------------------------------------------------------------------------------
         rasterizer.ResetGamma(new GammaNone());
         PathWriter ps = new PathWriter();
         ps.Clear();
         ps.MoveTo(m_x[0], m_y[0]);
         ps.LineTo(m_x[1], m_y[1]);
         ps.LineTo(m_x[2], m_y[2]);
         ps.LineTo(m_x[0], m_y[0]);
         var v1 = GetFreeVxs();
         rasterizer.AddPath((new Stroke(2)).MakeVxs(ps.Vxs, v1));
         sclineRasToBmp.RenderWithColor(clippingProxyNormal, rasterizer, sl, new Color(200, 0, 150, 160));
         ReleaseVxs(ref v1);
     }
 }