当前位置: 首页>>代码示例>>C++>>正文


C++ draw_lines函数代码示例

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


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

示例1: draw_lines

    void rasterizer::draw_triangles()
    {
        const auto& desc = state_->get_desc();
        if (desc.fm == fill_wireframe) {
            draw_lines();
        } else if (desc.fm == fill_solid) {
			if (prim_vert_cnt_ < 3) {
				draw_lines();
				return;
			}
			//draw_lines();
			assert(prim_vert_cnt_ == 3);
			bool have_color = !colors_.empty();
			for (size_t index = 0; index < indices_.size(); ) {
				const auto& v0 = wvp_[indices_[index]];
				const auto& v1 = wvp_[indices_[index + 1]];
				const auto& v2 = wvp_[indices_[index + 2]];
				const color_rgba8* c0 = &color_rgba8::black;
				const color_rgba8* c1 = &color_rgba8::black;
				const color_rgba8* c2 = &color_rgba8::black;
				if (have_color) {
					c0 = &colors_[indices_[index]];
					c1 = &colors_[indices_[index + 1]];
					c2 = &colors_[indices_[index + 2]];
				}
				draw_triangle(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y, *c0, *c1, *c2);
				index += prim_vert_cnt_;
			}
        }
    }
开发者ID:nomadfighter,项目名称:softcore,代码行数:30,代码来源:rasterizer.cpp

示例2: track_draw

void track_draw(void)
{
    int head = tracklog_idx;

    if (tracklog_size == MAX_TRACK)
	draw_lines(&tracklog[head], MAX_TRACK - head, VFDSHADE_DIM);

    draw_lines(tracklog, head, VFDSHADE_DIM);
}
开发者ID:empeg,项目名称:gpsapp,代码行数:9,代码来源:track.c

示例3: main

int main() {

  screen s;
  color c;

  /* Setup color and screen */

  clear_screen(s);
  
  c.red = 255;
  c.green = 150;
  c.blue = 100;

  /* Setup matrices */
  
  struct matrix *edges;
  struct matrix *transform;

  edges = new_matrix(4, 1);

  /* Finally Testing */
  
  add_edge(edges, 80, 80, 0, 80, 120, 0);
  add_edge(edges, 80, 120, 0, 120, 120, 0);
  add_edge(edges, 120, 120, 0, 120, 80, 0);
  add_edge(edges, 120, 80, 0, 80, 80, 0);

  add_edge(edges, 60, 80, 0, 80, 120, 0);
  add_edge(edges, 80, 120, 0, 100, 100, 0);
  add_edge(edges, 100, 100, 0, 80, 60, 0);
  add_edge(edges, 80, 60, 0, 60, 80, 0);

  add_edge(edges, 90, 90, 0, 110, 90, 0);
  add_edge(edges, 110, 90, 0, 110, 110, 0);
  add_edge(edges, 110, 110, 0, 90, 110, 0);
  add_edge(edges, 90, 110, 0, 90, 90, 0);
  
  draw_lines(edges, s, c);

  int i;
  for (i = 0; i < 40; i+=2) {
    transform = make_translate(i, i, i);
    matrix_mult(transform, edges);
    draw_lines(edges, s, c);
  }  
  
  display(s);
  save_extension(s, "matrix.png");

  /* Free Matrices */
  
  free_matrix( transform );
  free_matrix( edges );

  return 0;
}  
开发者ID:young-k,项目名称:Notes,代码行数:56,代码来源:main.c

示例4: main

int		main()
{
  t_infos	s;
  int		color;
  t_vect	a;
  t_vect	b;
  
  s.mlx_ptr = mlx_init();
  s.win_ptr = mlx_new_window(s.mlx_ptr, 500, 500, "lolilol");
  a.x = 0;
  a.y = 0;
  b.x = 250;
  b.y = 250;
  while (1)
    {
      color = rand_val(0, 0x00FFFFFF);
      while (a.x != 500)
	{
      color = rand_val(0, 0x00FFFFFF);
	  draw_lines(s, a, b, color);
	  usleep(TIME);
	  a.x++;
	}
      while (a.y != 500)
	{
      color = rand_val(0, 0x00FFFFFF);
	  draw_lines(s, a, b, color);
	  a.y++;
	  usleep(TIME);
	}
      while (a.x != 0)
	{
      color = rand_val(0, 0x00FFFFFF);
	  draw_lines(s, a, b, color);      
	  a.x--;
	  usleep(TIME);
	}
      while (a.y != 0)
	{
      color = rand_val(0, 0x00FFFFFF);
	  draw_lines(s, a, b, color);
	  a.y--;
	  usleep(TIME);
	}
    }

  mlx_loop(s.win_ptr);
}
开发者ID:retrobotic,项目名称:Epitech,代码行数:48,代码来源:main.c

示例5: main

