25 #include <QFontMetrics>
27 #include <QPainterPath>
38 void pixmap_copy(QPixmap *dest,
const QPixmap *src,
int src_x,
int src_y,
39 int dest_x,
int dest_y,
int width,
int height)
41 QRectF source_rect(src_x, src_y, width, height);
42 QRectF dest_rect(dest_x, dest_y, width, height);
45 if (!width || !height) {
50 p.drawPixmap(dest_rect, *src, source_rect);
89 for (
int y = 0; y < p.height(); ++y) {
90 QRgb *row =
reinterpret_cast<QRgb *
>(p.scanLine(y));
91 bool row_filled =
false;
94 for (x = 0; x < p.width(); ++x) {
109 return QRect(l, t, qMax(0, r - l + 1), qMax(0, b - t + 1));
117 QImage
img = sprite->toImage();
119 QImage cropped_img =
img.copy(crop);
120 QPixmap pix = QPixmap::fromImage(cropped_img);
QRect zealous_crop_rect(QImage &p)
Return rectangle containing pure image (crops transparency)
void pixmap_copy(QPixmap *dest, const QPixmap *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
/ \ *********** / _ \ | / \ | Copyright (c) 1996-2023 Freeciv21 and || || _______ Freeciv contributor...
QFont get_font(client_font font)
Returns given font.
QPixmap crop_sprite(const QPixmap *sprite)
Helper function to crop a sprite.
QFont getFont(const QString &name, double zoom=1.0) const
Returns desired font.
static fcFont * instance()
Returns instance of fc_font.
const char *const city_productions
const char *const city_names
const char *const reqtree_text