Пример #1
0
void ScopeWaveform::update_point(int x, int y)
{
	draw_point();
	drag_x = x;
	drag_y = y;
	int frame_x = x * gui->frame_w / get_w();

	if(gui->use_wave_parade)
	{
		if(x > get_w() / 3 * 2)
			frame_x = (x - get_w() / 3 * 2) * gui->frame_w / (get_w() / 3);
		else
		if(x > get_w() / 3)
			frame_x = (x - get_w() / 3) * gui->frame_w / (get_w() / 3);
		else
			frame_x = x * gui->frame_w / (get_w() / 3);
	}

	float value = ((float)get_h() - y) / get_h() * (FLOAT_MAX - FLOAT_MIN) + FLOAT_MIN;

	char string[BCTEXTLEN];
	sprintf(string, "X: %d Value: %.3f", frame_x, value);
	gui->value_text->update(string, 0);

	draw_point();
	flash(1);
}
Пример #2
0
void draw_character_surface(SDL_Surface *screen,int x,int y,int w,uint32_t cin,uint32_t bg,uint32_t fg,int bold,int underline,int italic,int strike) {
    for(size_t c_y=y;c_y<(y+16);c_y++) {
    for(size_t c_x=x;c_x<(x+w);c_x++) {

      if((c_y==15) && (underline == 1)) {
        draw_point(screen,c_x,c_y,fg);
      } else
      if((c_y==8 ) && (strike == 1)) {
        draw_point(screen,c_x,c_y,fg);
      } else {

        int32_t value  = get_pixel(cin,c_x-x,c_y-y);
        int32_t value1 = get_pixel(cin,c_x+1-x,c_y-y);
//        int32_t value2 = get_pixel(cin,c_x-1,c_y);
//        int32_t value3 = get_pixel(cin,c_x,c_y+1);
//        int32_t value4 = get_pixel(cin,c_x,c_y-1);

        int i=0;
        if(italic==1) i=1;

        if(value > 0) {
          draw_point(screen,c_x+i,c_y,fg);
        } else {
          draw_point(screen,c_x+i,c_y,bg);
          if(bold == 1) {
            if(value1 > 0) {
              draw_point(screen,c_x+i,c_y,fg);
            }
          }
        }
      }
    }
  }
}
Пример #3
0
/* Bresenham's Line Drawing Algorithm
   Modified version to draw line of variable thickness */
