Пример #1
0
/****************************************************************************
  Draw a 1-pixel-width colored curved line onto the canvas.
****************************************************************************/
void canvas_put_curved_line(struct canvas *pcanvas, struct color *pcolor,
                            enum line_type ltype, int start_x, int start_y,
                            int dx, int dy)
{
  /* FIXME: Implement curved line drawing. */
  canvas_put_line(pcanvas, pcolor, ltype, start_x, start_y, dx, dy);
}
Пример #2
0
/**************************************************************************
  Copies the overview image from the backing store to the window and
  draws the viewrect on top of it.
**************************************************************************/
static void redraw_overview(void)
{
  int i, x[4], y[4];

  if (!overview.map) {
    return;
  }

  {
    struct canvas *src = overview.map, *dst = overview.window;
    int x = overview.map_x0 * OVERVIEW_TILE_SIZE;
    int y = overview.map_y0 * OVERVIEW_TILE_SIZE;
    int ix = overview.width - x;
    int iy = overview.height - y;

    canvas_copy(dst, src, 0, 0, ix, iy, x, y);
    canvas_copy(dst, src, 0, y, ix, 0, x, iy);
    canvas_copy(dst, src, x, 0, 0, iy, ix, y);
    canvas_copy(dst, src, x, y, 0, 0, ix, iy);
  }

  gui_to_overview_pos(tileset, &x[0], &y[0],
		      mapview.gui_x0, mapview.gui_y0);
  gui_to_overview_pos(tileset, &x[1], &y[1],
		      mapview.gui_x0 + mapview.width, mapview.gui_y0);
  gui_to_overview_pos(tileset, &x[2], &y[2],
		      mapview.gui_x0 + mapview.width,
		      mapview.gui_y0 + mapview.height);
  gui_to_overview_pos(tileset, &x[3], &y[3],
		      mapview.gui_x0, mapview.gui_y0 + mapview.height);

  for (i = 0; i < 4; i++) {
    int src_x = x[i];
    int src_y = y[i];
    int dst_x = x[(i + 1) % 4];
    int dst_y = y[(i + 1) % 4];

    canvas_put_line(overview.window,
		    get_color(tileset, COLOR_OVERVIEW_VIEWRECT),
		    LINE_NORMAL,
		    src_x, src_y, dst_x - src_x, dst_y - src_y);
  }

  refresh_overview_from_canvas();

  overview_dirty = FALSE;
}