int main( int argc, char** argv ) {

  screen s;
  struct matrix *edges;
  struct matrix *transform;
  color c;
  c.red = 200;
  c.blue = 150;
  c.green = 150;
  
  edges = new_matrix(4, 4);
  transform = new_matrix(4, 4);

  clear_screen( s );
  
  add_sphere( edges, 250, 250, 50, .01 );
  add_torus( edges, 200, 200, 25, 50, .01 );
  add_box( edges, 250, 250, 0, 100, 100, 100 );
  
  draw_lines( edges, s, c );
  
  /*  if ( argc == 2 )
    parse_file( argv[1], transform, edges, s );
  else
    parse_file( "stdin", transform, edges, s );
  */
  display(s);

  printf("hi\n");
  save_ppm( s, "curves.ppm" );
  
  free_matrix( transform );
  free_matrix( edges );
}  
开发者ID:CodeSammich,项目名称:hw4,代码行数:34,代码来源:main.c

示例6: draw_lines

void draw_lines(std::shared_ptr<image_t> img, const std::vector<vec2f_t>& lines, float color, int thickness, const mat3f_t& image_transform, std::function<bool (uint32_t)> accept_lines) {
    std::vector<vec2i_t> discrete_lines(lines.size());
    for (uint32_t i = 0; i < lines.size(); ++i) {
        discrete_lines[i] = (image_transform * lines[i].homogeneous()).head(2).template cast<int>();
    }
    draw_lines(img, discrete_lines, color, thickness, accept_lines);
}
开发者ID:paulhilbert,项目名称:october,代码行数:7,代码来源:drawing.cpp

示例7: points

void MGCommandDrawer::draw_points_lines(
		const MGColor& pcolor,	//color of points(boundary)
		const MGColor& lcolor,	//color of line.
		const std::vector<MGPosition>& ipos
)const{
	draw_lines(lcolor,ipos);
	draw_points(pcolor,ipos);
}
开发者ID:zephyrer,项目名称:mgcl,代码行数:8,代码来源:CommandDrawer.cpp

示例8: fl_color

void Shape::draw() const
{
    Fl_Color oldc = fl_color();
    // there is no good portable way of retrieving the current style
    fl_color(lcolor.as_int());            // set color
    fl_line_style(ls.style(),ls.width()); // set style
    draw_lines();
    fl_color(oldc);      // reset color (to previous)
    fl_line_style(0);    // reset line style to default
}
开发者ID:jake-leland,项目名称:Logic-tron,代码行数:10,代码来源:Graph.cpp

示例9: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_save (cr);
    cairo_set_line_width (cr, FIXED_POINT_MIN*10.0);
    draw_lines (cr);
    cairo_restore (cr);

    cairo_translate (cr, CELL_WIDTH + PAD, 0);
    cairo_save (cr);
    cairo_set_line_width (cr, FIXED_POINT_MIN);
    draw_lines (cr);
    cairo_restore (cr);

    cairo_translate (cr, CELL_WIDTH + PAD, 0);
    cairo_save (cr);
    cairo_set_line_width (cr, FIXED_POINT_MIN/10.0);
    draw_lines (cr);
    cairo_restore (cr);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:Distrotech,项目名称:cairo,代码行数:22,代码来源:thin-lines.c

示例10: draw_grid