static void draw_line(coord_t x0, coord_t y0, coord_t x1, coord_t y1) {
  int16_t dy, dx;
  int16_t addx, addy;
  int16_t P, diff, i;
  
  if (x1 >= x0) {
	  dx = x1 - x0;
	  addx = 1;
  } else {
	  dx = x0 - x1;
	  addx = -1;
  }
  if (y1 >= y0) {
	  dy = y1 - y0;
	  addy = 1;
  } else {
	  dy = y0 - y1;
	  addy = -1;
  }

  if (dx >= dy) {
	  dy *= 2;
	  P = dy - dx;
	  diff = P - dx;

	  for(i=0; i<=dx; ++i) {
		  draw_point(x0, y0);
		  if (P < 0) {
			  P  += dy;
			  x0 += addx;
		  } else {
			  P  += diff;
			  x0 += addx;
			  y0 += addy;
		  }
	  }
  } else {
	  dx *= 2;
	  P = dx - dy;
	  diff = P - dy;

	  for(i=0; i<=dy; ++i) {
		  draw_point(x0, y0);
		  if (P < 0) {
			  P  += dx;
			  y0 += addy;
		  } else {
			  P  += diff;
			  x0 += addx;
			  y0 += addy;
		  }
	  }
  }
}
Пример #4
0
void
draw_background_point(unsigned int x, unsigned int y, int id)
{
  if(y < 75)
    draw_point(x, y, 0);
  else if(y >= SCREEN_HEIGHT - 75)
    draw_point(x, y, 0);
  else 
  {
    draw_point(x, y, PPT[id][x][y - 75]);
  }
}
Пример #5
0
IGL_INLINE void igl::opengl2::draw_point(
  const Eigen::PlainObjectBase<DerivedP> & P,
  const double requested_r,
  const bool selected)
{
  switch(P.size())
  {
    case 2:
      return draw_point(P(0),P(1),0,requested_r,selected);
    default:
      return draw_point(P(0),P(1),P(2),requested_r,selected);
  }
}
Пример #6
0
void ScopeHistogram::update_point(int x, int y)
{
	draw_point();
	drag_x = x;
	float value = (float)x / get_w() * (FLOAT_MAX - FLOAT_MIN) + FLOAT_MIN;
	
	char string[BCTEXTLEN];
	sprintf(string, "Value: %.3f", value);
	gui->value_text->update(string, 0);

	draw_point();
	flash(1);
}
Пример #7
0
void 
draw_thumbnail(unsigned int x, unsigned int y, int n)
{
	int i, j;
	for(i = 0; i < THUMBNAIL_WIDTH; ++i)
	{
		for (j = 0; j < THUMBNAIL_HEIGHT; ++j)
		{
			if(i == 0 || j == 0 || i == THUMBNAIL_WIDTH - 1 || j == THUMBNAIL_HEIGHT - 1)
				draw_point(x + i, y + j, 0);
			else
				draw_point(x + i, y + j, thumbnail[n][i][j]);
		}
	}
}
Пример #8
0
static si_t text_line_draw_frame(si_t gd, si_t x, si_t y, si_t width, si_t height, si_t margin)
{
    si_t n, m;
    /**
     * up line
     **/
    draw_line(gd, 
        x + margin,
        y,
        x + width - margin - 1,
        y);
    /**
     * down line
     **/
    draw_line(gd, 
        x + margin,
        y + height - 1,
        x + width - margin - 1,
        y + height - 1);
    /**
     * left line
     **/
    draw_line(gd, 
        x,
        y + margin,
        x,
        y + height - margin - 1);
    /**
     * right line
     **/
    draw_line(gd, 
        x + width - 1,
        y + margin,
        x + width - 1,
        y + height - margin - 1);

    n = margin;
    while(-- n)
    {
        m = margin - n;
        draw_point(gd, x + n, y + m); 
        draw_point(gd, x + width - n - 1, y + m); 
        draw_point(gd, x + n, y + height - 1 - m); 
        draw_point(gd, x + width - 1 - n, y + height - 1 - m); 
    }

    return 0;
}
Пример #9
0
void filterview_paint(t_filterview *x, t_object *view)
{
	t_rect rect;
	ebox_get_rect_for_view((t_ebox *)x, &rect);
    draw_point(x, view, &rect);
    
}
Пример #10
0
static void		draw_line(t_point p1, t_point p2, t_env *e)
{
	double	tab[6];
	int		state;

	if (!point_out_window(&p1) && !point_out_window(&p2))
		return ;
	draw_line_params(&p1, &p2, tab), state = 1;
	while (state == 1 && !((int)p1.x == (int)p2.x && (int)p1.y == (int)p2.y))
	{
		if (point_out_window(&p1) == 1)
			draw_point(&p1, e, get_color(&p1, &p2));
		tab[5] = tab[4];
		state = 0;
		if (tab[5] > -tab[0] && (int)p1.x != (int)p2.x)
		{
			tab[4] -= tab[2];
			p1.x += tab[1];
			state = 1;
		}
		if (tab[5] < tab[2] && (int)p1.y != (int)p2.y)
		{
			tab[4] += tab[0];
			p1.y += tab[3];
			state = 1;
		}
	}
}
Пример #11
0
void osint_render(void)
{
	int i;
	unsigned char intensity;
	unsigned x0, x1, y0, y1;

   (void)intensity;

	memset(framebuffer, 0, BUFSZ * sizeof(unsigned short));

   /* rasterize list of vectors */
	for (i = 0; i < vector_draw_cnt; i++)
   {
		unsigned char intensity = vectors_draw[i].color;
		x0 = (float)vectors_draw[i].x0 / (float)ALG_MAX_X * (float)WIDTH;
		x1 = (float)vectors_draw[i].x1 / (float)ALG_MAX_X * (float)WIDTH;
		y0 = (float)vectors_draw[i].y0 / (float)ALG_MAX_Y * (float)HEIGHT;
		y1 = (float)vectors_draw[i].y1 / (float)ALG_MAX_Y * (float)HEIGHT;

		if (intensity == 128)
			continue;
	    
		if (x0 - x1 == 0 && y0 - y1 == 0)
			draw_point(x0, y0, intensity);
		else
			draw_line(x0, y0, x1, y1, intensity);
	}
}
Пример #12
0
void		draw_line(t_win *win, t_point *p1, t_point *p2)
{
	int		x;
	int		y;
	int		temp;
	t_bres	*bres;

	bres = bres_construct(p1, p2, (win->max_z));
	x = p1->d2x;
	y = p1->d2y;
	while (1)
	{
		draw_point(win, x, y, p1->colour);
		if (x == p2->d2x && y == p2->d2y)
			break ;
		if ((temp = bres->dline) > -(bres->dx))
		{
			bres->dline -= bres->dy;
			x += bres->sx;
		}
		if (temp < bres->dy)
		{
			bres->dline += bres->dx;
			y += bres->sy;
		}
	}
}
Пример #13
0
 inline void draw_vertices(int i, VHIterator first, VHIterator last, int r = 2,
                           const Color3ub& c = Yellow8) const
 {
   assert(i == 0 || i ==1);
   for(VHIterator vh = first; vh != last; ++vh)
     draw_point(i, Point2f( (*vh)->point().x(), (*vh)->point().y() ), c, r);
 }
