Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ZoneLabelTexture.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorRendering/phosphorrendering_export.h>
7
8#include <QImage>
9#include <QMetaType>
10#include <QPoint>
11#include <QSize>
12#include <QVector>
13
14namespace PhosphorRendering {
15
19{
20 QImage image;
21 QPoint dest;
22
23 bool operator==(const ZoneLabelTile& other) const
24 {
25 // dest first: a cheap mismatch short-circuits the deep QImage pixel
26 // compare in the common "tiles moved" case.
27 return dest == other.dest && image == other.image;
28 }
29 bool operator!=(const ZoneLabelTile& other) const
30 {
31 return !(*this == other);
32 }
33};
34
46{
47 QSize size;
48 QVector<ZoneLabelTile> tiles;
49
51 bool isEmpty() const
52 {
53 return tiles.isEmpty() || size.isEmpty();
54 }
55
59 bool operator==(const ZoneLabelTexture& other) const
60 {
61 return size == other.size && tiles == other.tiles;
62 }
63 bool operator!=(const ZoneLabelTexture& other) const
64 {
65 return !(*this == other);
66 }
67
71 PHOSPHORRENDERING_EXPORT QImage toImage() const;
72
78 PHOSPHORRENDERING_EXPORT static ZoneLabelTexture fromImage(const QImage& image);
79};
80
81} // namespace PhosphorRendering
82
Definition ShaderCompiler.h:15
Sparse zone-labels payload: the full screen-addressed texture size plus only the glyph tiles that act...
Definition ZoneLabelTexture.h:46
QSize size
Full screen-addressed texture size the tiles composite into.
Definition ZoneLabelTexture.h:47
static PHOSPHORRENDERING_EXPORT ZoneLabelTexture fromImage(const QImage &image)
Wrap a full-size image as a single tile at (0,0).
QVector< ZoneLabelTile > tiles
Sparse glyph tiles; empty ⇒ no labels (transparent everywhere).
Definition ZoneLabelTexture.h:48
bool operator!=(const ZoneLabelTexture &other) const
Definition ZoneLabelTexture.h:63
bool isEmpty() const
No glyphs to show (numbers disabled, no zones, or degenerate size).
Definition ZoneLabelTexture.h:51
bool operator==(const ZoneLabelTexture &other) const
Value equality — lets consumers (e.g.
Definition ZoneLabelTexture.h:59
PHOSPHORRENDERING_EXPORT QImage toImage() const
Composite the sparse tiles into one full screen-addressed image (ARGB32-premultiplied).
One rendered zone-label glyph (number) plus where its top-left sits in the full, screen-addressed lab...
Definition ZoneLabelTexture.h:19
bool operator==(const ZoneLabelTile &other) const
Definition ZoneLabelTexture.h:23
bool operator!=(const ZoneLabelTile &other) const
Definition ZoneLabelTexture.h:29
QImage image
Small ARGB32-premultiplied glyph tile (glyph bounds + outline margin).
Definition ZoneLabelTexture.h:20
QPoint dest
Top-left of image within the screen-addressed labels texture.
Definition ZoneLabelTexture.h:21