Beispiel #1
0
int			disp_ant(t_visu *visu, int num_ant)
{
  t_bunny_position	pos;
  int			check;

  check = 0;
  pos.x = visu->ants[num_ant].dest.x - 40;
  pos.y = visu->ants[num_ant].dest.y - 45;
  if (visu->ants[num_ant].idx < visu->ants[num_ant].len)
    {
      check = 1;
      if (visu->ants[num_ant].way[visu->ants[num_ant].idx].x != 0)
	blit_alpha(visu->pix, visu->ant,
		   &visu->ants[num_ant].way[visu->ants[num_ant].idx]);
      visu->ants[num_ant].idx += 1;
    }
  else
    blit_alpha(visu->pix, visu->ant, &pos);
  return (check);
}
Beispiel #2
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;
}
Beispiel #3
0
void
blit_alpha (iImage * source, iImage * dest, int destx, int desty, int range)
{
  blit_alpha (source, dest, 0, 0, destx, desty, source->GetWidth (),
	      source->GetHeight (), range);
}