Пример #14
0
void		newton(t_env *e, t_calc c, int x, int y)
{
	t_color	*color;
	double	i2;

	if (!(color = (t_color*)malloc(sizeof(t_color))))
		error_param(2, 1);
	c.i = 0;
	i2 = 0;
	while (c.i < e->iter)
	{
		c.z_r2 = e->m * 2 * c.z_r / 3 - (c.z_r * c.z_r - c.z_i * c.z_i) / \
		(c.z_r * c.z_r + c.z_i * c.z_i) / (c.z_r * c.z_r + c.z_i * c.z_i) / 3;
		c.z_i2 = e->m2 * 2 * c.z_i / 3 + 2 * c.z_r * c.z_i / (c.z_r * c.z_r +\
		c.z_i * c.z_i) / (c.z_r * c.z_r + c.z_i * c.z_i) / 3;
		c.z_r = c.z_r2;
		c.z_i = c.z_i2;
		if (c.z_r * c.z_r + c.z_i * c.z_i < (e->xs / WINDOW_SIZE_W))
			i2 = c.i;
		c.i += 1;
	}
	if (i2 == e->iter)
		set_color(1, i2, e, color);
	else
		set_color(2, i2, e, color);
	draw_point(x, y, e, color);
	free(color);
}
Пример #15
0
void ScopeVectorscope::clear_point()
{
// Hide it
	draw_point();
	drag_radius = 0;
	drag_angle = 0;
}
Пример #16
0
    void SoftwareRendererImp::draw_element(SVGElement* element) {

        // Task 4 (part 1):
        // Modify this to implement the transformation stack

        switch (element->type) {
            case POINT:
                draw_point(static_cast<Point&>(*element));
                break;
            case LINE:
                draw_line(static_cast<Line&>(*element));
                break;
            case POLYLINE:
                draw_polyline(static_cast<Polyline&>(*element));
                break;
            case RECT:
                draw_rect(static_cast<Rect&>(*element));
                break;
            case POLYGON:
                draw_polygon(static_cast<Polygon&>(*element));
                break;
            case ELLIPSE:
                draw_ellipse(static_cast<Ellipse&>(*element));
                break;
            case IMAGE:
                draw_image(static_cast<Image&>(*element));
                break;
            case GROUP:
                draw_group(static_cast<Group&>(*element));
                break;
            default:
                break;
        }

    }
