Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
art_crop_attribution.cpp File Reference
#include "art_crop_attribution.h"
#include <QFontMetrics>
#include <QObject>
#include <QPainter>
#include <libcockatrice/card/printing/exact_card.h>
Include dependency graph for art_crop_attribution.cpp:

Functions

QString buildArtAttribution (const ExactCard &card)
 Builds an attribution caption for a cropped card art display.
QRectF paintArtAttribution (QPainter &painter, const QRectF &rect, const QString &attribution, Qt::Alignment anchor, qreal scale)
 Paints an attribution caption in a corner of a rect.

Function Documentation

◆ buildArtAttribution()

QString buildArtAttribution ( const ExactCard & card)

Builds an attribution caption for a cropped card art display.

When a card image's art region is shown cropped (an "art crop"), the artist should be credited in the same interface. Returns an empty string when the database has no artist data for the card.

Parameters
cardThe card whose art is being displayed.
Returns
Caption such as "Art: John Avon", or empty.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paintArtAttribution()

QRectF paintArtAttribution ( QPainter & painter,
const QRectF & rect,
const QString & attribution,
Qt::Alignment anchor = Qt::AlignRight|Qt::AlignBottom,
qreal scale = 1.0 )

Paints an attribution caption in a corner of a rect.

Draws a subtle semi-transparent pill containing the caption, elided to fit.

Parameters
painterPainter to draw with.
rectThe area (e.g. the cropped art region) the caption belongs to.
attributionCaption text (see buildArtAttribution()).
anchorCorner of rect to pin the pill to (default bottom-right).
scaleSize multiplier for the pill (e.g. 0.8 for a smaller pill).
Returns
The rect the pill was drawn in, or an empty rect if attribution is empty.
Here is the caller graph for this function: