//---------------------------------------------------------------------
        //typedef renderer_outline_image<BaseRenderer, ImagePattern> self_type;

        //---------------------------------------------------------------------
        public renderer_outline_image(IPixelFormat ren, line_image_pattern patt)
        {
            m_ren      = ren;
            m_pattern  = patt;
            m_start    = (0);
            m_scale_x  = (1.0);
            m_clip_box = new rect_i(0, 0, 0, 0);
            m_clipping = (false);
        }
 //---------------------------------------------------------------------
 public void pattern(line_image_pattern p)
 {
     m_pattern = p;
 }
 //---------------------------------------------------------------------
 //typedef renderer_outline_image<BaseRenderer, ImagePattern> self_type;
 //---------------------------------------------------------------------
 public renderer_outline_image(IPixelFormat ren, line_image_pattern patt)
 {
     m_ren=ren;
     m_pattern=patt;
     m_start=(0);
     m_scale_x=(1.0);
     m_clip_box=new rect_i(0,0,0,0);
     m_clipping=(false);
 }
 //---------------------------------------------------------------------
 public void pattern(line_image_pattern p)
 {
     m_pattern = p;
 }
Example #5
0
        /*
         *  void draw_curve(Pattern patt, IRasterizer ras, Renderer ren, PatternSource src, IVertexSource vs)
         *  {
         *      patt.create(src);
         *      ren.scale_x(m_scale_x.value());
         *      ren.start_x(m_start_x.value());
         *      ras.add_path(vs);
         *  }
         */

        public override void  OnDraw()
        {
        #if SourceDepth24
            FormatRGB pf = new FormatRGB(rbuf_window(), new BlenderBGR());
        #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, .95));

            rasterizer_scanline_aa ras = new rasterizer_scanline_aa();
            scanline_packed_8      sl  = new scanline_packed_8();

            // 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_img(0));
            pattern_src_brightness_to_alpha_RGBA_Bytes p2 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(1));
            pattern_src_brightness_to_alpha_RGBA_Bytes p3 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(2));
            pattern_src_brightness_to_alpha_RGBA_Bytes p4 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(3));
            pattern_src_brightness_to_alpha_RGBA_Bytes p5 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(4));
            pattern_src_brightness_to_alpha_RGBA_Bytes p6 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(5));
            pattern_src_brightness_to_alpha_RGBA_Bytes p7 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(6));
            pattern_src_brightness_to_alpha_RGBA_Bytes p8 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(7));
            pattern_src_brightness_to_alpha_RGBA_Bytes p9 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(8));

            //pattern_filter_bilinear_rgba
            pattern_filter_bilinear_RGBA_Bytes fltr;           // 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).

            //typedef agg::line_image_pattern<agg::pattern_filter_bilinear_RGBA_Bytes> pattern_type;
            //typedef agg::renderer_base<pixfmt> base_ren_type;
            //typedef agg::renderer_outline_image<base_ren_type, pattern_type> renderer_type;
            //typedef agg::rasterizer_outline_aa<renderer_type>                rasterizer_type;

            //-- Create with specifying the source
            //pattern_type patt(fltr, src);

            //-- Create uninitialized and set the source
            line_image_pattern patt = new line_image_pattern(new pattern_filter_bilinear_RGBA_Bytes());
            //renderer_outline_image ren_img = new renderer_outline_image(, patt);

            /*
             * renderer_type ren_img(ren_base, patt);
             * rasterizer_type ras_img(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();
        }
        /*
            void draw_curve(Pattern patt, IRasterizer ras, Renderer ren, PatternSource src, IVertexSource vs)
            {
                patt.create(src);
                ren.scale_x(m_scale_x.value());
                ren.start_x(m_start_x.value());
                ras.add_path(vs);
            }
         */

        public override void  OnDraw()
        {
        #if SourceDepth24
                    FormatRGB pf = new FormatRGB(rbuf_window(), new BlenderBGR());
        #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, .95));

            rasterizer_scanline_aa ras = new rasterizer_scanline_aa();
            scanline_packed_8 sl = new scanline_packed_8();

            // 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_img(0));
            pattern_src_brightness_to_alpha_RGBA_Bytes p2 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(1));
            pattern_src_brightness_to_alpha_RGBA_Bytes p3 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(2));
            pattern_src_brightness_to_alpha_RGBA_Bytes p4 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(3));
            pattern_src_brightness_to_alpha_RGBA_Bytes p5 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(4));
            pattern_src_brightness_to_alpha_RGBA_Bytes p6 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(5));
            pattern_src_brightness_to_alpha_RGBA_Bytes p7 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(6));
            pattern_src_brightness_to_alpha_RGBA_Bytes p8 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(7));
            pattern_src_brightness_to_alpha_RGBA_Bytes p9 = new pattern_src_brightness_to_alpha_RGBA_Bytes(rbuf_img(8));

            //pattern_filter_bilinear_rgba 
            pattern_filter_bilinear_RGBA_Bytes fltr;           // 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). 
            
            //typedef agg::line_image_pattern<agg::pattern_filter_bilinear_RGBA_Bytes> pattern_type;
            //typedef agg::renderer_base<pixfmt> base_ren_type;
            //typedef agg::renderer_outline_image<base_ren_type, pattern_type> renderer_type;
            //typedef agg::rasterizer_outline_aa<renderer_type>                rasterizer_type;

            //-- Create with specifying the source
            //pattern_type patt(fltr, src);   

            //-- Create uninitialized and set the source
            line_image_pattern patt = new line_image_pattern(new pattern_filter_bilinear_RGBA_Bytes());
            //renderer_outline_image ren_img = new renderer_outline_image(, patt);
            /*
            renderer_type ren_img(ren_base, patt);
            rasterizer_type ras_img(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();
        }