xtd 0.2.0
Loading...
Searching...
No Matches

◆ g()

xtd::byte xtd::drawing::color::g ( ) const
noexcept

Gets the green component value of this xtd::drawing::color class.

Returns
byte The green component value of this xtd::drawing::color.
Remarks
The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). The alpha component specifies the transparency of the color: 0 is fully transparent, and 255 is fully opaque. Likewise, an xtd::drawing::color::a value of 255 represents an opaque color. An xtd::drawing::color::a value from 1 through 254 represents a semitransparent color. The color becomes more opaque as xtd::drawing::color::a approaches 255.
Examples
The following code example demonstrates the xtd::drawing::color::a, xtd::drawing::color::r, xtd::drawing::color::g, and xtd::drawing::color::b properties of a xtd::drawing::color, and the Implicit(size to size_f) member.
This example is designed to be used with a Windows Form (xtd::forms). Paste the code into the form and call the show_properties_of_slate_blue method from the form's xtd::forms::control::paint event-handling method, passing e as xtd::forms::paint_event_args.
void show_properties_of_slate_blue(xtd::forms::paint_event_args& e) {
byte g = slate_blue.g();
byte b = slate_blue.b();
byte r = slate_blue.r();
byte a = slate_blue.a();
string text = xtd::string::format("Slate blue has these ARGB values: alpha:{0}, red:{1}, green: {2}, blue {3}", a, r, g, b);
}
xtd::byte r() const noexcept
Gets the red component value of this xtd::drawing::color class.
static const xtd::drawing::color slate_blue
Gets a system-defined color that has an ARGB value of 0xFF6A5ACD. This field is constant.
Definition color.h:437
static xtd::drawing::color from_name(const xtd::string &name) noexcept
Creates a xtd::drawing::color class from the specified name of a predefined color.
xtd::byte g() const noexcept
Gets the green component value of this xtd::drawing::color class.
xtd::byte a() const noexcept
Gets the alpha component value of this xtd::drawing::color class.
xtd::byte b() const noexcept
Gets the blue component value of this xtd::drawing::color class.
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
Defines a particular format for text, including font face, size, and style attributes....
Definition font.h:45
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:35
Stores a set of four floating-point numbers that represent the location and size of a rectangle....
Definition rectangle_f.h:34
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.h:30
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
@ e
The E key.