Пример #17
0
/* plain old bresenham, AA etc. is up to the FE */
static inline void draw_line(unsigned x0, unsigned y0, unsigned x1, unsigned y1, unsigned char col)
{
	int dx = abs(x1-x0);
	int dy = abs(y1-y0);
	int sx = x0 < x1 ? 1 : -1;
	int sy = y0 < y1 ? 1 : -1;
	int err = dx - dy;
	int e2;

	while(1)
   {
      draw_point(x0, y0, col);

      if (x0 == x1 && y0 == y1)
         break;

      e2 = 2 * err;
      if (e2 > -dy)
      {
         err = err - dy;
         x0 = x0 + sx;
      }

      if (e2 < dx)
      {
         err = err + dx;
         y0 = y0 + sy;
      }
   }
}
Пример #18
0
void	dddd(int color, t_env e, t_segment seg)
{
	int		i;
	int		erreur;

	if (seg.Dx > seg.Dy)
	{
		erreur = seg.Dx / 2;
		i = 0;
		while (i < seg.Dx)
		{
			seg.x += seg.x_inc;
			erreur += seg.Dy;
			if (erreur > seg.Dx)
			{
				erreur -= seg.Dx;
				seg.y += seg.y_inc;
			}
			draw_point(e, seg.x, seg.y, color);
			i++;
		}
	}
	else
		dessin(e, seg, color);
}
Пример #19
0
IGL_INLINE void igl::draw_point(
  const Eigen::PlainObjectBase<DerivedP> & P,
  const double requested_r,
  const bool selected)
{
  return draw_point(P(0),P(1),P(2),requested_r,selected);
}
Пример #20
0
void key_s3c(void)
{
int which_key,i;
while((rPDATG & 0xf0)==0xf0);
which_key=rPDATG&0xf0;
    switch(which_key)
    {
case 0xe0:
   Led_Display(0x1);
   point.y_point-=20;
   if(point.y_point<20)
   point.y_point=200;
   break;
case 0xd0:
   Led_Display(0x2);
   point.x_point-=20;
   if(point.x_point<20)
   point.x_point=200;
   break;
case 0xb0:
   Led_Display(0x4);
   if( map[point.y_map][point.x_map]==0 )
{
change_color();
map[point.y_map][point.x_map]=point.color;
draw_map();

if( if_won(point.y_map,point.x_map,point.color) )
{
GUI_SetTextMode(GUI_DM_TRANS); //设置为透明
GUI_SetFont(&GUI_Font8x16x1x2);
GUI_DispStringAt("win!",250,90);

for(i=0;i<20;i++)
GUI_Delay(1000);
map_initial();

GUI_SetDrawMode(GUI_DM_NORMAL);
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);
draw_net();
draw_point();
}

}
   break;
case 0x70:
   Led_Display(0x7);
   /*
   point.x_point+=20;
   if(point.x_point>200)
   point.x_point-=20;*/
   break;
default :
   break;
    }
    
    
}
Пример #21
0
void CLCDDisplay::draw_fill_rect (int left,int top,int right,int bottom,int state) {
	int x,y;
	for(x = left + 1;x < right;x++) {  
		for(y = top + 1;y < bottom;y++) {
			draw_point(x,y,state);
		}
	}
}
Пример #22
0
void
walls (int n, player_t * p1, player_t * p2)
{
  Uint32 color;
  int (*v)[2];
  int i,j;
  int index;
  int new_wall_p;
  if (graphicsp)
    color = SDL_MapRGB(screen->format, 50, 50, 50);

  /* Envia la cantidad de muros que habra */
  write_cords (p1, n, 0);
  write_cords (p2, n, 0);

  new_wall_p = 1;
  while(n>0)
    {
      int i,j;
      if (!new_wall_p)
        {
          int c;
          int directions[][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
          int di, dj;
          int d;
          c=0;
          do
            {
              d = (int)((float)rand() / RAND_MAX * 4);
              di = directions[d][0];
              dj = directions[d][1];
              directions[d][0] = -1;
              directions[d][0] = -1;
              c++;
            }
          while( c<20 &&
                 (i+di<0 || i+di >= N ||
                  j+dj<0 || j+dj >= N ||
                  map[i+di][j+dj] == 1 ));
          i += di;
          j += dj;
          if (c==20)
            new_wall_p = 1;
          else
            new_wall_p = (float)rand() / RAND_MAX >= WALL_P;
        }
      if (new_wall_p)
        {
          random_position (&i, &j);
          new_wall_p = 0;
        }
      draw_point (i, j, color);
      map[i][j]=1;
      write_cords (p1, i, j);
      write_cords (p2, i, j);
      n--;
    }
}
Пример #23
0
void plane_paint(t_plane *x, t_object *view)
{
	t_rect rect;
	ebox_get_rect_for_view((t_ebox *)x, &rect);
    x->f_ratio.x = (rect.width - 2 * x->f_size - 2) / (x->f_boundaries.width - x->f_boundaries.x);
    x->f_ratio.y = (rect.height - 2 * x->f_size - 2) / (x->f_boundaries.height - x->f_boundaries.y);
    draw_point(x, view, &rect);
    
}
Пример #24
0
void gui_display(int* results)
{
    create_display(0, 0, height, width);
    for (int r = 0; r < world_size; r++)
        for (int i = 0, x = r * job_width; i < job_width; ++i, ++x)
            for (int j = 0; j < height; ++j)
                draw_point(x, j, results[r * data_size + j * job_width + i]);
    flush();
}
Пример #25
0
gboolean
on_draw_main_button_press_event        (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
	point p = {(double)event->x/XLEN, (double)event->y/YLEN, current_value};
	point_list.push_back(p);
	draw_point(p);
	return FALSE;
}
Пример #26
0
//@@@@@@@@@@@@@@@@@@@@  覆盖背景,重画方格 @@@@@@@@@@@@@@@@@@@@@@
void display_all(void)
{
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);

draw_net();
draw_map();
draw_point();

}
Пример #27
0
int main(int argc, char** argv)
{	
	Image* image = ppm_create(1024, 1024);
	Image* smaller = ppm_create(128, 128);
	
	int x, y;
	for(y = 0; y < image->header.height; y++) {
		for(x = 0; x < image->header.width; x++) {
			Point2D pix = point2(x, y);
			float x_scale = image->header.width / 8.0f;
			float y_scale = image->header.height / 8.0f;
			Point2D samp = point2((pix.x + 512) / x_scale, (pix.y + 512) / y_scale);
			//ColorRGB color = color_field(samp);
			ColorRGB height = heightmap(samp);
			//ColorRGB blended = blend(color, height, 0.1f);
			draw_point(image, pix, height);
		}
	}

	for(y = 0; y < smaller->header.height; y++) {
		for(x = 0; x < image->header.width; x++) {
			Point2D pix = point2(x, y);
			float x_scale = image->header.width / 8.0f;
			float y_scale = image->header.height / 8.0f;
			Point2D sample = point2((pix.x) / x_scale, (pix.y) / y_scale);
			ColorRGB color = heightmap(sample);
			draw_point(smaller, pix, color);
		}
	}
	
	Rect2D src_rect, dest_rect;
	src_rect = (Rect2D) { point2(0, 0), point2(smaller->header.width, smaller->header.height) };
	dest_rect = (Rect2D) { point2(128, 128), point2(448, 448) };
	blit_alpha(image, dest_rect, smaller, src_rect, 0.1f);
	
	ppm_save(image, "overlay.ppm");

	ppm_destroy(smaller);
	ppm_destroy(image);
	
	return 0;
}
Пример #28
0
void tile::draw(const graphics::texture& texture) const
{
#ifdef PROTOTYPE_FRUSTUM_CULLING_ENABLED
    bool translucent = pc_frustum.intersects(*this);
    if(translucent) {
        glDisable(GL_LIGHTING);
        glDisable(GL_TEXTURE_2D);
        glDepthMask(GL_FALSE);
        glBegin(GL_TRIANGLE_FAN);
        glColor4ub(255, 255, 255, 64);
        draw_point(center_);
        for(int i=0;i<7;++i) {
            const int n = i%6;
            draw_point(corners_[n]);
        }
        glEnd();
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_LIGHTING);
        glDepthMask(GL_TRUE);
    } else {
#endif
        glBegin(GL_TRIANGLE_FAN);
        
        texture.set_coord(UVCenter[0],UVCenter[1]);
        
        draw_point(center_);
        
        for(int i = 0; i != 7; ++i) {
            const int n = i%6;
            texture.set_coord(UVCorners[n][0],UVCorners[n][1]);
            draw_point(corners_[n]);
        }
        
        glEnd();
#ifdef PROTOTYPE_FRUSTUM_CULLING_ENABLED
    }
#endif

    if(active_tracker_) {
        active_tracker_->update();
    }
}
Пример #29
0
static void draw_marks(VGPath path)
{
    VGfloat point[2], tangent[2];
    int i = 0;

    for (i = 0; i < 1300; i += 50) {
        vgPointAlongPath(path, 0, 6, i,
                         point + 0, point + 1,
                         tangent + 0, tangent + 1);
        draw_point(point[0], point[1]);
    }
}
Пример #30
0
int repair_shape(int x,int y)
{
    int i = 0;
    int j = 0;
    for(i = 0;i < C_HEIGHT;i++)
    {
        for(j = 0;j < C_WIDTH;j++)
        {
            draw_point(x+j,y+i,shape_save[j+i*C_WIDTH]);
        }
    }
    return 0;
}