void
draw_grid(cairo_t *cr, gint width, gint height)
{
  if (grid_snap && grid_type != GRID_HIDDEN)
    {
      cairo_save (cr);
      if (grid_type == GRID_LINES)
        {
          draw_lines(cr, width, height);
        }
      else
        {
          draw_crosses(cr, width, height);
        }
      cairo_restore (cr);
    }
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:17,代码来源:imap_grid.c

示例11: drawPicture

void drawPicture(screen s, color c){

  struct matrix* picture = new_matrix(3, 5); 

  int startx = 45; 
  int starty = 400; 


  int counter = 1; 
  int sizec = 0.5; 
  int locationc = 50; 

  while(counter != 9){
    free_matrix(picture); 
    picture = new_matrix(3,5); 
    startx+= locationc; 
    //starty = starty + 25*(7-counter); 
    add_edge(picture, startx, starty, 1, startx+50, starty, 1); 
    add_edge(picture, startx+50, starty, 1, startx+90, starty-40, 1); 
    add_edge(picture, startx+90, starty-40, 1, startx+90, starty-90, 1); 
    add_edge(picture, startx+90, starty-90, 1, startx+50, starty-130, 1); 
    add_edge(picture, startx+50, starty-130, 1, startx, starty-130, 1); 
    add_edge(picture, startx, starty-130, 1, startx-40, starty-90,1); 
    add_edge(picture, startx-40, starty-90,1, startx-40,starty-40,1); 
    add_edge(picture, startx-40, starty-40,1, startx, starty, 1); 
    scalar_mult(sizec +(counter *0.10), picture); 
    locationc+= 5; 
    draw_lines(picture, s,c); 

    counter++; 
  }
 
  //print_matrix(picture); 
 
  //scalar_mult(1.5, picture); 
 
   /*
    scalar_mult(0.5, picture); 
    matrix_mult(transformers, picture); 
    draw_lines(picture, s, c); 
  */

  


}
开发者ID:stuydw,项目名称:matrix,代码行数:46,代码来源:main.c

示例12: main

int main( int argc, char** argv ) {

  screen s;
  struct matrix *edges;
  struct matrix *transform;
  color c;
  c.red = 0;
  c.green = 255;
  c.blue = 255;

  edges = new_matrix(4, 4);
  transform = new_matrix(4, 4);

  if ( argc == 2 )
    parse_file( argv[1], transform, edges, s );
  else
    parse_file( "stdin", transform, edges, s );

  add_edge( edges, 250,0,0, 250,25,0 );//M                       
  add_edge( edges, 250,25,0, 263,0,0 );
  add_edge( edges, 263,0,0, 275,25,0 );
  add_edge( edges, 275,25,0, 275,0,0 );
  add_edge( edges, 280,0,0, 293,25,0 );//A                      
  add_edge( edges, 293,25,0, 305,0,0 );
  add_edge( edges, 287,13,0, 299,13,0 );
  add_edge( edges, 310,0,0, 325,25,0 );//Y                               
  add_edge( edges, 318,13,0, 305,25,0 );
  add_edge( edges, 330,0,0, 343,25,0 );//A                              
  add_edge( edges, 343,25,0, 355,0,0 );
  add_edge( edges, 337,13,0, 349,13,0 );
  add_edge( edges, 360,0,0, 360,25,0 );//N                         
  add_edge( edges, 360,25,0, 385,0,0 );
  add_edge( edges, 385,0,0, 385,25,0 );
  add_edge( edges, 390,0,0, 390,25,0 );//K                           
  add_edge( edges, 390,13,0, 408,25,0 );
  add_edge( edges, 395,14,0, 408,0,0 );
  draw_lines(edges, s, c);

  save_extension(s, "dimensional.png");
  display(s);

  free_matrix( transform );
  free_matrix( edges );
}  
开发者ID:mayankvanjani,项目名称:mayank_el_3D,代码行数:44,代码来源:main.c

示例13: switch

	void rasterizer::draw()
	{
        if (indices_.empty() || wvp_.empty()) {
            return;
        }
        const auto& desc = state_->get_desc();
        switch (desc.prim_) {
            case pt_point:
                break;
            case pt_line:
                draw_lines();
                break;
            case pt_triangle:
                draw_triangles();
                break;
            case pt_none:
            default:
                break;
        }
	}
开发者ID:nomadfighter,项目名称:softcore,代码行数:20,代码来源:rasterizer.cpp

示例14: draw_letter

void draw_letter (letter_t* let, color_t c, color_t oc, bool is_fill) {
  // printf("LET %c: ", let->c);
  if (is_fill) {
    for (int i = 0; i < let->lines.size(); i++) {
      letter_lines_t* lines = let->lines[i];
      glColor4f(oc[0], oc[1], oc[2], oc[3]);
      draw_fat_lines(&lines->points, 0.2);
    }
    for (int i = 0; i < let->lines.size(); i++) {
      letter_lines_t* lines = let->lines[i];
      glColor4f(c[0], c[1], c[2], c[3]);
      draw_fat_lines(&lines->points, 0.1);
    }
  } else {
    for (int i = 0; i < let->lines.size(); i++) {
      letter_lines_t* lines = let->lines[i];
      glColor4f(c[0], c[1], c[2], c[3]);
      draw_lines(&lines->points, GL_LINE_STRIP);
    }
  }
}
开发者ID:jackbackrack,项目名称:gui,代码行数:21,代码来源:draw.cpp

示例15: gtk_vi_screen_refresh

void
gtk_vi_screen_refresh(GtkViScreen *vi)
{
    if (vi->lastx != vi->curx || vi->lasty != vi-> cury) {
	mark_lines(vi, vi->lasty, 
		vi->lastx ? *ColAt(vi,vi->lasty,vi->lastx-1) + 1 : 0, 
		vi->lasty+1, *ColAt(vi,vi->lasty,vi->lastx)+1);
	mark_lines(vi, vi->cury, 
		vi->curx ? *ColAt(vi,vi->cury,vi->curx-1) + 1 : 0, 
		vi->cury+1, *ColAt(vi,vi->cury,vi->curx)+1);
    }
    if (vi->marked_maxy == 0)
	return;
    draw_lines(vi, vi->marked_y, vi->marked_x, vi->marked_maxy, vi->marked_maxx);
    vi->marked_x = vi->cols;
    vi->marked_y = vi->rows;
    vi->marked_maxx = 0;
    vi->marked_maxy = 0;
    vi->lastx = vi->curx;
    vi->lasty = vi->cury;
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:21,代码来源:gtkviscreen.c


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