• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ agg::interactive_polygon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中agg::interactive_polygon的典型用法代码示例。如果您正苦于以下问题:C++ interactive_polygon类的具体用法?C++ interactive_polygon怎么用?C++ interactive_polygon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了interactive_polygon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_feng(),
        m_fman(m_feng),
        m_poly1(6, 5.0),
        m_poly2(6, 5.0),
        m_num_points      (5.0, 5.0, 340.0, 12.0, !flip_y),
        m_fixed_len       (350, 5.0,  "Fixed Length", !flip_y),
        m_preserve_x_scale(465, 5.0,  "Preserve X scale", !flip_y),
        m_animate         (350, 25.0, "Animate", !flip_y),
        m_prev_animate(false)
    {
        add_ctrl(m_fixed_len);
        add_ctrl(m_preserve_x_scale);
        add_ctrl(m_animate);
        m_fixed_len.status(true);
        m_preserve_x_scale.status(true);
        m_num_points.range(10.0, 400.0);
        m_num_points.value(200.0);
        m_num_points.label("Number of intermediate Points = %.3f");
        add_ctrl(m_num_points);

        m_poly1.close(false);
        m_poly2.close(false);
    }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:25,代码来源:trans_curve2_ft.cpp


示例2: on_mouse_button_up

 virtual void on_mouse_button_up(int x, int y, unsigned flags)
 {
     if(m_quad1.on_mouse_button_up(x, y) ||
        m_quad2.on_mouse_button_up(x, y) )
     {
         force_redraw();
     }
 }
开发者ID:zshipko,项目名称:libtwombly,代码行数:8,代码来源:scanline_boolean.cpp


示例3: on_idle

 virtual void on_idle()
 {
     int i;
     for(i = 0; i < 6; i++)
     {
         move_point(m_poly.xn(i), m_poly.yn(i), m_dx[i], m_dy[i]);
     }
     force_redraw();
 }
开发者ID:zshipko,项目名称:libtwombly,代码行数:9,代码来源:trans_curve1.cpp


示例4: on_idle

 virtual void on_idle()
 {
     int i;
     for(i = 0; i < 6; i++)
     {
         move_point(m_poly1.xn(i), m_poly1.yn(i), m_dx1[i], m_dy1[i]);
         move_point(m_poly2.xn(i), m_poly2.yn(i), m_dx2[i], m_dy2[i]);
         normalize_point(i);
     }
     force_redraw();
 }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:11,代码来源:trans_curve2_ft.cpp


示例5: on_mouse_button_down

 virtual void on_mouse_button_down(int x, int y, unsigned flags)
 {
     if(flags & agg::mouse_left)
     {
         if(m_quad1.on_mouse_button_down(x, y) ||
            m_quad2.on_mouse_button_down(x, y) )
         {
             force_redraw();
         }
     }
 }
开发者ID:zshipko,项目名称:libtwombly,代码行数:11,代码来源:scanline_boolean.cpp


示例6: on_mouse_button_up

 virtual void on_mouse_button_up(int x, int y, unsigned flags)
 {
     if(m_poly1.on_mouse_button_up(x, y))
     {
         force_redraw();
     }
     if(m_poly2.on_mouse_button_up(x, y))
     {
         force_redraw();
     }
 }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:11,代码来源:trans_curve2_ft.cpp


示例7: on_init

    virtual void on_init()
    {
        g_x1 = 0.0;
        g_y1 = 0.0;
        g_x2 = rbuf_img(0).width();
        g_y2 = rbuf_img(0).height();

        double x1 = g_x1;// * 100.0;
        double y1 = g_y1;// * 100.0;
        double x2 = g_x2;// * 100.0;
        double y2 = g_y2;// * 100.0;

        double dx = width()  / 2.0 - (x2 - x1) / 2.0;
        double dy = height() / 2.0 - (y2 - y1) / 2.0;
        m_quad.xn(0) = floor(x1 + dx);
        m_quad.yn(0) = floor(y1 + dy);// - 150;
        m_quad.xn(1) = floor(x2 + dx);
        m_quad.yn(1) = floor(y1 + dy);// - 110;
        m_quad.xn(2) = floor(x2 + dx);
        m_quad.yn(2) = floor(y2 + dy);// - 300;
        m_quad.xn(3) = floor(x1 + dx);
        m_quad.yn(3) = floor(y2 + dy);// - 200;

        pixfmt pixf(rbuf_img(0));
        pixf.apply_gamma_dir(m_gamma_lut);
    }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:26,代码来源:image_resample.cpp


