sf::Color Class Reference
Utility class for manpulating RGBA colors.
More...
#include <Color.hpp>
List of all members.
Public Member Functions |
| Color () |
| Default constructor.
|
| Color (Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255) |
| Construct the color from its 4 RGBA components.
|
Public Attributes |
Uint8 | r |
| Red component.
|
Uint8 | g |
| Green component.
|
Uint8 | b |
| Blue component.
|
Uint8 | a |
| Alpha (opacity) component.
|
Static Public Attributes |
static const Color | Black |
| Black predefined color.
|
static const Color | White |
| White predefined color.
|
static const Color | Red |
| Red predefined color.
|
static const Color | Green |
| Green predefined color.
|
static const Color | Blue |
| Blue predefined color.
|
static const Color | Yellow |
| Yellow predefined color.
|
static const Color | Magenta |
| Magenta predefined color.
|
static const Color | Cyan |
| Cyan predefined color.
|
Detailed Description
Utility class for manpulating RGBA colors.
sf::Color is a simple color class composed of 4 components:
- Red
- Green
- Blue
- Alpha (opacity)
Each component is a public member, an unsigned integer in the range [0, 255]. Thus, colors can be constructed and manipulated very easily:
sf::Color c1(255, 0, 0);
c1.red = 0;
c1.blue = 128;
The fourth component of colors, named "alpha", represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components.
The most common colors are already defined as static variables:
Colors can also be added and modulated (multiplied) using the overloaded operators + and *.
Definition at line 40 of file Color.hpp.
Constructor & Destructor Documentation
Default constructor.
Constructs an opaque black color. It is equivalent to sf::Color(0, 0, 0, 255).
Definition at line 48 of file Color.cpp.
sf::Color::Color |
( |
Uint8 |
red, |
|
|
Uint8 |
green, |
|
|
Uint8 |
blue, |
|
|
Uint8 |
alpha = 255 | |
|
) |
| | |
Construct the color from its 4 RGBA components.
- Parameters:
-
| red | Red component (in the range [0, 255]) |
| green | Green component (in the range [0, 255]) |
| blue | Blue component (in the range [0, 255]) |
| alpha | Alpha (opacity) component (in the range [0, 255]) |
Definition at line 59 of file Color.cpp.
Member Data Documentation
Alpha (opacity) component.
Definition at line 82 of file Color.hpp.
Blue component.
Definition at line 81 of file Color.hpp.
Black predefined color.
Definition at line 67 of file Color.hpp.
Blue predefined color.
Definition at line 71 of file Color.hpp.
Cyan predefined color.
Definition at line 74 of file Color.hpp.
Green component.
Definition at line 80 of file Color.hpp.
Green predefined color.
Definition at line 70 of file Color.hpp.
Magenta predefined color.
Definition at line 73 of file Color.hpp.
Red component.
Definition at line 79 of file Color.hpp.
Red predefined color.
Definition at line 69 of file Color.hpp.
White predefined color.
Definition at line 68 of file Color.hpp.
Yellow predefined color.
Definition at line 72 of file Color.hpp.
The documentation for this class was generated from the following files: