Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
playmat_utils.h File Reference
#include <QRectF>
#include <QSize>
#include <QSizeF>
#include <libcockatrice/deck_list/deck_list.h>
Include dependency graph for playmat_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  PlaymatUtils

Functions

qreal PlaymatUtils::playmatVisibleWidth (const QSize &fullCardSize, const PlaymatParams &params)
 Width of the outer viewing window: full card width trimmed by the horizontal margins. Guarded against margins summing to >= 1.
qreal PlaymatUtils::playmatClampedZoom (const QSize &fullCardSize, const PlaymatParams &params)
 Zoom clamped to the range where every step renders differently.
qreal PlaymatUtils::playmatWindowSide (const QSize &fullCardSize, const PlaymatParams &params)
 Side of the square sampling window actually rendered for these parameters. Never exceeds either card dimension, so the source rect always lies within the image (vertical travel remains for panning whenever the art is taller than it is wide).
QRectF PlaymatUtils::computeArtSourceRect (const QSize &fullCardSize, const PlaymatParams &params)
 Computes the source region of the full resolution card image to use as a playmat.
QRectF PlaymatUtils::coverFitRect (const QRectF &dstArea, const QSizeF &srcSize)
 Returns the destination rectangle that fits a source of the given aspect ratio into dstArea using "cover" semantics (no distortion, overflows cropped).
QRectF PlaymatUtils::aspectFitRect (const QRectF &dstArea, qreal aspect)
 Fits a rectangle of the given aspect ratio into dstArea, centered, touching the constraining dimension ("aspect fit" of the FRAME itself, not of a source image).

Variables

constexpr qreal PlaymatUtils::MAX_ZOOM = 4.0
 Upper bound for zooming into the playmat art.