示例8: on_mouse_move

 virtual void on_mouse_move(int x, int y, unsigned flags)
 {
     if(flags & agg::mouse_left)
     {
         if(m_quad1.on_mouse_move(x, y) ||
            m_quad2.on_mouse_move(x, y) )
         {
             force_redraw();
         }
     }
     if((flags & agg::mouse_left) == 0)
     {
         on_mouse_button_up(x, y, flags);
     }
 }
开发者ID:zshipko,项目名称:libtwombly,代码行数:15,代码来源:scanline_boolean.cpp


示例9: on_mouse_button_down

    virtual void on_mouse_button_down(int x, int y, unsigned flags)
    {
        if(flags & agg::mouse_left)
        {
            if(m_quad.on_mouse_button_down(x, y))
            {
                force_redraw();
            }
            else
            {
                start_timer();
                m_test_flag = true;
                on_draw();
                on_draw();
                on_draw();
                on_draw();
                char buf[100];
                sprintf(buf, "time=%.3f", elapsed_time());
                m_test_flag = false;
                force_redraw();
                message(buf);
            }

        }
    }
开发者ID:bodomartin,项目名称:cheml-agg2,代码行数:25,代码来源:pattern_perspective.cpp


示例10:

    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_quad(4, 5.0),
        m_trans_type(420, 5.0, 420+130.0, 55.0, !flip_y)
    {
        parse_lion();
        m_quad.xn(0) = g_x1;
        m_quad.yn(0) = g_y1;
        m_quad.xn(1) = g_x2;
        m_quad.yn(1) = g_y1;
        m_quad.xn(2) = g_x2;
        m_quad.yn(2) = g_y2;
        m_quad.xn(3) = g_x1;
        m_quad.yn(3) = g_y2;

        m_trans_type.add_item("Bilinear");
        m_trans_type.add_item("Perspective");
        m_trans_type.cur_item(0);
        add_ctrl(m_trans_type);
    }
开发者ID:Bashakov,项目名称:agg,代码行数:20,代码来源:perspective.cpp


示例11: on_init

    virtual void on_init()
    {
        g_x1 = -150;
        g_y1 = -150;
        g_x2 =  150;
        g_y2 =  150;

        double trans_x1 = -200;
        double trans_y1 = -200;
        double trans_x2 =  200;
        double trans_y2 =  200;

        double dx = width()  / 2.0 - (trans_x2 + trans_x1) / 2.0;
        double dy = height() / 2.0 - (trans_y2 + trans_y1) / 2.0;
        m_quad.xn(0) = floor(trans_x1 + dx);
        m_quad.yn(0) = floor(trans_y1 + dy);
        m_quad.xn(1) = floor(trans_x2 + dx);
        m_quad.yn(1) = floor(trans_y1 + dy);
        m_quad.xn(2) = floor(trans_x2 + dx);
        m_quad.yn(2) = floor(trans_y2 + dy);
        m_quad.xn(3) = floor(trans_x1 + dx);
        m_quad.yn(3) = floor(trans_y2 + dy);
    }
开发者ID:bodomartin,项目名称:cheml-agg2,代码行数:23,代码来源:pattern_perspective.cpp


