예제 #1
0
파일: graph_test.cpp 프로젝트: Bashakov/agg
    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_type(-1, -1, -1, -1, !flip_y),
        m_width(110+80, 8.0, 110+200.0+80, 8.0 + 7.0, !flip_y),
        m_benchmark(110+200+80+8, 8.0-2.0, "Benchmark", !flip_y),
        m_draw_nodes(110+200+80+8, 8.0-2.0+15.0, "Draw Nodes", !flip_y),
        m_draw_edges(200+200+80+8, 8.0-2.0+15.0, "Draw Edges", !flip_y),
        m_draft(200+200+80+8, 8.0-2.0, "Draft Mode", !flip_y),
        m_translucent(110+80, 8.0-2.0+15.0, "Translucent Mode", !flip_y),
        m_graph(200, 100),
        m_gradient_colors(),
        m_draw(3)
    {
        add_ctrl(m_type);
        m_type.text_size(8.0);
        m_type.add_item("Solid lines");
        m_type.add_item("Bezier curves");
        m_type.add_item("Dashed curves");
        m_type.add_item("Poygons AA");
        m_type.add_item("Poygons Bin");
        m_type.cur_item(0);

        add_ctrl(m_width);
        m_width.num_steps(20);
        m_width.range(0.0, 5.0);
        m_width.value(2.0);
        m_width.label("Width=%1.2f");

        m_benchmark.text_size(8.0);
        m_draw_nodes.text_size(8.0);
        m_draft.text_size(8.0);
        m_draw_nodes.status(true);
        m_draw_edges.status(true);
        add_ctrl(m_benchmark);
        add_ctrl(m_draw_nodes);
        add_ctrl(m_draw_edges);
        add_ctrl(m_draft);
        add_ctrl(m_translucent);

        agg::rgba c1(1, 1, 0, 0.25);
        agg::rgba c2(0, 0, 1);

        int i;
        for(i = 0; i < 256; i++)
        {
            m_gradient_colors[i] = c1.gradient(c2, double(i) / 255.0);
        }
    }
예제 #2
0
    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_slider1      (10, 10,    600-10, 17,    !flip_y),
        m_slider_spiral(10, 10+20, 600-10, 17+20, !flip_y),
        m_slider_base_y(10, 10+40, 600-10, 17+40, !flip_y)
    {
        add_ctrl(m_slider1);
        m_slider1.range(0.0, 100.0);
        m_slider1.num_steps(5);
        m_slider1.value(32.0);
        m_slider1.label("Some Value=%1.0f");

        add_ctrl(m_slider_spiral);
        m_slider_spiral.label("Spiral=%.3f");
        m_slider_spiral.range(-0.1, 0.1);
        m_slider_spiral.value(0.0);

        add_ctrl(m_slider_base_y);
        m_slider_base_y.label("Base Y=%.3f");
        m_slider_base_y.range(50.0, 200.0);
        m_slider_base_y.value(120.0);
    }