Freeciv-3.1
|
#include <QFontMetrics>
#include <QPainter>
#include <QPainterPath>
#include "canvas.h"
#include "colors.h"
#include "fc_client.h"
#include "fonts.h"
#include "qtg_cxxside.h"
#include "sprite.h"
Go to the source code of this file.
Functions | |
static QFont * | get_font (enum client_font font) |
struct canvas * | qtg_canvas_create (int width, int height) |
void | qtg_canvas_free (struct canvas *store) |
void | qtg_canvas_set_zoom (struct canvas *store, float zoom) |
bool | qtg_has_zoom_support () |
void | qtg_canvas_mapview_init (struct canvas *store) |
void | qtg_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 | pixmap_copy (QPixmap *dest, QPixmap *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height) |
void | image_copy (QImage *dest, QImage *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height) |
void | qtg_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 | qtg_canvas_put_sprite_full (struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite) |
void | qtg_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 | qtg_canvas_put_rectangle (struct canvas *pcanvas, struct color *pcolor, int canvas_x, int canvas_y, int width, int height) |
void | qtg_canvas_fill_sprite_area (struct canvas *pcanvas, struct sprite *psprite, struct color *pcolor, int canvas_x, int canvas_y) |
void | qtg_canvas_put_line (struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy) |
void | qtg_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 | qtg_get_text_size (int *width, int *height, enum client_font font, const char *text) |
void | qtg_canvas_put_text (struct canvas *pcanvas, int canvas_x, int canvas_y, enum client_font font, struct color *pcolor, const char *text) |
QRect | zealous_crop_rect (QImage &p) |
|
static |
Returns given font
Definition at line 359 of file canvas.cpp.
Referenced by apply_font(), chatwdg::chatwdg(), city_dialog::city_dialog(), fc_client::init(), qtg_canvas_put_text(), qtg_get_text_size(), and fc_sidewidget::update_fonts().
void image_copy | ( | QImage * | dest, |
QImage * | src, | ||
int | src_x, | ||
int | src_y, | ||
int | dest_x, | ||
int | dest_y, | ||
int | width, | ||
int | height | ||
) |
Copies an area from the source image to the destination image.
Definition at line 119 of file canvas.cpp.
Referenced by minimap_thread::run().
void pixmap_copy | ( | QPixmap * | dest, |
QPixmap * | src, | ||
int | src_x, | ||
int | src_y, | ||
int | dest_x, | ||
int | dest_y, | ||
int | width, | ||
int | height | ||
) |
Copies an area from the source pixmap to the destination pixmap.
Definition at line 100 of file canvas.cpp.
Referenced by impr_item::enterEvent(), impr_item::impr_item(), impr_item::leaveEvent(), minimap_thread::run(), progress_bar::set_pixmap(), and progress_bar::set_pixmap().
void qtg_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 78 of file canvas.cpp.
Referenced by city_map::set_pixmap(), and setup_gui_funcs().
struct canvas * qtg_canvas_create | ( | int | width, |
int | height | ||
) |
Create a canvas of the given size.
Definition at line 35 of file canvas.cpp.
Referenced by city_map::city_map(), units_select::create_pixmap(), impr_item::enterEvent(), impr_item::impr_item(), hud_unit_combat::init_images(), impr_item::leaveEvent(), choice_dialog::next_unit(), choice_dialog::prev_unit(), research_diagram::reset(), choice_dialog::set_layout(), city_map::set_pixmap(), help_widget::set_topic_extra(), help_widget::set_topic_unit(), setup_gui_funcs(), ss_report::ss_report(), terrain_canvas(), unit_item::unit_item(), and hud_units::update_actions().
void qtg_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 214 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_canvas_free | ( | struct canvas * | store | ) |
Free any resources associated with this canvas and the canvas struct itself.
Definition at line 47 of file canvas.cpp.
Referenced by units_select::create_pixmap(), choice_dialog::next_unit(), choice_dialog::prev_unit(), choice_dialog::set_layout(), city_map::set_pixmap(), help_widget::set_topic_extra(), help_widget::set_topic_terrain(), help_widget::set_topic_unit(), setup_gui_funcs(), hud_units::update_actions(), city_map::~city_map(), and ss_report::~ss_report().
void qtg_canvas_mapview_init | ( | struct canvas * | store | ) |
Initialize canvas as mapview.
Definition at line 71 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 266 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 227 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 185 of file canvas.cpp.
Referenced by qtg_canvas_fill_sprite_area(), and setup_gui_funcs().
void qtg_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 138 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 168 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 153 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 will not be NULL but may be empty.
Definition at line 334 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_canvas_set_zoom | ( | struct canvas * | store, |
float | zoom | ||
) |
Set canvas zoom for future drawing operations.
Definition at line 55 of file canvas.cpp.
Referenced by setup_gui_funcs().
void qtg_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 NULL in which case those values simply shouldn't be filled out.
Definition at line 311 of file canvas.cpp.
Referenced by setup_gui_funcs().
bool qtg_has_zoom_support | ( | ) |
This gui has zoom support.
Definition at line 63 of file canvas.cpp.
Referenced by setup_gui_funcs().
QRect zealous_crop_rect | ( | QImage & | p | ) |
Return rectangle containing pure image (crops transparency)
Definition at line 399 of file canvas.cpp.
Referenced by units_select::create_pixmap(), hud_unit_combat::init_images(), progress_bar::set_pixmap(), unit_item::unit_item(), unittype_item::unittype_item(), and hud_units::update_actions().