示例12: on_draw

    virtual void on_draw()
    {
        pixfmt pixf(rbuf_window());
        renderer_base rb(pixf);
        renderer_solid r(rb);
        rb.clear(agg::rgba(1, 1, 1));

        scanline_type sl;
        agg::rasterizer_scanline_aa<> ras;

        m_poly.close(m_close.status());
        agg::simple_polygon_vertex_source path(m_poly.polygon(), 
                                               m_poly.num_points(), 
                                               false, 
                                               m_close.status());

        typedef agg::conv_bspline<agg::simple_polygon_vertex_source> conv_bspline_type;
        conv_bspline_type bspline(path);
        bspline.interpolation_step(1.0 / m_num_points.value());

        agg::trans_single_path tcurve;
        tcurve.add_path(bspline);
        tcurve.preserve_x_scale(m_preserve_x_scale.status());
        if(m_fixed_len.status()) tcurve.base_length(1120);

        typedef agg::conv_curve<font_manager_type::path_adaptor_type>             conv_font_curve_type;
        typedef agg::conv_segmentator<conv_font_curve_type>                      conv_font_segm_type;
        typedef agg::conv_transform<conv_font_segm_type, agg::trans_single_path> conv_font_trans_type;
        conv_font_curve_type fcurves(m_fman.path_adaptor());

        conv_font_segm_type  fsegm(fcurves);
        conv_font_trans_type ftrans(fsegm, tcurve);
        fsegm.approximation_scale(3.0);
        fcurves.approximation_scale(2.0);

        m_feng.height(40.0);
        //m_feng.italic(true);

        if(m_feng.create_font("Times New Roman", agg::glyph_ren_outline))
        {
            double x = 0.0;
            double y = 3.0;
            const char* p = text;

            while(*p)
            {
                const agg::glyph_cache* glyph = m_fman.glyph(*p);
                if(glyph)
                {
                    if(x > tcurve.total_length()) break;

                    m_fman.add_kerning(&x, &y);
                    m_fman.init_embedded_adaptors(glyph, x, y);

                    if(glyph->data_type == agg::glyph_data_outline)
                    {
                        ras.reset();
                        ras.add_path(ftrans);
                        r.color(agg::rgba8(0, 0, 0));
                        agg::render_scanlines(ras, sl, r);
                    }

                    // increment pen position
                    x += glyph->advance_x;
                    y += glyph->advance_y;
                }
                ++p;
            }

        }



        typedef agg::conv_stroke<conv_bspline_type> conv_stroke_type;
        conv_stroke_type stroke(bspline);

        stroke.width(2.0);

        r.color(agg::rgba8(170, 50, 20, 100));
        ras.add_path(stroke);
        agg::render_scanlines(ras, sl, r);

        //--------------------------
        // Render the "poly" tool and controls
        r.color(agg::rgba(0, 0.3, 0.5, 0.3));
        ras.add_path(m_poly);
        agg::render_scanlines(ras, sl, r);

        agg::render_ctrl(ras, sl, rb, m_close);
        agg::render_ctrl(ras, sl, rb, m_preserve_x_scale);
        agg::render_ctrl(ras, sl, rb, m_fixed_len);
        agg::render_ctrl(ras, sl, rb, m_animate);
        agg::render_ctrl(ras, sl, rb, m_num_points);
        //--------------------------

    }
开发者ID:zshipko,项目名称:libtwombly,代码行数:96,代码来源:trans_curve1.cpp


示例13: on_init

    virtual void on_init()
    {
        m_quad1.xn(0) = 50;
        m_quad1.yn(0) = 200 - 20;
        m_quad1.xn(1) = width() / 2 - 25;
        m_quad1.yn(1) = 200;
        m_quad1.xn(2) = width() / 2 - 25;
        m_quad1.yn(2) = height() - 50 - 20;
        m_quad1.xn(3) = 50;
        m_quad1.yn(3) = height() - 50;

        m_quad2.xn(0) = width() / 2 + 25;
        m_quad2.yn(0) = 200 - 20;
        m_quad2.xn(1) = width() - 50;
        m_quad2.yn(1) = 200;
        m_quad2.xn(2) = width() - 50;
        m_quad2.yn(2) = height() - 50 - 20;
        m_quad2.xn(3) = width() / 2 + 25;
        m_quad2.yn(3) = height() - 50;
    }
开发者ID:zshipko,项目名称:libtwombly,代码行数:20,代码来源:scanline_boolean.cpp


