| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#include "textproperties.h" |
| 7 |
|
| 8 |
#include <algorithm> |
| 9 |
|
| 10 |
namespace Avogadro::Rendering { |
| 11 |
|
| 12 |
TextProperties::TextProperties() |
| 13 |
: m_pixelHeight(24), m_hAlign(HLeft), m_vAlign(VTop), |
| 14 |
m_rotationDegreesCW(0.f), m_fontFamily(SansSerif), m_fontStyles(NoFontStyle) |
| 15 |
{ |
| 16 |
setColorRgba(255, 255, 255, 255); |
| 17 |
} |
| 18 |
|
| 19 |
TextProperties::TextProperties(const TextProperties& other) |
| 20 |
: m_pixelHeight(other.m_pixelHeight), m_hAlign(other.m_hAlign), |
| 21 |
m_vAlign(other.m_vAlign), m_rotationDegreesCW(other.m_rotationDegreesCW), |
| 22 |
m_fontFamily(other.m_fontFamily), m_fontStyles(other.m_fontStyles) |
| 23 |
{ |
| 24 |
m_rgba[0] = other.m_rgba[0]; |
| 25 |
m_rgba[1] = other.m_rgba[1]; |
| 26 |
m_rgba[2] = other.m_rgba[2]; |
| 27 |
m_rgba[3] = other.m_rgba[3]; |
| 28 |
} |
| 29 |
|
| 30 |
TextProperties::~TextProperties() {} |
| 31 |
|
| 32 |
TextProperties& TextProperties::operator=(TextProperties other) |
| 33 |
{ |
| 34 |
swap(other); |
| 35 |
return *this; |
| 36 |
} |
| 37 |
|
| 38 |
void TextProperties::swap(TextProperties& other) |
| 39 |
{ |
| 40 |
using std::swap; |
| 41 |
swap(m_pixelHeight, other.m_pixelHeight); |
| 42 |
swap(m_hAlign, other.m_hAlign); |
| 43 |
swap(m_vAlign, other.m_vAlign); |
| 44 |
swap(m_rotationDegreesCW, other.m_rotationDegreesCW); |
| 45 |
swap(m_fontFamily, other.m_fontFamily); |
| 46 |
swap(m_fontStyles, other.m_fontStyles); |
| 47 |
swap(m_rgba[0], other.m_rgba[0]); |
| 48 |
swap(m_rgba[1], other.m_rgba[1]); |
| 49 |
swap(m_rgba[2], other.m_rgba[2]); |
| 50 |
swap(m_rgba[3], other.m_rgba[3]); |
| 51 |
} |
| 52 |
|
| 53 |
bool TextProperties::operator==(const TextProperties& other) const |
| 54 |
{ |
| 55 |
return m_pixelHeight == other.m_pixelHeight && m_hAlign == other.m_hAlign && |
| 56 |
m_vAlign == other.m_vAlign && |
| 57 |
m_rotationDegreesCW == other.m_rotationDegreesCW && |
| 58 |
m_fontFamily == other.m_fontFamily && |
| 59 |
m_fontStyles == other.m_fontStyles && m_rgba[0] == other.m_rgba[0] && |
| 60 |
m_rgba[1] == other.m_rgba[1] && m_rgba[2] == other.m_rgba[2] && |
| 61 |
m_rgba[3] == other.m_rgba[3]; |
| 62 |
} |
| 63 |
|
| 64 |
} // namespace Avogadro::Rendering |