Freeciv-3.3
Loading...
Searching...
No Matches
Functions
canvas.c File Reference
#include "gui_stub.h"
#include "canvas.h"

Go to the source code of this file.

Functions

struct canvasgui_canvas_create (int width, int height)
 
void gui_canvas_free (struct canvas *store)
 
void gui_canvas_set_zoom (struct canvas *store, float zoom)
 
bool gui_has_zoom_support (void)
 
void gui_canvas_mapview_init (struct canvas *store)
 
void gui_canvas_copy (struct canvas *dest, struct canvas *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
 
void gui_canvas_put_sprite (struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite, int offset_x, int offset_y, int width, int height)
 
void gui_canvas_put_sprite_full (struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite)
 
void gui_canvas_put_sprite_full_scaled (struct canvas *pcanvas, int canvas_x, int canvas_y, int canvas_w, int canvas_h, struct sprite *sprite)
 
void gui_canvas_put_sprite_fogged (struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *psprite, bool fog, int fog_x, int fog_y)
 
void gui_canvas_put_rectangle (struct canvas *pcanvas, struct color *pcolor, int canvas_x, int canvas_y, int width, int height)
 
void gui_canvas_fill_sprite_area (struct canvas *pcanvas, struct sprite *psprite, struct color *pcolor, int canvas_x, int canvas_y)
 
void gui_canvas_put_line (struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
 
void gui_canvas_put_curved_line (struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
 
void gui_get_text_size (int *width, int *height, enum client_font font, const char *text)
 
void gui_canvas_put_text (struct canvas *pcanvas, int canvas_x, int canvas_y, enum client_font font, struct color *pcolor, const char *text)
 

Function Documentation

◆ gui_canvas_copy()

void gui_canvas_copy ( struct canvas dest,
struct canvas src,
int  src_x,
int  src_y,
int  dest_x,
int  dest_y,
int  width,
int  height 
)

Copies an area from the source canvas to the destination canvas.

Definition at line 67 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_create()

struct canvas * gui_canvas_create ( int  width,
int  height 
)

Create a canvas of the given size.

Definition at line 26 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_fill_sprite_area()

void gui_canvas_fill_sprite_area ( struct canvas pcanvas,
struct sprite psprite,
struct color pcolor,
int  canvas_x,
int  canvas_y 
)

Fill the area covered by the sprite with the given color.

Definition at line 131 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_free()

void gui_canvas_free ( struct canvas store)

Free any resources associated with this canvas and the canvas struct itself.

Definition at line 36 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_mapview_init()

void gui_canvas_mapview_init ( struct canvas store)

Initialize canvas as mapview.

Definition at line 60 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_curved_line()

void gui_canvas_put_curved_line ( struct canvas pcanvas,
struct color pcolor,
enum line_type  ltype,
int  start_x,
int  start_y,
int  dx,
int  dy 
)

Draw a 1-pixel-width colored curved line onto the canvas.

Definition at line 151 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_line()

void gui_canvas_put_line ( struct canvas pcanvas,
struct color pcolor,
enum line_type  ltype,
int  start_x,
int  start_y,
int  dx,
int  dy 
)

Draw a 1-pixel-width colored line onto the canvas.

Definition at line 141 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_rectangle()

void gui_canvas_put_rectangle ( struct canvas pcanvas,
struct color pcolor,
int  canvas_x,
int  canvas_y,
int  width,
int  height 
)

Draw a filled-in colored rectangle onto canvas.

Definition at line 121 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_sprite()

void gui_canvas_put_sprite ( struct canvas pcanvas,
int  canvas_x,
int  canvas_y,
struct sprite sprite,
int  offset_x,
int  offset_y,
int  width,
int  height 
)

Draw some or all of a sprite onto the canvas.

Definition at line 77 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_sprite_fogged()

void gui_canvas_put_sprite_fogged ( struct canvas pcanvas,
int  canvas_x,
int  canvas_y,
struct sprite psprite,
bool  fog,
int  fog_x,
int  fog_y 
)

Draw a full sprite onto the canvas. If "fog" is specified draw it with fog.

Definition at line 110 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_sprite_full()

void gui_canvas_put_sprite_full ( struct canvas pcanvas,
int  canvas_x,
int  canvas_y,
struct sprite sprite 
)

Draw a full sprite onto the canvas.

Definition at line 88 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_put_sprite_full_scaled()

void gui_canvas_put_sprite_full_scaled ( struct canvas pcanvas,
int  canvas_x,
int  canvas_y,
int  canvas_w,
int  canvas_h,
struct sprite sprite 
)

Draw a full sprite onto the canvas, scaled to the canvas size.

Definition at line 98 of file canvas.c.

◆ gui_canvas_put_text()

void gui_canvas_put_text ( struct canvas pcanvas,
int  canvas_x,
int  canvas_y,
enum client_font  font,
struct color pcolor,
const char text 
)

Draw the text onto the canvas in the given color and font. The canvas position does not account for the ascent of the text; this function must take care of this manually. The text can't be nullptr but may be empty.

Definition at line 180 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_canvas_set_zoom()

void gui_canvas_set_zoom ( struct canvas store,
float  zoom 
)

Set canvas zoom for future drawing operations.

Definition at line 44 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_get_text_size()

void gui_get_text_size ( int width,
int height,
enum client_font  font,
const char text 
)

Return the size of the given text in the given font. This size should include the ascent and descent of the text. Either of width or height may be nullptr in which case those values simply shouldn't be filled out.

Definition at line 163 of file canvas.c.

Referenced by setup_gui_funcs().

◆ gui_has_zoom_support()

bool gui_has_zoom_support ( void  )

This gui has zoom support.

Definition at line 52 of file canvas.c.

Referenced by setup_gui_funcs().