Beispiel #1
0
        public override void OnDraw()
        {
#if SourceDepth24
            pixfmt_alpha_blend_rgb pf = new pixfmt_alpha_blend_rgb(rbuf_window(), new blender_bgr());
#else
            FormatRGBA pf = new FormatRGBA(rbuf_window(), new BlenderBGRA());
#endif
            FormatClippingProxy ren_base = new FormatClippingProxy(pf);
            ren_base.Clear(new RGBA_Doubles(1.0, 1.0, 1.0));

            ScanlineUnpacked8        sl  = new ScanlineUnpacked8();
            RasterizerScanlineAA <T> ras = new RasterizerScanlineAA <T>();
#if true
            render_gouraud(sl, ras);
#else
            agg.span_allocator span_alloc = new span_allocator();
            span_gouraud_rgba  span_gen   = new span_gouraud_rgba(new rgba8(255, 0, 0, 255), new rgba8(0, 255, 0, 255), new rgba8(0, 0, 255, 255), 320, 220, 100, 100, 200, 100, 0);
            span_gouraud       test_sg    = new span_gouraud(new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), 320, 220, 100, 100, 200, 100, 0);
            ras.add_path(test_sg);
            renderer_scanlines.render_scanlines_aa(ras, sl, ren_base, span_alloc, span_gen);
            //renderer_scanlines.render_scanlines_aa_solid(ras, sl, ren_base, new rgba8(0, 0, 0, 255));
#endif


            ras.Gamma(new GammaNone());
            m_dilation.SetTransform(trans_affine_resizing());
            //m_dilation.Render(ras, sl, ren_base);
            m_gamma.SetTransform(trans_affine_resizing());
            //m_gamma.Render(ras, sl, ren_base);
            m_alpha.SetTransform(trans_affine_resizing());
            //m_alpha.Render(ras, sl, ren_base);
            base.OnDraw();
        }
Beispiel #2
0
        internal void render_gouraud(IImageByte backBuffer, IScanlineCache sl, IRasterizer ras, RenderPoint[] points)
        {
            ImageBuffer image = new ImageBuffer();

            image.Attach(backBuffer, new BlenderZBuffer());

            ImageClippingProxy ren_base = new ImageClippingProxy(image);

            MatterHackers.Agg.span_allocator span_alloc = new span_allocator();
            span_gouraud_rgba span_gen = new span_gouraud_rgba();

            span_gen.colors(points[0].color, points[1].color, points[2].color);
            span_gen.triangle(points[0].position.x, points[0].position.y, points[1].position.x, points[1].position.y, points[2].position.x, points[2].position.y);
            ras.add_path(span_gen);
            ScanlineRenderer scanlineRenderer = new ScanlineRenderer();

            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);
        }
        public override void Draw(CanvasPainter p)
        {
            p.Clear(Drawing.Color.White);
#if true
            RenderGourand(p);
#else
            agg.span_allocator span_alloc = new span_allocator();
            span_gouraud_rgba  span_gen   = new span_gouraud_rgba(new rgba8(255, 0, 0, 255), new rgba8(0, 255, 0, 255), new rgba8(0, 0, 255, 255), 320, 220, 100, 100, 200, 100, 0);
            span_gouraud       test_sg    = new span_gouraud(new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), 320, 220, 100, 100, 200, 100, 0);
            ras.add_path(test_sg);
            renderer_scanlines.render_scanlines_aa(ras, sl, ren_base, span_alloc, span_gen);
            //renderer_scanlines.render_scanlines_aa_solid(ras, sl, ren_base, new rgba8(0, 0, 0, 255));
#endif
            //graphics2D.ScanlineRasterizer.ResetGamma(new GammaNone());***
            //m_dilation.Render(ras, sl, ren_base);
            //m_gamma.Render(ras, sl, ren_base);
            //m_alpha.Render(ras, sl, ren_base);
        }
Beispiel #4
0
        public void OnDraw(Graphics2D graphics2D)
        {
            graphics2D.Clear(ColorRGBA.White);
#if true
            RenderGourand(graphics2D);
#else
            agg.span_allocator span_alloc = new span_allocator();
            span_gouraud_rgba  span_gen   = new span_gouraud_rgba(new rgba8(255, 0, 0, 255), new rgba8(0, 255, 0, 255), new rgba8(0, 0, 255, 255), 320, 220, 100, 100, 200, 100, 0);
            span_gouraud       test_sg    = new span_gouraud(new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), new rgba8(0, 0, 0, 255), 320, 220, 100, 100, 200, 100, 0);
            ras.add_path(test_sg);
            renderer_scanlines.render_scanlines_aa(ras, sl, ren_base, span_alloc, span_gen);
            //renderer_scanlines.render_scanlines_aa_solid(ras, sl, ren_base, new rgba8(0, 0, 0, 255));
#endif


            graphics2D.ScanlineRasterizer.ResetGamma(new GammaNone());
            //m_dilation.Render(ras, sl, ren_base);
            //m_gamma.Render(ras, sl, ren_base);
            //m_alpha.Render(ras, sl, ren_base);
        }