本文整理汇总了C++中agg::cbox_ctrl类的典型用法代码示例。如果您正苦于以下问题:C++ cbox_ctrl类的具体用法?C++ cbox_ctrl怎么用?C++ cbox_ctrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cbox_ctrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_idle
void on_idle()
{
if(m_run.status())
{
if(m_cur_angle < 360.0)
{
m_cur_angle += m_step.value();
copy_img_to_img(1, 0);
#ifdef AGG_ACCURATE_TIME
start_timer();
#endif
transform_image(m_step.value());
#ifdef AGG_ACCURATE_TIME
m_time2 += elapsed_time();
#endif
m_num_steps++;
}
else
{
m_cur_angle = 0.0;
#ifndef AGG_ACCURATE_TIME
m_time2 = clock();
#endif
wait_mode(true);
m_run.status(false);
}
force_redraw();
}
else
{
wait_mode(true);
}
}
示例2: on_idle
//------------------------------------------------------------------------
virtual void on_idle()
{
bool redraw = false;
if(m_rotate_polygon.status())
{
m_polygon_angle.value(m_polygon_angle.value() + 0.5);
if(m_polygon_angle.value() >= 180.0)
{
m_polygon_angle.value(m_polygon_angle.value() - 360.0);
}
redraw = true;
}
if(m_rotate_pattern.status())
{
m_pattern_angle.value(m_pattern_angle.value() - 0.5);
if(m_pattern_angle.value() <= -180.0)
{
m_pattern_angle.value(m_pattern_angle.value() + 360.0);
}
generate_pattern();
redraw = true;
}
if(redraw) force_redraw();
}
示例3:
the_application(agg::pix_format_e format, bool flip_y) :
agg::platform_support(format, flip_y),
m_step (115, 5, 400, 11, !flip_y),
m_radius(115, 5+15, 400, 11+15, !flip_y),
m_filters(0.0, 0.0, 110.0, 210.0, !flip_y),
m_normalize (8.0, 215.0, "Normalize Filter", !flip_y),
m_run (8.0, 245.0, "RUN Test!", !flip_y),
m_single_step(8.0, 230.0, "Single Step", !flip_y),
m_refresh (8.0, 265.0, "Refresh", !flip_y),
m_cur_angle(0.0),
m_cur_filter(1),
m_num_steps(0),
m_num_pix(0.0),
m_time1(0),
m_time2(0)
{
add_ctrl(m_radius);
add_ctrl(m_step);
add_ctrl(m_filters);
add_ctrl(m_run);
add_ctrl(m_single_step);
add_ctrl(m_normalize);
add_ctrl(m_refresh);
m_run.text_size(7.5);
m_single_step.text_size(7.5);
m_normalize.text_size(7.5);
m_refresh.text_size(7.5);
m_normalize.status(true);
m_radius.label("Filter Radius=%.3f");
m_step.label("Step=%3.2f");
m_radius.range(2.0, 8.0);
m_radius.value(4.0);
m_step.range(1.0, 10.0);
m_step.value(5.0);
m_filters.add_item("simple (NN)");
m_filters.add_item("bilinear");
m_filters.add_item("bicubic");
m_filters.add_item("spline16");
m_filters.add_item("spline36");
m_filters.add_item("hanning");
m_filters.add_item("hamming");
m_filters.add_item("hermite");
m_filters.add_item("kaiser");
m_filters.add_item("quadric");
m_filters.add_item("catrom");
m_filters.add_item("gaussian");
m_filters.add_item("bessel");
m_filters.add_item("mitchell");
m_filters.add_item("sinc");
m_filters.add_item("lanczos");
m_filters.add_item("blackman");
m_filters.cur_item(1);
m_filters.border_width(0, 0);
m_filters.background_color(agg::rgba(0.0, 0.0, 0.0, 0.1));
m_filters.text_size(6.0);
m_filters.text_thickness(0.85);
}
示例4: on_idle
//------------------------------------------------------------------------
virtual void on_idle()
{
bool redraw = false;
if(m_rotate_polygon.status())
{
m_polygon_angle.value(m_polygon_angle.value() + 0.5);
if(m_polygon_angle.value() >= 180.0)
{
m_polygon_angle.value(m_polygon_angle.value() - 360.0);
}
redraw = true;
}
if(m_rotate_image.status())
{
m_image_angle.value(m_image_angle.value() + 0.5);
if(m_image_angle.value() >= 180.0)
{
m_image_angle.value(m_image_angle.value() - 360.0);
}
redraw = true;
}
if(redraw) force_redraw();
}
示例5:
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);
}
示例6: on_ctrl_change
//------------------------------------------------------------------------
virtual void on_ctrl_change() {
if (m_rotate_polygon.status() || m_rotate_image.status()) {
wait_mode(false);
} else {
wait_mode(true);
}
force_redraw();
}
示例7: on_ctrl_change
virtual void on_ctrl_change()
{
if(m_reset.status())
{
on_init();
m_reset.status(false);
force_redraw();
}
}
示例8:
the_application(agg::pix_format_e format, bool flip_y) :
agg::platform_support(format, flip_y),
m_rotate(10, 3, "Rotate", !flip_y),
m_even_odd(60, 3, "Even-Odd", !flip_y),
m_draft(130, 3, "Draft", !flip_y),
m_roundoff(175, 3, "Roundoff", !flip_y),
m_angle_delta(10, 21, 250-10, 27, !flip_y),
m_redraw_flag(true)
{
m_angle_delta.label("Step=%4.3f degree");
g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
agg::rgba8(255, 255, 0),
agg::rgba8(0, 0, 0),
1.0);
g_path.concat_poly(g_poly_bulb, AGG_POLY_SIZE(g_poly_bulb), true);
g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
agg::rgba8(255, 255, 200),
agg::rgba8(90, 0, 0),
0.7);
g_path.concat_poly(g_poly_beam1, AGG_POLY_SIZE(g_poly_beam1), true);
g_path.concat_poly(g_poly_beam2, AGG_POLY_SIZE(g_poly_beam2), true);
g_path.concat_poly(g_poly_beam3, AGG_POLY_SIZE(g_poly_beam3), true);
g_path.concat_poly(g_poly_beam4, AGG_POLY_SIZE(g_poly_beam4), true);
g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
agg::rgba8(0, 0, 0),
agg::rgba8(0, 0, 0),
0.0);
g_path.concat_poly(g_poly_fig1, AGG_POLY_SIZE(g_poly_fig1), true);
g_path.concat_poly(g_poly_fig2, AGG_POLY_SIZE(g_poly_fig2), true);
g_path.concat_poly(g_poly_fig3, AGG_POLY_SIZE(g_poly_fig3), true);
g_path.concat_poly(g_poly_fig4, AGG_POLY_SIZE(g_poly_fig4), true);
g_path.concat_poly(g_poly_fig5, AGG_POLY_SIZE(g_poly_fig5), true);
g_path.concat_poly(g_poly_fig6, AGG_POLY_SIZE(g_poly_fig6), true);
m_rotate.text_size(7);
m_even_odd.text_size(7);
m_draft.text_size(7);
m_roundoff.text_size(7);
add_ctrl(m_rotate);
add_ctrl(m_even_odd);
add_ctrl(m_draft);
add_ctrl(m_roundoff);
add_ctrl(m_angle_delta);
m_angle_delta.value(0.01);
}
示例9: on_ctrl_change
//------------------------------------------------------------------------
virtual void on_ctrl_change()
{
if(m_rotate_polygon.status() || m_rotate_pattern.status())
{
wait_mode(false);
}
else
{
wait_mode(true);
}
generate_pattern();
force_redraw();
}
示例10: on_draw
virtual void on_draw()
{
typedef agg::gamma_lut<agg::int8u, agg::int8u, 8, 8> gamma_lut_type;
typedef agg::pixfmt_bgr24_gamma<gamma_lut_type> pixfmt;
typedef agg::renderer_base<pixfmt> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
gamma_lut_type gamma(m_gamma.value());
pixfmt pixf(rbuf_window(), gamma);
renderer_base rb(pixf);
renderer_solid ren(rb);
rb.clear(m_white_on_black.status() ? agg::rgba(0,0,0) : agg::rgba(1,1,1));
agg::rasterizer_scanline_aa<> ras;
agg::scanline_p8 sl;
agg::ellipse e;
// Render two "control" circles
ren.color(agg::rgba8(127,127,127));
e.init(m_x[0], m_y[0], 3, 3, 16);
ras.add_path(e);
agg::render_scanlines(ras, sl, ren);
e.init(m_x[1], m_y[1], 3, 3, 16);
ras.add_path(e);
agg::render_scanlines(ras, sl, ren);
double d = m_offset.value();
// Creating a rounded rectangle
agg::rounded_rect r(m_x[0]+d, m_y[0]+d, m_x[1]+d, m_y[1]+d, m_radius.value());
r.normalize_radius();
// Drawing as an outline
agg::conv_stroke<agg::rounded_rect> p(r);
p.width(1.0);
ras.add_path(p);
ren.color(m_white_on_black.status() ? agg::rgba(1,1,1) : agg::rgba(0,0,0));
agg::render_scanlines(ras, sl, ren);
ras.gamma(agg::gamma_none());
// Render the controls
agg::render_ctrl(ras, sl, rb, m_radius);
agg::render_ctrl(ras, sl, rb, m_gamma);
agg::render_ctrl(ras, sl, rb, m_offset);
agg::render_ctrl(ras, sl, rb, m_white_on_black);
}
示例11: double
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);
}
}
示例12:
the_application(agg::pix_format_e format, bool flip_y) :
agg::platform_support(format, flip_y),
m_idx(-1),
m_gamma(130 + 10.0, 10.0 + 4.0, 130 + 150.0, 10.0 + 8.0 + 4.0, !flip_y),
m_alpha(130 + 150.0 + 10.0, 10.0 + 4.0, 500 - 10.0, 10.0 + 8.0 + 4.0, !flip_y),
m_test(130 + 10.0, 10.0 + 4.0 + 16.0, "Test Performance", !flip_y)
{
m_x[0] = 100 + 120; m_y[0] = 60;
m_x[1] = 369 + 120; m_y[1] = 170;
m_x[2] = 143 + 120; m_y[2] = 310;
add_ctrl(m_gamma);
m_gamma.range(0.0, 1.0);
m_gamma.value(0.5);
m_gamma.label("Gamma=%1.2f");
m_gamma.no_transform();
add_ctrl(m_alpha);
m_alpha.range(0.0, 1.0);
m_alpha.value(1.0);
m_alpha.label("Alpha=%1.2f");
m_alpha.no_transform();
add_ctrl(m_test);
m_test.no_transform();
}
示例13: draw_dashes_draft
//------------------------------------------------------------------------
void draw_dashes_draft()
{
pixfmt pixf(rbuf_window());
base_renderer rb(pixf);
primitives_renderer prim(rb);
outline_rasterizer ras(prim);
int i;
for(i = 0; i < m_graph.get_num_edges(); i++)
{
graph::edge e = m_graph.get_edge(i);
graph::node n1 = m_graph.get_node(e.node1, width(), height());
graph::node n2 = m_graph.get_node(e.node2, width(), height());
curve c(n1.x, n1.y, n2.x, n2.y);
dash_stroke_draft<curve> s(c, 6.0, 3.0, m_width.value());
int r = rand() & 0x7F;
int g = rand() & 0x7F;
int b = rand() & 0x7F;
int a = 255;
if(m_translucent.status()) a = 80;
prim.line_color(agg::srgba8(r, g, b, a));
ras.add_path(s);
}
}
示例14: draw_scene
//------------------------------------------------------------------------
void draw_scene(scanline_rasterizer& ras,
solid_renderer& solid,
draft_renderer& draft)
{
ras.gamma(agg::gamma_none());
srand(100);
if(m_draw_nodes.status())
{
if(m_draft.status())
{
draw_nodes_draft();
}
else
{
draw_nodes_fine(ras);
}
}
if(m_draw_edges.status())
{
if(m_draft.status())
{
switch(m_type.cur_item())
{
case 0: draw_lines_draft(); break;
case 1: draw_curves_draft(); break;
case 2: draw_dashes_draft(); break;
}
}
else
{
switch(m_type.cur_item())
{
case 0: draw_lines_fine(ras, solid, draft); break;
case 1: draw_curves_fine(ras, solid, draft); break;
case 2: draw_dashes_fine(ras, solid, draft); break;
case 3:
case 4: draw_polygons(ras, solid, draft); break;
}
}
}
}
示例15: on_ctrl_change
void on_ctrl_change()
{
if(m_single_step.status())
{
m_cur_angle += m_step.value();
copy_img_to_img(1, 0);
transform_image(m_step.value());
m_num_steps++;
force_redraw();
m_single_step.status(false);
}
if(m_run.status())
{
#ifdef AGG_ACCURATE_TIME
start_timer();
m_time1 = m_time2 = elapsed_time();
#else
m_time1 = m_time2 = clock();
#endif
m_num_pix = 0.0;
wait_mode(false);
}
if(m_refresh.status() || m_filters.cur_item() != m_cur_filter)
{
#ifdef AGG_ACCURATE_TIME
start_timer();
m_time1 = m_time2 = 0;
#else
m_time1 = m_time2 = clock();
#endif
m_num_pix = 0.0;
m_cur_angle = 0.0;
copy_img_to_img(1, 2);
transform_image(0.0);
m_refresh.status(false);
m_cur_filter = m_filters.cur_item();
m_num_steps = 0;
force_redraw();
}
}