public static void Render <TVertexShaderIn, TPixelShaderIn>(
            TVertexShaderIn[] vertices,
            int[] indices,
            MemoryResources resources,
            InputAssembler inputAssembler,
            OutputMerger outputMerger,
            IVertexShader <TVertexShaderIn, TPixelShaderIn> vertexShader,
            IGeometryProcessor <TPixelShaderIn> geometryProcessor,
            IRasterizer <TPixelShaderIn> rasterizer,
            IPixelShader <TPixelShaderIn> pixelShader,
            Bitmap output)
            where TVertexShaderIn : struct, IVertexShaderInput
            where TPixelShaderIn : struct, IPixelShaderInput
        {
            if (vertices.Length == 0 || indices.Length == 0)
            {
                return;
            }

            (vertices, indices) = inputAssembler.Assemble(vertices, indices);

            var vertexShaderOutput = new TPixelShaderIn[vertices.Length];

            for (var i = 0; i < vertices.Length; ++i)
            {
                vertexShaderOutput[i] = vertexShader.Transform(resources, vertices[i]);
            }

            (vertexShaderOutput, indices) = geometryProcessor.Process(vertexShaderOutput, indices);

            var pixelShaderOutput = rasterizer.Rasterize(resources, vertexShaderOutput, indices, pixelShader, outputMerger, output.Width, output.Height, _outputBuffer, _wBuffer);

            Helper.SetPixels(pixelShaderOutput, output);
        }
Exemple #2
0
        //========================================================render_all_paths
        public static void RenderSolidAllPaths(IPixelFormat pixFormat, 
            IRasterizer ras, 
            IScanline sl,
            IVertexSource vs, 
            RGBA_Bytes[] color_storage,
            uint[] path_id,
            uint num_paths)
        {
            for(uint i = 0; i < num_paths; i++)
            {
                ras.Reset();
                
#if use_timers
                AddPathTimer.Start();
#endif
                ras.AddPath(vs, path_id[i]);
#if use_timers
                AddPathTimer.Stop();
#endif

                
#if use_timers
                RenderSLTimer.Start();
#endif
                RenderSolid(pixFormat, ras, sl, color_storage[i]);
#if use_timers
                RenderSLTimer.Stop();
#endif
            }
        }
Exemple #3
0
        public void Render(IRasterizer rasterizer, IScanline scanline, IPixelFormat rendererBase)
        {
            uint i;

            for (i = 0; i < num_paths(); i++)
            {
                rasterizer.reset();
                rasterizer.add_path(this, i);
                Renderer.RenderSolid(rendererBase, rasterizer, scanline, color(i).Get_rgba8());
            }
        }
		public void RenderSolid(IImageFloat destImage, IRasterizer rasterizer, IScanlineCache scanLine, RGBA_Floats color)
		{
			if (rasterizer.rewind_scanlines())
			{
				scanLine.reset(rasterizer.min_x(), rasterizer.max_x());
				while (rasterizer.sweep_scanline(scanLine))
				{
					RenderSolidSingleScanLine(destImage, scanLine, color);
				}
			}
		}
Exemple #5
0
 public void RenderSolid(IImageFloat destImage, IRasterizer rasterizer, IScanlineCache scanLine, RGBA_Floats color)
 {
     if (rasterizer.rewind_scanlines())
     {
         scanLine.reset(rasterizer.min_x(), rasterizer.max_x());
         while (rasterizer.sweep_scanline(scanLine))
         {
             RenderSolidSingleScanLine(destImage, scanLine, color);
         }
     }
 }
Exemple #6
0
 public void GenerateAndRender(IRasterizer rasterizer, IScanlineCache scanlineCache, IImageFloat destImage, span_allocator spanAllocator, ISpanGeneratorFloat spanGenerator)
 {
     if (rasterizer.rewind_scanlines())
     {
         scanlineCache.reset(rasterizer.min_x(), rasterizer.max_x());
         spanGenerator.prepare();
         while (rasterizer.sweep_scanline(scanlineCache))
         {
             GenerateAndRenderSingleScanline(scanlineCache, destImage, spanAllocator, spanGenerator);
         }
     }
 }
