示例#1
0
        //typedef renderer_base<pixfmt> renderer_base;
        //typedef renderer_scanline_aa_solid<renderer_base> renderer_scanline;
        //typedef rasterizer_scanline_aa<> rasterizer_scanline;
        //typedef scanline_u8 scanline;


        public bezier_div_application(pix_format_e format, platform_support_abstract.ERenderOrigin RenderOrigin)
            : base(format, RenderOrigin)
        {
            m_ctrl_color          = new rgba8(new rgba(0, 0.3, 0.5, 0.8));
            m_angle_tolerance     = new slider_ctrl(5.0, 5.0, 240.0, 12.0);
            m_approximation_scale = new slider_ctrl(5.0, 17 + 5.0, 240.0, 17 + 12.0);
            m_cusp_limit          = new slider_ctrl(5.0, 17 + 17 + 5.0, 240.0, 17 + 17 + 12.0);
            m_width         = new slider_ctrl(245.0, 5.0, 495.0, 12.0);
            m_show_points   = new cbox_ctrl(250.0, 15 + 5, "Show Points");
            m_show_outline  = new cbox_ctrl(250.0, 30 + 5, "Show Stroke Outline");
            m_curve_type    = new rbox_ctrl(535.0, 5.0, 535.0 + 115.0, 55.0);
            m_case_type     = new rbox_ctrl(535.0, 60.0, 535.0 + 115.0, 195.0);
            m_inner_join    = new rbox_ctrl(535.0, 200.0, 535.0 + 115.0, 290.0);
            m_line_join     = new rbox_ctrl(535.0, 295.0, 535.0 + 115.0, 385.0);
            m_line_cap      = new rbox_ctrl(535.0, 395.0, 535.0 + 115.0, 455.0);
            m_cur_case_type = (-1);

            m_curve1.line_color(m_ctrl_color);

            m_curve1.curve(170, 424, 13, 87, 488, 423, 26, 333);
            //m_curve1.curve(26.000, 333.000, 276.000, 126.000, 402.000, 479.000, 26.000, 333.000); // Loop with p1==p4
            //m_curve1.curve(378.000, 439.000, 378.000, 497.000, 487.000, 432.000, 14.000, 338.000); // Narrow loop
            //m_curve1.curve(288.000, 283.000, 232.000, 89.000, 66.000, 197.000, 456.000, 241.000); // Loop
            //m_curve1.curve(519.000, 142.000, 97.000, 147.000, 69.000, 147.000, 30.000, 144.000); // Almost straight
            //m_curve1.curve(100, 100, 200, 100, 100, 200, 200, 200); // A "Z" case
            //m_curve1.curve(150, 150, 350, 150, 150, 150, 350, 150); // Degenerate
            //m_curve1.curve(409, 330, 300, 200, 200, 200, 401, 263); // Strange cusp
            //m_curve1.curve(129, 233, 172, 320, 414, 253, 344, 236); // Curve cap
            //m_curve1.curve(100,100, 100,200, 100,100, 110,100); // A "boot"
            //m_curve1.curve(225, 150, 60, 150, 460, 150, 295, 150); // 2----1----4----3
            //m_curve1.curve(162.2, 248.801, 162.2, 248.801, 266, 284, 394, 335);  // Coinciding 1-2
            //m_curve1.curve(162.200, 248.801, 162.200, 248.801, 257.000, 301.000, 394.000, 335.000); // Coinciding 1-2
            //m_curve1.curve(394.000, 335.000, 257.000, 301.000, 162.200, 248.801, 162.200, 248.801); // Coinciding 3-4
            //m_curve1.curve(84.200000,302.80100, 84.200000,302.80100, 79.000000,292.40100, 97.001000,304.40100); // From tiger.svg
            //m_curve1.curve(97.001000,304.40100, 79.000000,292.40100, 84.200000,302.80100, 84.200000,302.80100); // From tiger.svg opposite dir
            //m_curve1.curve(475, 157, 200, 100, 453, 100, 222, 157); // Cusp, failure for Adobe SVG
            add_ctrl(m_curve1);
            m_curve1.no_transform();

            m_angle_tolerance.label("Angle Tolerance=%.0f deg");
            m_angle_tolerance.range(0, 90);
            m_angle_tolerance.value(15);
            add_ctrl(m_angle_tolerance);
            m_angle_tolerance.no_transform();

            m_approximation_scale.label("Approximation Scale=%.3f");
            m_approximation_scale.range(0.1, 5);
            m_approximation_scale.value(1.0);
            add_ctrl(m_approximation_scale);
            m_approximation_scale.no_transform();

            m_cusp_limit.label("Cusp Limit=%.0f deg");
            m_cusp_limit.range(0, 90);
            m_cusp_limit.value(0);
            add_ctrl(m_cusp_limit);
            m_cusp_limit.no_transform();

            m_width.label("Width=%.2f");
            m_width.range(-50, 100);
            m_width.value(50.0);
            add_ctrl(m_width);
            m_width.no_transform();

            add_ctrl(m_show_points);
            m_show_points.no_transform();
            m_show_points.status(true);

            add_ctrl(m_show_outline);
            m_show_outline.no_transform();
            m_show_outline.status(true);

            m_curve_type.add_item("Incremental");
            m_curve_type.add_item("Subdiv");
            m_curve_type.cur_item(1);
            add_ctrl(m_curve_type);
            m_curve_type.no_transform();

            m_case_type.text_size(7);
            m_case_type.text_thickness(1.0);
            m_case_type.add_item("Random");
            m_case_type.add_item("13---24");
            m_case_type.add_item("Smooth Cusp 1");
            m_case_type.add_item("Smooth Cusp 2");
            m_case_type.add_item("Real Cusp 1");
            m_case_type.add_item("Real Cusp 2");
            m_case_type.add_item("Fancy Stroke");
            m_case_type.add_item("Jaw");
            m_case_type.add_item("Ugly Jaw");
            add_ctrl(m_case_type);
            m_case_type.no_transform();

            m_inner_join.text_size(8);
            m_inner_join.add_item("Inner Bevel");
            m_inner_join.add_item("Inner Miter");
            m_inner_join.add_item("Inner Jag");
            m_inner_join.add_item("Inner Round");
            m_inner_join.cur_item(3);
            add_ctrl(m_inner_join);
            m_inner_join.no_transform();

            m_line_join.text_size(8);
            m_line_join.add_item("Miter Join");
            m_line_join.add_item("Miter Revert");
            m_line_join.add_item("Round Join");
            m_line_join.add_item("Bevel Join");
            m_line_join.add_item("Miter Round");

            m_line_join.cur_item(1);
            add_ctrl(m_line_join);
            m_line_join.no_transform();

            m_line_cap.text_size(8);
            m_line_cap.add_item("Butt Cap");
            m_line_cap.add_item("Square Cap");
            m_line_cap.add_item("Round Cap");
            m_line_cap.cur_item(0);
            add_ctrl(m_line_cap);
            m_line_cap.no_transform();
        }
