Esempio n. 1
0
        public override void OnDraw(Graphics2D graphics2D)
        {
            ImageClippingProxy ren_base = new ImageClippingProxy(graphics2D.DestImage);

            ren_base.clear(new RGBA_Floats(1.0, 1.0, .95));

            ScanlineRasterizer   ras = new ScanlineRasterizer();
            ScanlineCachePacked8 sl  = new ScanlineCachePacked8();

            // Pattern source. Must have an interface:
            // width() const
            // height() const
            // pixel(int x, int y) const
            // Any agg::renderer_base<> or derived
            // is good for the use as a source.
            //-----------------------------------
            pattern_src_brightness_to_alpha_RGBA_Bytes p1 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img0);
            pattern_src_brightness_to_alpha_RGBA_Bytes p2 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img1);
            pattern_src_brightness_to_alpha_RGBA_Bytes p3 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img2);
            pattern_src_brightness_to_alpha_RGBA_Bytes p4 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img3);
            pattern_src_brightness_to_alpha_RGBA_Bytes p5 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img4);
            pattern_src_brightness_to_alpha_RGBA_Bytes p6 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img5);
            pattern_src_brightness_to_alpha_RGBA_Bytes p7 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img6);
            pattern_src_brightness_to_alpha_RGBA_Bytes p8 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img7);
            pattern_src_brightness_to_alpha_RGBA_Bytes p9 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img8);

            //pattern_filter_bilinear_RGBA_Bytes fltr = new pattern_filter_bilinear_RGBA_Bytes();           // Filtering functor

            // agg::line_image_pattern is the main container for the patterns. It creates
            // a copy of the patterns extended according to the needs of the filter.
            // agg::line_image_pattern can operate with arbitrary image width, but if the
            // width of the pattern is power of 2, it's better to use the modified
            // version agg::line_image_pattern_pow2 because it works about 15-25 percent
            // faster than agg::line_image_pattern (because of using simple masking instead
            // of expensive '%' operation).

            //-- Create with specifying the source

            //-- Create uninitialized and set the source

            line_image_pattern patt    = new line_image_pattern(new pattern_filter_bilinear_RGBA_Bytes());
            ImageLineRenderer  ren_img = new ImageLineRenderer(ren_base, patt);

            rasterizer_outline_aa ras_img = new rasterizer_outline_aa(ren_img);

            draw_curve(patt, ras_img, ren_img, p1, m_curve1.curve());

            /*
             * draw_curve(patt, ras_img, ren_img, p2, m_curve2.curve());
             * draw_curve(patt, ras_img, ren_img, p3, m_curve3.curve());
             * draw_curve(patt, ras_img, ren_img, p4, m_curve4.curve());
             * draw_curve(patt, ras_img, ren_img, p5, m_curve5.curve());
             * draw_curve(patt, ras_img, ren_img, p6, m_curve6.curve());
             * draw_curve(patt, ras_img, ren_img, p7, m_curve7.curve());
             * draw_curve(patt, ras_img, ren_img, p8, m_curve8.curve());
             * draw_curve(patt, ras_img, ren_img, p9, m_curve9.curve());
             */

            base.OnDraw(graphics2D);
        }
Esempio n. 2
0
 private void draw_curve(line_image_pattern patt, rasterizer_outline_aa ras, ImageLineRenderer ren,
                         pattern_src_brightness_to_alpha_RGBA_Bytes src, IVertexSource vs)
 {
     patt.create(src);
     ren.scale_x(m_scale_x.Value);
     ren.start_x(m_start_x.Value);
     ras.add_path(vs);
 }
Esempio n. 3
0
#pragma warning restore
        //---------------------------------------------------------------------
        //typedef renderer_outline_image<BaseRenderer, ImagePattern> self_type;

        //---------------------------------------------------------------------
        public ImageLineRenderer(IImageByte ren, line_image_pattern patt)
        {
            m_ren      = ren;
            m_pattern  = patt;
            m_start    = (0);
            m_scale_x  = (1.0);
            m_clip_box = new RectangleInt(0, 0, 0, 0);
            m_clipping = (false);
        }
Esempio n. 4
0
        // Create
        //--------------------------------------------------------------------
        public line_image_pattern(IPatternFilter filter, line_image_pattern src)
        {
            m_filter         = (filter);
            m_dilation       = (filter.dilation() + 1);
            m_dilation_hr    = (m_dilation << LineAABasics.line_subpixel_shift);
            m_width          = 0;
            m_height         = 0;
            m_width_hr       = 0;
            m_half_height_hr = 0;
            m_offset_y_hr    = (0);

            create(src);
        }
Esempio n. 5
0
 //---------------------------------------------------------------------
 public void pattern(line_image_pattern p)
 {
     m_pattern = p;
 }