示例14: normalize_point

 void normalize_point(unsigned i)
 {
     double d = agg::calc_distance(m_poly1.xn(i), m_poly1.yn(i), 
                                   m_poly2.xn(i), m_poly2.yn(i));
     // 28.8 is 20 * sqrt(2)
     if(d > 28.28)
     {
         m_poly2.xn(i) = m_poly1.xn(i) + (m_poly2.xn(i) - m_poly1.xn(i)) * 28.28 / d;
         m_poly2.yn(i) = m_poly1.yn(i) + (m_poly2.yn(i) - m_poly1.yn(i)) * 28.28 / d;
     }
 }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:11,代码来源:trans_curve2_ft.cpp


示例15: on_draw

    virtual void on_draw()
    {
        pixfmt pixf(rbuf_window());
        renderer_base rb(pixf);
        renderer_solid r(rb);
        rb.clear(agg::rgba(1, 1, 1));

        scanline_type sl;
        agg::rasterizer_scanline_aa<> ras;
        agg::rasterizer_scanline_aa<> ras1;
        agg::rasterizer_scanline_aa<> ras2;

        agg::sbool_op_e op = (agg::sbool_op_e)m_trans_type.cur_item();

        ras1.gamma(agg::gamma_multiply(m_mul1.value()));
        ras2.gamma(agg::gamma_multiply(m_mul2.value()));

        ras.clip_box(0, 0, width(), height());
        
        agg::path_storage ps1;
        generate_circles(ps1, m_quad1.polygon(), 5, 20);

        agg::path_storage ps2;
        generate_circles(ps2, m_quad2.polygon(), 5, 20);

        ras1.filling_rule(agg::fill_even_odd);


        r.color(agg::rgba8(240, 255, 200, 100));
        ras1.add_path(ps1);
        agg::render_scanlines(ras1, sl, r);

        r.color(agg::rgba8(255, 240, 240, 100));
        ras2.add_path(ps2);
        agg::render_scanlines(ras2, sl, r);


        
        typedef agg::scanline_p8                               sbool_scanline_type;
        typedef agg::renderer_scanline_aa_solid<renderer_base> sbool_renderer_type;

        sbool_scanline_type sl_result;
        sbool_scanline_type sl1;
        sbool_scanline_type sl2;
        sbool_renderer_type sren(rb);

        sren.color(agg::rgba8(0, 0, 0));

        agg::sbool_combine_shapes_aa(op, ras1, ras2, sl1, sl2, sl_result, sren);

        //--------------------------
        // Render the "quad" tools and controls
        r.color(agg::rgba(0, 0.3, 0.5, 0.6));
        ras.add_path(m_quad1);
        agg::render_scanlines(ras, sl, r);
        ras.add_path(m_quad2);
        agg::render_scanlines(ras, sl, r);
        agg::render_ctrl(ras, sl, rb, m_trans_type);
        agg::render_ctrl(ras, sl, rb, m_reset);
        agg::render_ctrl(ras, sl, rb, m_mul1);
        agg::render_ctrl(ras, sl, rb, m_mul2);
        //--------------------------

    }
开发者ID:zshipko,项目名称:libtwombly,代码行数:64,代码来源:scanline_boolean.cpp