Exemple #7
0
        public PixMap(PixelFormat format, uint width, uint height)
            : this()
        {
            Guard.GreaterThan(width, 0u);
            Guard.GreaterThan(height, 0u);
            _pixelFormat = _injector.Resolve<IPixelFormatFactory>().CreatePixelFormat(format, width, height, out imageBytes);
            _buffer = _pixelFormat.GetRenderingBuffer();

            _renderer = this._injector.Resolve<RendererBase>();
            _scanlineCache = this._injector.Resolve<IScanlineCache>();
            _rasterizer = this._injector.Resolve<IRasterizer>();
        }
Exemple #8
0
        public PixMap(PixelFormat format, uint width, uint height)
            : this()
        {
            Guard.GreaterThan(width, 0u);
            Guard.GreaterThan(height, 0u);
            _pixelFormat = _injector.Resolve <IPixelFormatFactory>().CreatePixelFormat(format, width, height, out imageBytes);
            _buffer      = _pixelFormat.GetRenderingBuffer();

            _renderer      = this._injector.Resolve <RendererBase>();
            _scanlineCache = this._injector.Resolve <IScanlineCache>();
            _rasterizer    = this._injector.Resolve <IRasterizer>();
        }
        public MeshTestScene(int width, int height)
        {
            Width = width;
            Height = height;

            rasterizer = new Rasterizer(Width, Height);
            inputStateService = new InputStateService();
            transformation = new Transformation();

            currentWavefrontObjectFilePath = "Models\\woman1.obj";

            InitScene(currentWavefrontObjectFilePath);
        }
Exemple #10
0
 //=====================================================render_scanlines_aa
 public static void GenerateAndRender(IRasterizer ras, IScanline sl, IPixelFormat ren,
                          SpanAllocator alloc, ISpanGenerator span_gen)
 {
     if(ras.RewindScanlines())
     {
         sl.Reset(ras.MinX(), ras.MaxX());
         span_gen.Prepare();
         while(ras.SweepScanline(sl))
         {
             GenerateAndRenderSingleScanline(sl, ren, alloc, span_gen);
         }
     }
 }
Exemple #11
0
        public MeshTestScene(int width, int height)
        {
            Width  = width;
            Height = height;

            rasterizer        = new Rasterizer(Width, Height);
            inputStateService = new InputStateService();
            transformation    = new Transformation();

            currentWavefrontObjectFilePath = "Models\\woman1.obj";

            InitScene(currentWavefrontObjectFilePath);
        }
		public void RenderSolidAllPaths(IImageByte destImage,
			IRasterizer ras,
			IScanlineCache sl,
			IVertexSource vs,
			RGBA_Bytes[] color_storage,
			int[] path_id,
			int num_paths)
		{
			for (int i = 0; i < num_paths; i++)
			{
				ras.reset();

				ras.add_path(vs, path_id[i]);

				RenderSolid(destImage, ras, sl, color_storage[i]);
			}
		}
Exemple #13
0
        public void RenderSolidAllPaths(IImageByte destImage,
                                        IRasterizer ras,
                                        IScanlineCache sl,
                                        IVertexSource vs,
                                        RGBA_Bytes[] color_storage,
                                        int[] path_id,
                                        int num_paths)
        {
            for (int i = 0; i < num_paths; i++)
            {
                ras.reset();

                ras.add_path(vs, path_id[i]);

                RenderSolid(destImage, ras, sl, color_storage[i]);
            }
        }
Exemple #14
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);
        }
Exemple #15
0
        //========================================================render_scanlines
        public static void RenderSolid(IPixelFormat pixFormat, IRasterizer rasterizer, IScanline scanLine, RGBA_Bytes color)
        {
            if(rasterizer.RewindScanlines())
            {
                scanLine.Reset(rasterizer.MinX(), rasterizer.MaxX());
#if use_timers
                PrepareTimer.Start();
#endif
                //renderer.Prepare();
#if use_timers
                PrepareTimer.Stop();
#endif
                while(rasterizer.SweepScanline(scanLine))
                {
                    Renderer.RenderSolidSingleScanLine(pixFormat, scanLine, color);
                }
            }
        }
		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);
		}
 //========================================================render_scanlines
 public static void RenderSolid(IPixelFormat pixFormat, IRasterizer rasterizer, IScanline scanLine, RGBA_Bytes color)
 {
     if(rasterizer.RewindScanlines())
     {
         scanLine.Reset(rasterizer.MinX(), rasterizer.MaxX());
     #if use_timers
         PrepareTimer.Start();
     #endif
         //renderer.Prepare();
     #if use_timers
         PrepareTimer.Stop();
     #endif
         while(rasterizer.SweepScanline(scanLine))
         {
             Renderer.RenderSolidSingleScanLine(pixFormat, scanLine, color);
         }
     }
 }