示例#2
0
    //typedef renderer_base<pixfmt> renderer_base;
    //typedef renderer_scanline_aa_solid<renderer_base> renderer_scanline;
    //typedef rasterizer_scanline_aa<> rasterizer_scanline;
    //typedef scanline_u8 scanline;


        public bezier_div_application(pix_format_e format, platform_support_abstract.ERenderOrigin RenderOrigin)
            : base(format, RenderOrigin)
    {
        m_ctrl_color = new rgba8(new rgba(0, 0.3, 0.5, 0.8));
        m_angle_tolerance    = new slider_ctrl(5.0,       5.0, 240.0,       12.0);
        m_approximation_scale = new slider_ctrl(5.0,    17+5.0, 240.0,    17+12.0);
        m_cusp_limit         = new slider_ctrl(5.0, 17+17+5.0, 240.0, 17+17+12.0);
        m_width              = new slider_ctrl(245.0,     5.0, 495.0,       12.0);
        m_show_points        = new cbox_ctrl(250.0, 15+5, "Show Points");
        m_show_outline       = new cbox_ctrl(250.0, 30+5, "Show Stroke Outline");
        m_curve_type         = new rbox_ctrl(535.0,   5.0, 535.0+115.0,   55.0);
        m_case_type          = new rbox_ctrl(535.0,  60.0, 535.0+115.0,   195.0);
        m_inner_join         = new rbox_ctrl(535.0, 200.0, 535.0+115.0,   290.0);
        m_line_join          = new rbox_ctrl(535.0, 295.0, 535.0+115.0,   385.0);
        m_line_cap           = new rbox_ctrl(535.0, 395.0, 535.0+115.0,   455.0);
        m_cur_case_type = (-1);

        m_curve1.line_color(m_ctrl_color);

        m_curve1.curve(170, 424, 13, 87, 488, 423, 26, 333);
        //m_curve1.curve(26.000, 333.000, 276.000, 126.000, 402.000, 479.000, 26.000, 333.000); // Loop with p1==p4
        //m_curve1.curve(378.000, 439.000, 378.000, 497.000, 487.000, 432.000, 14.000, 338.000); // Narrow loop
        //m_curve1.curve(288.000, 283.000, 232.000, 89.000, 66.000, 197.000, 456.000, 241.000); // Loop
        //m_curve1.curve(519.000, 142.000, 97.000, 147.000, 69.000, 147.000, 30.000, 144.000); // Almost straight
        //m_curve1.curve(100, 100, 200, 100, 100, 200, 200, 200); // A "Z" case
        //m_curve1.curve(150, 150, 350, 150, 150, 150, 350, 150); // Degenerate
        //m_curve1.curve(409, 330, 300, 200, 200, 200, 401, 263); // Strange cusp
        //m_curve1.curve(129, 233, 172, 320, 414, 253, 344, 236); // Curve cap
        //m_curve1.curve(100,100, 100,200, 100,100, 110,100); // A "boot"
        //m_curve1.curve(225, 150, 60, 150, 460, 150, 295, 150); // 2----1----4----3
        //m_curve1.curve(162.2, 248.801, 162.2, 248.801, 266, 284, 394, 335);  // Coinciding 1-2
        //m_curve1.curve(162.200, 248.801, 162.200, 248.801, 257.000, 301.000, 394.000, 335.000); // Coinciding 1-2
        //m_curve1.curve(394.000, 335.000, 257.000, 301.000, 162.200, 248.801, 162.200, 248.801); // Coinciding 3-4
        //m_curve1.curve(84.200000,302.80100, 84.200000,302.80100, 79.000000,292.40100, 97.001000,304.40100); // From tiger.svg
        //m_curve1.curve(97.001000,304.40100, 79.000000,292.40100, 84.200000,302.80100, 84.200000,302.80100); // From tiger.svg opposite dir
        //m_curve1.curve(475, 157, 200, 100, 453, 100, 222, 157); // Cusp, failure for Adobe SVG
        add_ctrl(m_curve1);
        m_curve1.no_transform();

        m_angle_tolerance.label("Angle Tolerance=%.0f deg");
        m_angle_tolerance.range(0, 90);
        m_angle_tolerance.value(15);
        add_ctrl(m_angle_tolerance);
        m_angle_tolerance.no_transform();

        m_approximation_scale.label("Approximation Scale=%.3f");
        m_approximation_scale.range(0.1, 5);
        m_approximation_scale.value(1.0);
        add_ctrl(m_approximation_scale);
        m_approximation_scale.no_transform();

        m_cusp_limit.label("Cusp Limit=%.0f deg");
        m_cusp_limit.range(0, 90);
        m_cusp_limit.value(0);
        add_ctrl(m_cusp_limit);
        m_cusp_limit.no_transform();

        m_width.label("Width=%.2f");
        m_width.range(-50, 100);
        m_width.value(50.0);
        add_ctrl(m_width);
        m_width.no_transform();

        add_ctrl(m_show_points);
        m_show_points.no_transform();
        m_show_points.status(true);

        add_ctrl(m_show_outline);
        m_show_outline.no_transform();
        m_show_outline.status(true);

        m_curve_type.add_item("Incremental");
        m_curve_type.add_item("Subdiv");
        m_curve_type.cur_item(1);
        add_ctrl(m_curve_type);
        m_curve_type.no_transform();

        m_case_type.text_size(7);
        m_case_type.text_thickness(1.0);
        m_case_type.add_item("Random");
        m_case_type.add_item("13---24");
        m_case_type.add_item("Smooth Cusp 1");
        m_case_type.add_item("Smooth Cusp 2");
        m_case_type.add_item("Real Cusp 1");
        m_case_type.add_item("Real Cusp 2");
        m_case_type.add_item("Fancy Stroke");
        m_case_type.add_item("Jaw");
        m_case_type.add_item("Ugly Jaw");
        add_ctrl(m_case_type);
        m_case_type.no_transform();

        m_inner_join.text_size(8);
        m_inner_join.add_item("Inner Bevel");
        m_inner_join.add_item("Inner Miter");
        m_inner_join.add_item("Inner Jag");
        m_inner_join.add_item("Inner Round");
        m_inner_join.cur_item(3);
        add_ctrl(m_inner_join);
        m_inner_join.no_transform();

        m_line_join.text_size(8);
        m_line_join.add_item("Miter Join");
        m_line_join.add_item("Miter Revert");
        m_line_join.add_item("Round Join");
        m_line_join.add_item("Bevel Join");
        m_line_join.add_item("Miter Round");

        m_line_join.cur_item(1);
        add_ctrl(m_line_join);
        m_line_join.no_transform();

        m_line_cap.text_size(8);
        m_line_cap.add_item("Butt Cap");
        m_line_cap.add_item("Square Cap");
        m_line_cap.add_item("Round Cap");
        m_line_cap.cur_item(0);
        add_ctrl(m_line_cap);
        m_line_cap.no_transform();
    }