19#include <QFontMetrics>
21#include <QPainterPath>
79 int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
92 p.drawPixmap(dest_rect, src->
map_pixmap, source_rect);
100void pixmap_copy(QPixmap *dest, QPixmap *src,
int src_x,
int src_y,
112 p.drawPixmap(dest_rect, *src, source_rect);
119void image_copy(QImage *dest, QImage *src,
int src_x,
int src_y,
131 p.drawImage(dest_rect, *src, source_rect);
176 p.setCompositionMode(QPainter::CompositionMode_Difference);
191 QBrush brush(
pcolor->qcolor);
200 }
else if (
width == 1) {
228 enum line_type ltype,
int start_x,
int start_y,
234 pen.setColor(
pcolor->qcolor);
241 pen.setStyle(Qt::DashLine);
242 pen.setDashOffset(4);
258 p.setRenderHint(QPainter::Antialiasing);
259 p.drawLine(start_x, start_y, start_x + dx, start_y + dy);
267 enum line_type ltype,
int start_x,
int start_y,
271 pen.setColor(
pcolor->qcolor);
280 pen.setStyle(Qt::DashLine);
281 pen.setDashOffset(4);
296 p.setRenderHints(QPainter::Antialiasing);
299 path.moveTo(start_x, start_y);
300 path.cubicTo(start_x + dx / 2, start_y, start_x, start_y + dy / 2,
301 start_x + dx, start_y + dy);
318 fm =
new QFontMetrics(*afont);
320 *
width = fm->horizontalAdvance(QString::fromUtf8(text));
346 fm =
new QFontMetrics(*afont);
367 if (
gui()->map_scale != 1.0f &&
gui()->map_font_scale) {
369 if (qf->pointSize() != ssize) {
370 qf->setPointSize(ssize);
376 if (
gui()->map_scale != 1.0f &&
gui()->map_font_scale) {
378 if (qf->pointSize() != ssize) {
379 qf->setPointSize(ssize);
412 row = (QRgb *)
fc_malloc(
sizeof(QRgb) * ow);
414 for (
int y = 0; y < oh; y++) {
415 bool row_filled =
false;
420 memcpy(row, p.scanLine(y), ow *
sizeof(QRgb));
422 for (x = 0; x < ow; ++x) {
423 if (qAlpha(row[x])) {
440 return QRect(l, t, qMax(0, r - l + 1), qMax(0, b - t + 1));
QRect zealous_crop_rect(QImage &p)
void qtg_get_text_size(int *width, int *height, enum client_font font, const char *text)
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_fill_sprite_area(struct canvas *pcanvas, struct sprite *psprite, struct color *pcolor, int canvas_x, int canvas_y)
void qtg_canvas_put_text(struct canvas *pcanvas, int canvas_x, int canvas_y, enum client_font font, struct color *pcolor, const char *text)
bool qtg_has_zoom_support()
void qtg_canvas_put_sprite_full(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite)
void qtg_canvas_free(struct canvas *store)
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_canvas_put_line(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
struct canvas * qtg_canvas_create(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_copy(struct canvas *dest, struct canvas *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
void qtg_canvas_put_rectangle(struct canvas *pcanvas, struct color *pcolor, int canvas_x, int canvas_y, int width, int height)
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 pixmap_copy(QPixmap *dest, QPixmap *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
void qtg_canvas_set_zoom(struct canvas *store, float zoom)
void qtg_canvas_mapview_init(struct canvas *store)
static QFont * get_font(enum client_font font)
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
struct canvas int int struct sprite bool int fog_x
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color int int canvas_y struct canvas struct color enum line_type ltype int start_x int start_y int dx int dy enum client_font
struct canvas int int struct sprite int int int width
struct canvas int int struct sprite * psprite
struct canvas int int struct sprite int int offset_y
struct canvas int int struct sprite int offset_x
struct canvas int int struct sprite bool fog
static fc_font * instance()
QFont * get_font(QString name)
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
const char *const city_productions
const char *const city_names
const char *const reqtree_text