示例16: on_draw

    virtual void on_draw()
    {
        pixfmt pixf(rbuf_window());
        renderer_base rb(pixf);
        renderer_solid r(rb);
        rb.clear(agg::rgba(1, 1, 1));

        scanline_type sl;
        agg::rasterizer_scanline_aa<> ras;

        agg::simple_polygon_vertex_source path1(m_poly1.polygon(), 
                                                m_poly1.num_points(), 
                                                false, 
                                                false);

        agg::simple_polygon_vertex_source path2(m_poly2.polygon(), 
                                                m_poly2.num_points(), 
                                                false, 
                                                false);


        typedef agg::conv_bspline<agg::simple_polygon_vertex_source> conv_bspline_type;
        conv_bspline_type bspline1(path1);
        conv_bspline_type bspline2(path2);
        bspline1.interpolation_step(1.0 / m_num_points.value());
        bspline2.interpolation_step(1.0 / m_num_points.value());


        typedef agg::conv_curve<font_manager_type::path_adaptor_type>            conv_font_curve_type;
        typedef agg::conv_segmentator<conv_font_curve_type>                      conv_font_segm_type;
        typedef agg::conv_transform<conv_font_segm_type, agg::trans_double_path> conv_font_trans_type;

        agg::trans_double_path tcurve;
        conv_font_curve_type fcurves(m_fman.path_adaptor());
        conv_font_segm_type  fsegm(fcurves);
        conv_font_trans_type ftrans(fsegm, tcurve);

        tcurve.preserve_x_scale(m_preserve_x_scale.status());
        if(m_fixed_len.status()) tcurve.base_length(1140.0);
        tcurve.base_height(30.0);

        tcurve.add_paths(bspline1, bspline2);
        fsegm.approximation_scale(3.0);
        fcurves.approximation_scale(5.0);

        if(m_feng.load_font(full_file_name("timesi.ttf"), 0, agg::glyph_ren_outline))
        {
            double x = 0.0;
            double y = 3.0;
            const char* p = text;

            m_feng.hinting(false);
            m_feng.height(40);

            while(*p)
            {
                const agg::glyph_cache* glyph = m_fman.glyph(*p);
                if(glyph)
                {
                    if(x > tcurve.total_length1()) break;

                    m_fman.add_kerning(&x, &y);
                    m_fman.init_embedded_adaptors(glyph, x, y);

                    if(glyph->data_type == agg::glyph_data_outline)
                    {
                        ras.reset();
                        ras.add_path(ftrans);
                        r.color(agg::rgba8(0, 0, 0));
                        agg::render_scanlines(ras, sl, r);
                    }

                    // increment pen position
                    x += glyph->advance_x;
                    y += glyph->advance_y;
                }
                ++p;
            }
        }
        else
        {
            message("Please copy file timesi.ttf to the current directory\n"
                    "or download it from http://www.antigrain.com/timesi.zip");
        }



        typedef agg::conv_stroke<conv_bspline_type> conv_stroke_type;
        conv_stroke_type stroke1(bspline1);
        conv_stroke_type stroke2(bspline2);

        stroke1.width(2.0);
        stroke2.width(2.0);

        r.color(agg::rgba8(170, 50, 20, 100));
        ras.add_path(stroke1);
        agg::render_scanlines(ras, sl, r);

        ras.add_path(stroke2);
        agg::render_scanlines(ras, sl, r);
//.........这里部分代码省略.........
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:101,代码来源:trans_curve2_ft.cpp


示例17: on_draw

    virtual void on_draw()
    {
        pixfmt pixf(rbuf_window());
        renderer_base rb(pixf);
        renderer_solid r(rb);
        rb.clear(agg::rgba(1, 1, 1));

        g_rasterizer.clip_box(0, 0, width(), height());

        if(m_trans_type.cur_item() == 0)
        {
            agg::trans_bilinear tr(g_x1, g_y1, g_x2, g_y2, m_quad.polygon());
            if(tr.is_valid())
            {
                //--------------------------
                // Render transformed lion
                //
                agg::conv_transform<agg::path_storage, 
                                    agg::trans_bilinear> trans(g_path, tr);

                agg::render_all_paths(g_rasterizer, g_scanline, r, trans, g_colors, g_path_idx, g_npaths);
                //--------------------------



                //--------------------------
                // Render transformed ellipse
                //
                agg::ellipse ell((g_x1 + g_x2) * 0.5, (g_y1 + g_y2) * 0.5, 
                                 (g_x2 - g_x1) * 0.5, (g_y2 - g_y1) * 0.5,
                                 200);
                agg::conv_stroke<agg::ellipse> ell_stroke(ell);
                ell_stroke.width(3.0);
                agg::conv_transform<agg::ellipse, 
                                    agg::trans_bilinear> trans_ell(ell, tr);

                agg::conv_transform<agg::conv_stroke<agg::ellipse>, 
                                    agg::trans_bilinear> trans_ell_stroke(ell_stroke, tr);

                g_rasterizer.add_path(trans_ell);
                r.color(agg::rgba(0.5, 0.3, 0.0, 0.3));
                agg::render_scanlines(g_rasterizer, g_scanline, r);

                g_rasterizer.add_path(trans_ell_stroke);
                r.color(agg::rgba(0.0, 0.3, 0.2, 1.0));
                agg::render_scanlines(g_rasterizer, g_scanline, r);
                //--------------------------

            }
        }
        else
        {
            agg::trans_perspective tr(g_x1, g_y1, g_x2, g_y2, m_quad.polygon());
            if(tr.is_valid())
            {

                //--------------------------
                // Render transformed lion
                //
                agg::conv_transform<agg::path_storage, 
                                    agg::trans_perspective> trans(g_path, tr);

                agg::render_all_paths(g_rasterizer, g_scanline, r, trans, g_colors, g_path_idx, g_npaths);

                //--------------------------



                //--------------------------
                // Render transformed ellipse
                //
                agg::ellipse ell((g_x1 + g_x2) * 0.5, (g_y1 + g_y2) * 0.5, 
                                 (g_x2 - g_x1) * 0.5, (g_y2 - g_y1) * 0.5,
                                 200);

                agg::conv_stroke<agg::ellipse> ell_stroke(ell);
                ell_stroke.width(3.0);
                agg::conv_transform<agg::ellipse, 
                                    agg::trans_perspective> trans_ell(ell, tr);


                agg::conv_transform<agg::conv_stroke<agg::ellipse>, 
                                    agg::trans_perspective> trans_ell_stroke(ell_stroke, tr);


                g_rasterizer.add_path(trans_ell);
                r.color(agg::rgba(0.5, 0.3, 0.0, 0.3));
                agg::render_scanlines(g_rasterizer, g_scanline, r);

                g_rasterizer.add_path(trans_ell_stroke);
                r.color(agg::rgba(0.0, 0.3, 0.2, 1.0));
                agg::render_scanlines(g_rasterizer, g_scanline, r);
                //--------------------------


                // Testing the reverse transformations
                //agg::trans_perspective tr2(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);
                //if(tr2.is_valid())
                //{
                //    double x, y;
//.........这里部分代码省略.........
开发者ID:Bashakov,项目名称:agg,代码行数:101,代码来源:perspective.cpp


示例18: on_init

 virtual void on_init()
 {
     double dx = width()  / 2.0 - (m_quad.xn(1) - m_quad.xn(0)) / 2.0;
     double dy = height() / 2.0 - (m_quad.yn(2) - m_quad.yn(0)) / 2.0;
     m_quad.xn(0) += dx;
     m_quad.yn(0) += dy;
     m_quad.xn(1) += dx;
     m_quad.yn(1) += dy;
     m_quad.xn(2) += dx;
     m_quad.yn(2) += dy;
     m_quad.xn(3) += dx;
     m_quad.yn(3) += dy;
 }
开发者ID:Bashakov,项目名称:agg,代码行数:13,代码来源:perspective.cpp


示例19: on_draw

    virtual void on_draw()
    {
        pixfmt            pixf(rbuf_window());
        pixfmt_pre        pixf_pre(rbuf_window());
        renderer_base     rb(pixf);
        renderer_base_pre rb_pre(pixf_pre);

        if(!m_test_flag)
        {
            rb.clear(agg::rgba(1, 1, 1));
        }

        if(m_trans_type.cur_item() == 0)
        {
            // For the affine parallelogram transformations we
            // calculate the 4-th (implicit) point of the parallelogram
            m_quad.xn(3) = m_quad.xn(0) + (m_quad.xn(2) - m_quad.xn(1));
            m_quad.yn(3) = m_quad.yn(0) + (m_quad.yn(2) - m_quad.yn(1));
        }

        if(!m_test_flag)
        {
            //--------------------------
            // Render the "quad" tool and controls
            g_rasterizer.add_path(m_quad);
            agg::render_scanlines_aa_solid(g_rasterizer, g_scanline, rb, agg::rgba(0, 0.3, 0.5, 0.6));

            //--------------------------
            agg::render_ctrl(g_rasterizer, g_scanline, rb, m_trans_type);
        }

        // Prepare the polygon to rasterize. Here we need to fill
        // the destination (transformed) polygon.
        g_rasterizer.clip_box(0, 0, width(), height());
        g_rasterizer.reset();
        g_rasterizer.move_to_d(m_quad.xn(0), m_quad.yn(0));
        g_rasterizer.line_to_d(m_quad.xn(1), m_quad.yn(1));
        g_rasterizer.line_to_d(m_quad.xn(2), m_quad.yn(2));
        g_rasterizer.line_to_d(m_quad.xn(3), m_quad.yn(3));


        typedef agg::span_allocator<color_type> span_alloc_type;
        span_alloc_type sa;
        agg::image_filter<agg::image_filter_hanning> filter;
    
        typedef agg::wrap_mode_reflect_auto_pow2 remainder_type;
        typedef agg::image_accessor_wrap<pixfmt, 
                                         remainder_type, 
                                         remainder_type> img_source_type;

        pixfmt img_pixf(rbuf_img(0));
        img_source_type img_src(img_pixf);

        enum subdiv_shift_e { subdiv_shift = 2 };
         
        switch(m_trans_type.cur_item())
        {
            case 0:
            {
                // Note that we consruct an affine matrix that transforms
                // a parallelogram to a rectangle, i.e., it's inverted.
                // It's actually the same as:
                // tr(g_x1, g_y1, g_x2, g_y2, m_triangle.polygon());
                // tr.invert();
                agg::trans_affine tr(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);

                // Also note that we can use the linear interpolator instead of 
                // arbitrary span_interpolator_trans. It works much faster, 
                // but the transformations must be linear and parellel.
                typedef agg::span_interpolator_linear<agg::trans_affine> interpolator_type;
                interpolator_type interpolator(tr);

                typedef span_image_filter_2x2<img_source_type,
                                              interpolator_type> span_gen_type;
                span_gen_type sg(img_src, interpolator, filter);
                agg::render_scanlines_aa(g_rasterizer, g_scanline, rb_pre, sa, sg);
                break;
            }

            case 1:
            {
                agg::trans_bilinear tr(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);
                if(tr.is_valid())
                {
                    typedef agg::span_interpolator_linear<agg::trans_bilinear> interpolator_type;
                    interpolator_type interpolator(tr);

                    typedef span_image_filter_2x2<img_source_type,
                                                  interpolator_type> span_gen_type;
                    span_gen_type sg(img_src, interpolator, filter);
                    agg::render_scanlines_aa(g_rasterizer, g_scanline, rb_pre, sa, sg);
                }
                break;
            }

            case 2:
            {
                agg::trans_perspective tr(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);
                if(tr.is_valid())
                {
//.........这里部分代码省略.........
开发者ID:bodomartin,项目名称:cheml-agg2,代码行数:101,代码来源:pattern_perspective.cpp


示例20: on_init

 virtual void on_init()
 {
     m_poly.xn(0) = 50;
     m_poly.yn(0) = 50;
     m_poly.xn(1) = 150 + 20;
     m_poly.yn(1) = 150 - 20;
     m_poly.xn(2) = 250 - 20;
     m_poly.yn(2) = 250 + 20;
     m_poly.xn(3) = 350 + 20;
     m_poly.yn(3) = 350 - 20;
     m_poly.xn(4) = 450 - 20;
     m_poly.yn(4) = 450 + 20;
     m_poly.xn(5) = 550;
     m_poly.yn(5) = 550;
 }
开发者ID:zshipko,项目名称:libtwombly,代码行数:15,代码来源:trans_curve1.cpp



注:本文中的agg::interactive_polygon类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ agg::path_storage类代码示例发布时间:2022-05-31
下一篇:
C++ agg::cbox_ctrl类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap