|
constexpr | Color () noexcept=default |
| The default color is black with full opacity. More...
|
|
constexpr | Color (double grey, double alpha=255) noexcept |
| Note that if only one value is provided to Color, it will be interpreted as a grayscale value. Add a second value, and it will be used for alpha transparency. More...
|
|
constexpr | Color (double red, double green, double blue, double alpha=255) noexcept |
| When three values are specified, they are interpreted as RGB. Adding a fourth value applies alpha transparency. More...
|
|
Color is a color represented with four unsigned bytes.
It has the red, green, blue, and alpha color channels in the range of 0 to 255, where 255 is full intensity of the color channel, 128 is roughly half intensity and 0 is no intensity of the color channel. The alpha channel doesn't contribute light intensity but is used to define transparency. The alpha value also uses the range 0 to 255 to set the amount of transparency. The value 0 defines the color as entirely transparent (it won't display), the value 255 is entirely opaque, and the values between these extremes cause the colors to mix on the screen.
int main(void)
{
Color squareColor{100, 50, 150};
{
squareColor.alpha = 128 + 128.0 * std::sin(
ElapsedTime);
}
return 0;
}
void set_fill_color(HexColor color) noexcept
Sets the color used to fill shapes to the specified HexColor.
void no_outline()
Disables drawing the outline.
void set_outline_color(HexColor color) noexcept
Set the outline and lines of shapes to the specified HexColor.
void no_fill() noexcept
Disables filling geometry.
void clear_background() noexcept
Clear the background to black.
double ElapsedTime
Returns the number of seconds since starting the program. This information is often used for timing e...
bool create_window() noexcept
Create a default window.
int Width
System variable that stores the width of the drawing canvas. This value is set by the desired_width p...
bool is_window_closed() noexcept
Is the window closed?
int Height
System variable that stores the height of the drawing canvas. This value is set by the desired_height...
void update_window() noexcept
Update the doodle application.
void set_outline_width(double line_width) noexcept
Sets the width of the outline used for lines and the border around shapes. All widths are set in unit...
void draw_rectangle(double x, double y, double width, double height=0) noexcept
Draws a rectangle to the screen.
void draw_ellipse(double x, double y, double width, double height=0) noexcept
Draws an ellipse (oval) to the screen.
constexpr Color() noexcept=default
The default color is black with full opacity.
Definition at line 52 of file color.hpp.