MCPcopy Create free account
hub / github.com/SFML/SFML / Color

Class Color

include/SFML/Graphics/Color.hpp:39–100  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// \brief Utility class for manipulating RGBA colors ///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

37///
38////////////////////////////////////////////////////////////
39class Color
40{
41public:
42 ////////////////////////////////////////////////////////////
43 /// \brief Default constructor
44 ///
45 /// Constructs an opaque black color. It is equivalent to
46 /// `sf::Color(0, 0, 0, 255)`.
47 ///
48 ////////////////////////////////////////////////////////////
49 constexpr Color() = default;
50
51 ////////////////////////////////////////////////////////////
52 /// \brief Construct the color from its 4 RGBA components
53 ///
54 /// \param red Red component (in the range [0, 255])
55 /// \param green Green component (in the range [0, 255])
56 /// \param blue Blue component (in the range [0, 255])
57 /// \param alpha Alpha (opacity) component (in the range [0, 255])
58 ///
59 ////////////////////////////////////////////////////////////
60 constexpr Color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha = 255);
61
62 ////////////////////////////////////////////////////////////
63 /// \brief Construct the color from 32-bit unsigned integer
64 ///
65 /// \param color Number containing the RGBA components (in that order)
66 ///
67 ////////////////////////////////////////////////////////////
68 constexpr explicit Color(std::uint32_t color);
69
70 ////////////////////////////////////////////////////////////
71 /// \brief Retrieve the color as a 32-bit unsigned integer
72 ///
73 /// \return Color represented as a 32-bit unsigned integer
74 ///
75 ////////////////////////////////////////////////////////////
76 [[nodiscard]] constexpr std::uint32_t toInteger() const;
77
78 ////////////////////////////////////////////////////////////
79 // Static member data
80 ////////////////////////////////////////////////////////////
81 // NOLINTBEGIN(readability-identifier-naming)
82 static const Color Black; //!< Black predefined color
83 static const Color White; //!< White predefined color
84 static const Color Red; //!< Red predefined color
85 static const Color Green; //!< Green predefined color
86 static const Color Blue; //!< Blue predefined color
87 static const Color Yellow; //!< Yellow predefined color
88 static const Color Magenta; //!< Magenta predefined color
89 static const Color Cyan; //!< Cyan predefined color
90 static const Color Transparent; //!< Transparent (black) predefined color
91 // NOLINTEND(readability-identifier-naming)
92
93 ////////////////////////////////////////////////////////////
94 // Member data
95 ////////////////////////////////////////////////////////////
96 std::uint8_t r{}; //!< Red component

Callers 9

mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
getHighlandsTerrainColorFunction · 0.50
mainFunction · 0.50
updateGlyphBoxMethod · 0.50
generateEffectDataMethod · 0.50
preProcessGlyphMethod · 0.50
updateRainbowTextMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected