コード例 #1
0
			public void init(span_gouraud.coord_type c1, span_gouraud.coord_type c2)
			{
				m_x1 = c1.x - 0.5;
				m_y1 = c1.y - 0.5;
				m_dx = c2.x - c1.x;
				double dy = c2.y - c1.y;
				m_1dy = (dy < 1e-5) ? 1e5 : 1.0 / dy;
				m_r1 = (int)c1.color.red;
				m_g1 = (int)c1.color.green;
				m_b1 = (int)c1.color.blue;
				m_a1 = (int)c1.color.alpha;
				m_dr = (int)c2.color.red - m_r1;
				m_dg = (int)c2.color.green - m_g1;
				m_db = (int)c2.color.blue - m_b1;
				m_da = (int)c2.color.alpha - m_a1;
			}
コード例 #2
0
ファイル: gouraud.cs プロジェクト: glocklueng/agg-sharp
		public override void OnDraw(Graphics2D graphics2D)
		{
			ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());

			IImageByte backBuffer = widgetsSubImage;
#if SourceDepth24
            pixfmt_alpha_blend_rgb pf = new pixfmt_alpha_blend_rgb(backBuffer, new blender_bgr());
#else
			ImageBuffer pf = new ImageBuffer();
			pf.Attach(backBuffer, new BlenderBGRA());
#endif
			ImageClippingProxy ren_base = new ImageClippingProxy(pf);
			ren_base.clear(new RGBA_Floats(1.0, 1.0, 1.0));

			scanline_unpacked_8 sl = new scanline_unpacked_8();
			ScanlineRasterizer ras = new ScanlineRasterizer();
#if true
			render_gouraud(backBuffer, 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 gamma_none());
			//m_dilation.Render(ras, sl, ren_base);
			//m_gamma.Render(ras, sl, ren_base);
			//m_alpha.Render(ras, sl, ren_base);
			base.OnDraw(graphics2D);
		}