Esempio n. 6
0
		// Create
		//--------------------------------------------------------------------
		public line_image_pattern(IPatternFilter filter, line_image_pattern src)
		{
			m_filter = (filter);
			m_dilation = (filter.dilation() + 1);
			m_dilation_hr = (m_dilation << LineAABasics.line_subpixel_shift);
			m_width = 0;
			m_height = 0;
			m_width_hr = 0;
			m_half_height_hr = 0;
			m_offset_y_hr = (0);

			create(src);
		}
Esempio n. 7
0
		//---------------------------------------------------------------------
		public void pattern(line_image_pattern p)
		{
			m_pattern = p;
		}
Esempio n. 8
0
		//---------------------------------------------------------------------
		//typedef renderer_outline_image<BaseRenderer, ImagePattern> self_type;

		//---------------------------------------------------------------------
		public ImageLineRenderer(IImageByte ren, line_image_pattern patt)
		{
			m_ren = ren;
			m_pattern = patt;
			m_start = (0);
			m_scale_x = (1.0);
			m_clip_box = new RectangleInt(0, 0, 0, 0);
			m_clipping = (false);
		}
Esempio n. 9
0
		public override void OnDraw(Graphics2D graphics2D)
		{
			ImageClippingProxy ren_base = new ImageClippingProxy(graphics2D.DestImage);

			ren_base.clear(new RGBA_Floats(1.0, 1.0, .95));

			ScanlineRasterizer ras = new ScanlineRasterizer();
			ScanlineCachePacked8 sl = new ScanlineCachePacked8();

			// Pattern source. Must have an interface:
			// width() const
			// height() const
			// pixel(int x, int y) const
			// Any agg::renderer_base<> or derived
			// is good for the use as a source.
			//-----------------------------------
			pattern_src_brightness_to_alpha_RGBA_Bytes p1 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img0);
			pattern_src_brightness_to_alpha_RGBA_Bytes p2 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img1);
			pattern_src_brightness_to_alpha_RGBA_Bytes p3 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img2);
			pattern_src_brightness_to_alpha_RGBA_Bytes p4 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img3);
			pattern_src_brightness_to_alpha_RGBA_Bytes p5 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img4);
			pattern_src_brightness_to_alpha_RGBA_Bytes p6 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img5);
			pattern_src_brightness_to_alpha_RGBA_Bytes p7 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img6);
			pattern_src_brightness_to_alpha_RGBA_Bytes p8 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img7);
			pattern_src_brightness_to_alpha_RGBA_Bytes p9 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img8);

			pattern_filter_bilinear_RGBA_Bytes fltr = new pattern_filter_bilinear_RGBA_Bytes();           // Filtering functor

			// agg::line_image_pattern is the main container for the patterns. It creates
			// a copy of the patterns extended according to the needs of the filter.
			// agg::line_image_pattern can operate with arbitrary image width, but if the
			// width of the pattern is power of 2, it's better to use the modified
			// version agg::line_image_pattern_pow2 because it works about 15-25 percent
			// faster than agg::line_image_pattern (because of using simple masking instead
			// of expensive '%' operation).

			//-- Create with specifying the source

			//-- Create uninitialized and set the source

			line_image_pattern patt = new line_image_pattern(new pattern_filter_bilinear_RGBA_Bytes());
			ImageLineRenderer ren_img = new ImageLineRenderer(ren_base, patt);

			rasterizer_outline_aa ras_img = new rasterizer_outline_aa(ren_img);

			draw_curve(patt, ras_img, ren_img, p1, m_curve1.curve());
			/*
			draw_curve(patt, ras_img, ren_img, p2, m_curve2.curve());
			draw_curve(patt, ras_img, ren_img, p3, m_curve3.curve());
			draw_curve(patt, ras_img, ren_img, p4, m_curve4.curve());
			draw_curve(patt, ras_img, ren_img, p5, m_curve5.curve());
			draw_curve(patt, ras_img, ren_img, p6, m_curve6.curve());
			draw_curve(patt, ras_img, ren_img, p7, m_curve7.curve());
			draw_curve(patt, ras_img, ren_img, p8, m_curve8.curve());
			draw_curve(patt, ras_img, ren_img, p9, m_curve9.curve());
			 */

			base.OnDraw(graphics2D);
		}
Esempio n. 10
0
		private void draw_curve(line_image_pattern patt, rasterizer_outline_aa ras, ImageLineRenderer ren,
			pattern_src_brightness_to_alpha_RGBA_Bytes src, IVertexSource vs)
		{
			patt.create(src);
			ren.scale_x(m_scale_x.Value);
			ren.start_x(m_start_x.Value);
			ras.add_path(vs);
		}