107 int mask_offset_x,
int mask_offset_y,
108 float scale,
bool smooth)
127 widthzoom = ceil(
width * scale) + hex;
128 heightzoom = ceil(
height * scale) + hex;
130 cropped->
pm =
new QPixmap(widthzoom, heightzoom);
131 cropped->
pm->fill(Qt::transparent);
133 dest_rect = QRectF(0, 0, widthzoom, heightzoom);
135 p.begin(cropped->
pm);
137 p.setRenderHint(QPainter::SmoothPixmapTransform);
139 p.setRenderHint(QPainter::Antialiasing);
140 p.drawPixmap(dest_rect, *
source->pm, source_rect);
144 int mw = mask->
pm->width();
145 int mh = mask->
pm->height();
147 source_rect = QRectF(0, 0, mw, mh);
148 dest_rect = QRectF(mask_offset_x - x, mask_offset_y - y, mw, mh);
149 p.begin(cropped->
pm);
150 p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
151 p.setRenderHint(QPainter::Antialiasing);
152 p.setRenderHint(QPainter::SmoothPixmapTransform);
153 p.drawPixmap(dest_rect, *mask->
pm, source_rect);
204 if (
gui()->map_scale != 1.0f &&
gui()->map_font_scale) {
207 if (qf->pointSize() != ssize) {
208 qf->setPointSize(ssize);
212 QFontMetrics fm(*qf);
215 ns = QString::number(num);
223 u8
"\0xF0\0x9F\0x84\0x8C",
247 ns = QString((
const char *)numsbuf[num]);
250 w = fm.horizontalAdvance(ns);
252 pm =
new QPixmap(w, h);
253 pm->fill(Qt::transparent);
258 paint.setBrush(Qt::transparent);
259 paint.setPen(QColor(Qt::black));
260 paint.drawText(QRect(0, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
261 QString((
const char *)u8
"\u26AB"));
264 paint.setPen(QColor(Qt::yellow));
265 paint.drawText(QRect(-2, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
266 QString((
const char *)u8
"\u2B24"));
267 paint.drawText(QRect(4, -2, w, h), Qt::AlignLeft | Qt::AlignVCenter,
268 QString((
const char *)u8
"\u2B24"));
269 paint.drawText(QRect(4, 2, w, h), Qt::AlignLeft | Qt::AlignVCenter,
270 QString((
const char *)u8
"\u2B24"));
271 paint.drawText(QRect(8, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
272 QString((
const char *)u8
"\u2B24"));
275 ns = QString(numsbuf[num]);
278 w = fm.horizontalAdvance(ns);
280 pm =
new QPixmap(w, h);
281 pm->fill(Qt::transparent);
286 paint.setBrush(Qt::transparent);
287 paint.setPen(QColor(Qt::black));
288 paint.drawText(QRect(0, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
289 QString(u8
"\u26AB"));
292 paint.setPen(QColor(Qt::yellow));
293 paint.drawText(QRect(-2, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
294 QString(u8
"\u2B24"));
295 paint.drawText(QRect(4, -2, w, h), Qt::AlignLeft | Qt::AlignVCenter,
296 QString(u8
"\u2B24"));
297 paint.drawText(QRect(4, 2, w, h), Qt::AlignLeft | Qt::AlignVCenter,
298 QString(u8
"\u2B24"));
299 paint.drawText(QRect(8, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter,
300 QString(u8
"\u2B24"));
304 paint.setPen(QColor((num > 20) ? Qt::black : Qt::yellow));
305 paint.drawText(QRect(0, 0, w, h), Qt::AlignLeft | Qt::AlignVCenter, ns);
struct sprite * qtg_crop_sprite(struct sprite *source, int x, int y, int width, int height, struct sprite *mask, int mask_offset_x, int mask_offset_y, float scale, bool smooth)