Exemple #18
0
 /// Change the rasterizer where the primitives are sent.
 public void SetRasterizer(IRasterizer rasterizer)
 {
     m_rasterizer = rasterizer;
 }
Exemple #19
0
 /// Constructor.
 public VertexProcessor(IRasterizer rasterizer)
 {
     m_rasterizer = rasterizer;
     m_shader     = new NullVertexShader();
 }
Exemple #20
0
		//template<class Scanline, class Ras>
		public void render_gouraud(IImageByte backBuffer, IScanlineCache sl, IRasterizer ras)
		{
			double alpha = m_alpha.Value;
			double brc = 1;
#if SourceDepth24
            pixfmt_alpha_blend_rgb pf = new pixfmt_alpha_blend_rgb(backBuffer, new blender_bgr());
#else
			ImageBuffer image = new ImageBuffer();
			image.Attach(backBuffer, new BlenderBGRA());
#endif
			ImageClippingProxy ren_base = new ImageClippingProxy(image);

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

			ras.gamma(new gamma_linear(0.0, m_gamma.Value));

			double d = m_dilation.Value;

			// Six triangles
			double xc = (m_x[0] + m_x[1] + m_x[2]) / 3.0;
			double yc = (m_y[0] + m_y[1] + m_y[2]) / 3.0;

			double x1 = (m_x[1] + m_x[0]) / 2 - (xc - (m_x[1] + m_x[0]) / 2);
			double y1 = (m_y[1] + m_y[0]) / 2 - (yc - (m_y[1] + m_y[0]) / 2);

			double x2 = (m_x[2] + m_x[1]) / 2 - (xc - (m_x[2] + m_x[1]) / 2);
			double y2 = (m_y[2] + m_y[1]) / 2 - (yc - (m_y[2] + m_y[1]) / 2);

			double x3 = (m_x[0] + m_x[2]) / 2 - (xc - (m_x[0] + m_x[2]) / 2);
			double y3 = (m_y[0] + m_y[2]) / 2 - (yc - (m_y[0] + m_y[2]) / 2);

			span_gen.colors(new RGBA_Floats(1, 0, 0, alpha),
							new RGBA_Floats(0, 1, 0, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[0], m_y[0], m_x[1], m_y[1], xc, yc, d);
			ras.add_path(span_gen);
			ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

			span_gen.colors(new RGBA_Floats(0, 1, 0, alpha),
							new RGBA_Floats(0, 0, 1, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[1], m_y[1], m_x[2], m_y[2], xc, yc, d);
			ras.add_path(span_gen);
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

			span_gen.colors(new RGBA_Floats(0, 0, 1, alpha),
							new RGBA_Floats(1, 0, 0, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[2], m_y[2], m_x[0], m_y[0], xc, yc, d);
			ras.add_path(span_gen);
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

			brc = 1 - brc;
			span_gen.colors(new RGBA_Floats(1, 0, 0, alpha),
							new RGBA_Floats(0, 1, 0, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[0], m_y[0], m_x[1], m_y[1], x1, y1, d);
			ras.add_path(span_gen);
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

			span_gen.colors(new RGBA_Floats(0, 1, 0, alpha),
							new RGBA_Floats(0, 0, 1, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[1], m_y[1], m_x[2], m_y[2], x2, y2, d);
			ras.add_path(span_gen);
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

			span_gen.colors(new RGBA_Floats(0, 0, 1, alpha),
							new RGBA_Floats(1, 0, 0, alpha),
							new RGBA_Floats(brc, brc, brc, alpha));
			span_gen.triangle(m_x[2], m_y[2], m_x[0], m_y[0], x3, y3, d);
			ras.add_path(span_gen);
			scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);
		}
        //template<class Scanline, class Ras>
        public void render_gouraud(IImageByte backBuffer, IScanlineCache sl, IRasterizer ras)
        {
            double alpha = m_alpha.Value;
            double brc   = 1;

#if SourceDepth24
            pixfmt_alpha_blend_rgb pf = new pixfmt_alpha_blend_rgb(backBuffer, new blender_bgr());
#else
            ImageBuffer image = new ImageBuffer();
            image.Attach(backBuffer, new BlenderBGRA());
#endif
            ImageClippingProxy ren_base = new ImageClippingProxy(image);

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

            ras.gamma(new gamma_linear(0.0, m_gamma.Value));

            double d = m_dilation.Value;

            // Six triangles
            double xc = (m_x[0] + m_x[1] + m_x[2]) / 3.0;
            double yc = (m_y[0] + m_y[1] + m_y[2]) / 3.0;

            double x1 = (m_x[1] + m_x[0]) / 2 - (xc - (m_x[1] + m_x[0]) / 2);
            double y1 = (m_y[1] + m_y[0]) / 2 - (yc - (m_y[1] + m_y[0]) / 2);

            double x2 = (m_x[2] + m_x[1]) / 2 - (xc - (m_x[2] + m_x[1]) / 2);
            double y2 = (m_y[2] + m_y[1]) / 2 - (yc - (m_y[2] + m_y[1]) / 2);

            double x3 = (m_x[0] + m_x[2]) / 2 - (xc - (m_x[0] + m_x[2]) / 2);
            double y3 = (m_y[0] + m_y[2]) / 2 - (yc - (m_y[0] + m_y[2]) / 2);

            span_gen.colors(new RGBA_Floats(1, 0, 0, alpha),
                            new RGBA_Floats(0, 1, 0, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[0], m_y[0], m_x[1], m_y[1], xc, yc, d);
            ras.add_path(span_gen);
            ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

            span_gen.colors(new RGBA_Floats(0, 1, 0, alpha),
                            new RGBA_Floats(0, 0, 1, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[1], m_y[1], m_x[2], m_y[2], xc, yc, d);
            ras.add_path(span_gen);
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

            span_gen.colors(new RGBA_Floats(0, 0, 1, alpha),
                            new RGBA_Floats(1, 0, 0, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[2], m_y[2], m_x[0], m_y[0], xc, yc, d);
            ras.add_path(span_gen);
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

            brc = 1 - brc;
            span_gen.colors(new RGBA_Floats(1, 0, 0, alpha),
                            new RGBA_Floats(0, 1, 0, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[0], m_y[0], m_x[1], m_y[1], x1, y1, d);
            ras.add_path(span_gen);
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

            span_gen.colors(new RGBA_Floats(0, 1, 0, alpha),
                            new RGBA_Floats(0, 0, 1, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[1], m_y[1], m_x[2], m_y[2], x2, y2, d);
            ras.add_path(span_gen);
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);

            span_gen.colors(new RGBA_Floats(0, 0, 1, alpha),
                            new RGBA_Floats(1, 0, 0, alpha),
                            new RGBA_Floats(brc, brc, brc, alpha));
            span_gen.triangle(m_x[2], m_y[2], m_x[0], m_y[0], x3, y3, d);
            ras.add_path(span_gen);
            scanlineRenderer.GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);
        }
 //=====================================================render_scanlines_aa
 public static void GenerateAndRender(IRasterizer ras, IScanline sl, IPixelFormat ren,
                          SpanAllocator alloc, ISpanGenerator span_gen)
 {
     if(ras.RewindScanlines())
     {
         sl.Reset(ras.MinX(), ras.MaxX());
         span_gen.Prepare();
         while(ras.SweepScanline(sl))
         {
             GenerateAndRenderSingleScanline(sl, ren, alloc, span_gen);
         }
     }
 }
Exemple #23
0
        //template<class Scanline, class Ras>
        public void render_gouraud(IScanlineCache sl, IRasterizer <T> ras)
        {
            T alpha = m_alpha.value();
            T brc   = M.One <T>();

#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);

            AGG.SpanAllocator   span_alloc = new SpanAllocator();
            SpanGouraudRgba <T> span_gen   = new SpanGouraudRgba <T>();

            ras.Gamma(new GammaLinear(0.0, m_gamma.value().ToDouble()));

            T d = m_dilation.value();

            // Six triangles
            T xc = m_x[0].Add(m_x[1]).Add(m_x[2]).Divide(3.0);
            T yc = m_y[0].Add(m_y[1]).Add(m_y[2]).Divide(3.0);

            T x1 = m_x[1].Add(m_x[0]).Divide(2).Subtract(xc.Subtract(m_x[1].Add(m_x[0]).Divide(2)));
            T y1 = m_y[1].Add(m_y[0]).Divide(2).Subtract(yc.Subtract(m_y[1].Add(m_y[0]).Divide(2)));

            T x2 = m_x[2].Add(m_x[1]).Divide(2).Subtract(xc.Subtract(m_x[2].Add(m_x[1]).Divide(2)));
            T y2 = m_y[2].Add(m_y[1]).Divide(2).Subtract(yc.Subtract(m_y[2].Add(m_y[1]).Divide(2)));

            T x3 = m_x[0].Add(m_x[2]).Divide(2).Subtract(xc.Subtract(m_x[0].Add(m_x[2]).Divide(2)));
            T y3 = m_y[0].Add(m_y[2]).Divide(2).Subtract(yc.Subtract(m_y[0].Add(m_y[2]).Divide(2)));

            span_gen.Colors(new RGBA_Doubles(1, 0, 0, alpha.ToDouble()),
                            new RGBA_Doubles(0, 1, 0, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[0], m_y[0], m_x[1], m_y[1], xc, yc, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);


            span_gen.Colors(new RGBA_Doubles(0, 1, 0, alpha.ToDouble()),
                            new RGBA_Doubles(0, 0, 1, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[1], m_y[1], m_x[2], m_y[2], xc, yc, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);


            span_gen.Colors(new RGBA_Doubles(0, 0, 1, alpha.ToDouble()),
                            new RGBA_Doubles(1, 0, 0, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[2], m_y[2], m_x[0], m_y[0], xc, yc, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);


            brc = M.One <T>().Subtract(brc);
            span_gen.Colors(new RGBA_Doubles(1, 0, 0, alpha.ToDouble()),
                            new RGBA_Doubles(0, 1, 0, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[0], m_y[0], m_x[1], m_y[1], x1, y1, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);


            span_gen.Colors(new RGBA_Doubles(0, 1, 0, alpha.ToDouble()),
                            new RGBA_Doubles(0, 0, 1, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[1], m_y[1], m_x[2], m_y[2], x2, y2, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);


            span_gen.Colors(new RGBA_Doubles(0, 0, 1, alpha.ToDouble()),
                            new RGBA_Doubles(1, 0, 0, alpha.ToDouble()),
                            new RGBA_Doubles(brc.ToDouble(), brc.ToDouble(), brc.ToDouble(), alpha.ToDouble()));
            span_gen.Triangle(m_x[2], m_y[2], m_x[0], m_y[0], x3, y3, d);
            ras.AddPath(span_gen);
            Renderer <T> .GenerateAndRender(ras, sl, ren_base, span_alloc, span_gen);
        }
        //========================================================render_all_paths
        public static void RenderSolidAllPaths(IPixelFormat pixFormat, 
            IRasterizer ras, 
            IScanline sl,
            IVertexSource vs, 
            RGBA_Bytes[] color_storage,
            uint[] path_id,
            uint num_paths)
        {
            for(uint i = 0; i < num_paths; i++)
            {
                ras.Reset();

            #if use_timers
                AddPathTimer.Start();
            #endif
                ras.AddPath(vs, path_id[i]);
            #if use_timers
                AddPathTimer.Stop();
            #endif

            #if use_timers
                RenderSLTimer.Start();
            #endif
                RenderSolid(pixFormat, ras, sl, color_storage[i]);
            #if use_timers
                RenderSLTimer.Stop();
            #endif
            }
        }
		public void GenerateAndRender(IRasterizer rasterizer, IScanlineCache scanlineCache, IImageFloat destImage, span_allocator spanAllocator, ISpanGeneratorFloat spanGenerator)
		{
			if (rasterizer.rewind_scanlines())
			{
				scanlineCache.reset(rasterizer.min_x(), rasterizer.max_x());
				spanGenerator.prepare();
				while (rasterizer.sweep_scanline(scanlineCache))
				{
					GenerateAndRenderSingleScanline(scanlineCache, destImage, spanAllocator, spanGenerator);
				}
			}
		}