xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::drawing_2d::linear_gradient_brush Class Referencefinal
Inheritance diagram for xtd::drawing::drawing_2d::linear_gradient_brush:
xtd::drawing::brush xtd::iequatable< linear_gradient_brush > xtd::object xtd::iequatable< brush > xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Encapsulates a xtd::drawing::brush with a linear gradient. This class cannot be inherited.

Namespace
xtd::drawing::drawing_2d
Library
xtd.drawing
Examples
The following code example demonstrates the use of linear_gradient_brush class.
#include <xtd/drawing/drawing_2d/conical_gradient_brush>
#include <xtd/drawing/drawing_2d/hatch_brush>
#include <xtd/drawing/drawing_2d/linear_gradient_brush>
#include <xtd/drawing/drawing_2d/radial_gradient_brush>
#include <xtd/drawing/solid_brush>
#include <xtd/drawing/texture_brush>
#include <xtd/forms/application>
#include <xtd/forms/form>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::drawing::drawing_2d;
using namespace xtd::forms;
namespace fill_rectangle_example {
class form1 : public form {
public:
form1() {
text("Fill rectangle example");
client_size({680, 340});
}
protected:
void on_paint(paint_event_args& e) override {
form::on_paint(e);
auto back_color = color::navy;
auto fore_color = color::white;
e.graphics().fill_rectangle(solid_brush {color::transparent}, rectangle {10, 10, 150, 150});
e.graphics().draw_rectangle(pen {fore_color, 4}, rectangle {10, 10, 150, 150});
e.graphics().fill_rectangle(solid_brush {back_color}, rectangle {180, 10, 150, 150});
e.graphics().draw_rectangle(pen {fore_color, 4}, rectangle {180, 10, 150, 150});
e.graphics().fill_rectangle(texture_brush {create_circle_texture(fore_color, back_color)}, rectangle {350, 10, 150, 150});
e.graphics().draw_rectangle(pen {fore_color, 4}, rectangle {350, 10, 150, 150});
e.graphics().fill_rectangle(hatch_brush {hatch_style::diagonal_brick, color::white, back_color}, rectangle {520, 10, 150, 150});
e.graphics().draw_rectangle(pen {color::white, 4}, rectangle {520, 10, 150, 150});
e.graphics().fill_rectangle(conical_gradient_brush {point {85, 255}, back_color, fore_color, 0}, rectangle {10, 180, 150, 150});
e.graphics().draw_rectangle(pen {color::white, 4}, rectangle {10, 180, 150, 150});
e.graphics().fill_rectangle(linear_gradient_brush {rectangle {180, 180, 150, 150}, back_color, fore_color, 315}, rectangle {180, 180, 150, 150});
e.graphics().draw_rectangle(pen {color::white, 4}, rectangle {180, 180, 150, 150});
e.graphics().fill_rectangle(radial_gradient_brush {point {425, 255}, fore_color, back_color, 73}, rectangle {350, 180, 150, 150});
e.graphics().draw_rectangle(pen {color::white, 4}, rectangle {350, 180, 150, 150});
}
private:
auto create_circle_texture(const color& fore_color, const color& back_color)->image {
auto texture = bitmap {16, 16};
auto graphics = texture.create_graphics();
graphics.fill_ellipse(solid_brush {back_color}, 1, 1, texture.width() - 2, texture.height() - 2);
graphics.draw_ellipse(pen {fore_color, 2}, 1, 1, texture.width() - 2, texture.height() - 2);
return texture;
}
};
}
auto main() -> int {
application::run(fill_rectangle_example::form1 {});
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:49
Encapsulates a xtd::drawing::brush with a conical gradient. This class cannot be inherited.
Definition conical_gradient_brush.hpp:35
Defines a rectangular xtd::drawing::brush with a hatch style, a foreground color, and a background co...
Definition hatch_brush.hpp:32
Encapsulates a xtd::drawing::brush with a linear gradient. This class cannot be inherited.
Definition linear_gradient_brush.hpp:31
Encapsulates a xtd::drawing::brush with a radial gradient. This class cannot be inherited.
Definition radial_gradient_brush.hpp:30
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp:70
void fill_ellipse(const xtd::drawing::brush &brush, const xtd::drawing::rectangle &rect)
Fills the interior of an ellipse defined by a bounding rectangle specified by a xtd::drawing::rectang...
void draw_ellipse(const xtd::drawing::pen &pen, const xtd::drawing::rectangle &rect)
Draws an ellipse specified by a bounding xtd::drawing::rectangle structure.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:35
float width() const noexcept
Gets the width of this xtd::drawing::pen, in units of the xtd::drawing::graphics object used for draw...
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:30
Each property of the xtd::drawing::texture_brush class is a xtd::drawing::brush object that uses an i...
Definition texture_brush.hpp:29
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.hpp:30
@ e
The E key.
The xtd::drawing::drawing_2d namespace provides advanced two-dimensional and vector graphics function...
Definition compositing_mode.hpp:12
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Examples
fill_ellipse.cpp, fill_rectangle.cpp, fill_rounded_rectangle.cpp, form_paint.cpp, graphics.cpp, and owner_button.cpp.

Public Constructors

 linear_gradient_brush ()
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with default values.
 
 linear_gradient_brush (const xtd::drawing::point &point1, const xtd::drawing::point &point2, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the linear_gradient_brush class with the specified points and colors.
 
 linear_gradient_brush (const xtd::drawing::point_f &point1, const xtd::drawing::point_f &point2, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the linear_gradient_brush class with the specified points and colors.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2, xtd::drawing::drawing_2d::linear_gradient_mode linear_gradient_mode)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float angle)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2, xtd::drawing::drawing_2d::linear_gradient_mode linear_gradient_mode)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float angle)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.
 
 linear_gradient_brush (const xtd::drawing::point &point1, const xtd::drawing::point &point2, const std::vector< xtd::drawing::color > &linear_colors)
 Initializes a new instance of the linear_gradient_brush class with the specified points and colors.
 
 linear_gradient_brush (const xtd::drawing::point_f &point1, const xtd::drawing::point_f &point2, const std::vector< xtd::drawing::color > &linear_colors)
 Initializes a new instance of the linear_gradient_brush class with the specified points and colors.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const std::vector< xtd::drawing::color > &linear_colors, xtd::drawing::drawing_2d::linear_gradient_mode linear_gradient_mode)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const std::vector< xtd::drawing::color > &linear_colors, float angle)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const std::vector< xtd::drawing::color > &linear_colors, xtd::drawing::drawing_2d::linear_gradient_mode linear_gradient_mode)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const std::vector< xtd::drawing::color > &linear_colors, float angle)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.
 
 linear_gradient_brush (const xtd::drawing::rectangle &rect, const std::vector< xtd::drawing::color > &linear_colors)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.
 
 linear_gradient_brush (const xtd::drawing::rectangle_f &rect, const std::vector< xtd::drawing::color > &linear_colors)
 Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.
 

Public Properties

float angle () const noexcept
 Gets the angle of the gradient.
 
linear_gradient_brushangle (float value) noexcept
 Sets the angle of the gradient.
 
const xtd::drawing::drawing_2d::gradient_stop_collectionlinear_colors () const noexcept
 Gets the starting and ending colors of the gradient.
 
xtd::drawing::drawing_2d::linear_gradient_brushlinear_colors (const xtd::drawing::drawing_2d::gradient_stop_collection &value)
 sets the starting and ending colors of the gradient.
 
const xtd::drawing::rectangle_frectangle () const noexcept
 Gets a rectangular region that defines the starting and ending points of the linear gradient.
 
linear_gradient_brushrectangle (const xtd::drawing::rectangle_f &value) noexcept
 Sets a rectangular region that defines the starting and ending points of the linear gradient.
 
linear_gradient_brushrectangle (const xtd::drawing::rectangle &value) noexcept
 Sets a rectangular region that defines the starting and ending points of the linear gradient.
 

Public Methods

bool equals (const linear_gradient_brush &value) const noexcept override
 
bool equals (const brush &value) const noexcept override
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::drawing::brush
intptr handle () const noexcept
 Gets the handle of the brush.
 
bool equals (const brush &value) const noexcept override
 
xtd::string to_string () const noexcept override
 Converts this brush object to a human-readable string.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< brush >
virtual bool equals (const brush &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::drawing::brush
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- Protected Member Functions inherited from xtd::drawing::brush
 brush ()
 Initialize a new instance of brush class.
 
void set_native_brush (intptr brush)
 In a derived class, sets a reference to a GDI+ brush object.
 

Constructor & Destructor Documentation

◆ linear_gradient_brush() [1/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with default values.

Remarks
Rectanlge is set to {0, 0, 0, 0} and colors are set with two transparent colors.

◆ linear_gradient_brush() [2/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::point point1,
const xtd::drawing::point point2,
const xtd::drawing::color color1,
const xtd::drawing::color color2 
)

Initializes a new instance of the linear_gradient_brush class with the specified points and colors.

Parameters
point1A xtd::drawing::point structure that represents the starting point of the linear gradient.
point2A xtd::drawing::point structure that represents the endpoint of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [3/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::point_f point1,
const xtd::drawing::point_f point2,
const xtd::drawing::color color1,
const xtd::drawing::color color2 
)

Initializes a new instance of the linear_gradient_brush class with the specified points and colors.

Parameters
point1A xtd::drawing::point_f structure that represents the starting point of the linear gradient.
point2A xtd::drawing::point_f structure that represents the endpoint of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [4/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
xtd::drawing::drawing_2d::linear_gradient_mode  linear_gradient_mode 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.

Parameters
rectA xtd::drawing::rectangle structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
linear_gradient_modeA xtd::drawing::drawing_2d::linear_gradient_mode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, xtd::drawing::drawing_2d::linear_gradient_mode::forward_diagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

◆ linear_gradient_brush() [5/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
float  angle 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.

Parameters
rectA xtd::drawing::rectangle structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
angleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

◆ linear_gradient_brush() [6/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
xtd::drawing::drawing_2d::linear_gradient_mode  linear_gradient_mode 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
linear_gradient_modeA xtd::drawing::drawing_2d::linear_gradient_mode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, xtd::drawing::drawing_2d::linear_gradient_mode::forward_diagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

◆ linear_gradient_brush() [7/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
float  angle 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
angleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

◆ linear_gradient_brush() [8/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [9/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const xtd::drawing::color color1,
const xtd::drawing::color color2 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [10/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::point point1,
const xtd::drawing::point point2,
const std::vector< xtd::drawing::color > &  linear_colors 
)

Initializes a new instance of the linear_gradient_brush class with the specified points and colors.

Parameters
point1A xtd::drawing::point structure that represents the starting point of the linear gradient.
point2A xtd::drawing::point structure that represents the endpoint of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [11/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::point_f point1,
const xtd::drawing::point_f point2,
const std::vector< xtd::drawing::color > &  linear_colors 
)

Initializes a new instance of the linear_gradient_brush class with the specified points and colors.

Parameters
point1A xtd::drawing::point_f structure that represents the starting point of the linear gradient.
point2A xtd::drawing::point_f structure that represents the endpoint of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [12/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const std::vector< xtd::drawing::color > &  linear_colors,
xtd::drawing::drawing_2d::linear_gradient_mode  linear_gradient_mode 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.

Parameters
rectA xtd::drawing::rectangle structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
linear_gradient_modeA xtd::drawing::drawing_2d::linear_gradient_mode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, xtd::drawing::drawing_2d::linear_gradient_mode::forward_diagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

◆ linear_gradient_brush() [13/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const std::vector< xtd::drawing::color > &  linear_colors,
float  angle 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.

Parameters
rectA xtd::drawing::rectangle structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
angleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

◆ linear_gradient_brush() [14/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const std::vector< xtd::drawing::color > &  linear_colors,
xtd::drawing::drawing_2d::linear_gradient_mode  linear_gradient_mode 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
linear_gradient_modeA xtd::drawing::drawing_2d::linear_gradient_mode enumeration element that specifies the orientation of the gradient. The orientation determines the starting and ending points of the gradient. For example, xtd::drawing::drawing_2d::linear_gradient_mode::forward_diagonal specifies that the starting point is the upper-left corner of the rectangle and the ending point is the lower-right corner of the rectangle.

◆ linear_gradient_brush() [15/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const std::vector< xtd::drawing::color > &  linear_colors,
float  angle 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle, colors, and orientation angle.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.
angleThe angle, measured in degrees clockwise from the x-axis, of the gradient's orientation line.

◆ linear_gradient_brush() [16/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle rect,
const std::vector< xtd::drawing::color > &  linear_colors 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

◆ linear_gradient_brush() [17/17]

xtd::drawing::drawing_2d::linear_gradient_brush::linear_gradient_brush ( const xtd::drawing::rectangle_f rect,
const std::vector< xtd::drawing::color > &  linear_colors 
)

Initializes a new instance of the linear_gradient_brush class with the specified rectangle and colors.

Parameters
rectA xtd::drawing::rectangle_f structure that specifies the bounds of the linear gradient.
color1A xtd::drawing::color structure that represents the starting color of the linear gradient.
color2A xtd::drawing::color structure that represents the ending color of the linear gradient.

Member Function Documentation

◆ angle() [1/2]

float xtd::drawing::drawing_2d::linear_gradient_brush::angle ( ) const
noexcept

Gets the angle of the gradient.

Returns
A float that specifies the angle of the linear gradient.

◆ angle() [2/2]

linear_gradient_brush & xtd::drawing::drawing_2d::linear_gradient_brush::angle ( float  value)
noexcept

Sets the angle of the gradient.

Parameters
valueA float that specifies the angle of the linear gradient.
Returns
Current linear_gradient_brush instance.

◆ linear_colors() [1/2]

const xtd::drawing::drawing_2d::gradient_stop_collection & xtd::drawing::drawing_2d::linear_gradient_brush::linear_colors ( ) const
noexcept

Gets the starting and ending colors of the gradient.

Returns
An array of two xtd::drawing::color structures that represents the starting and ending colors of the linear gradient.

◆ linear_colors() [2/2]

xtd::drawing::drawing_2d::linear_gradient_brush & xtd::drawing::drawing_2d::linear_gradient_brush::linear_colors ( const xtd::drawing::drawing_2d::gradient_stop_collection value)

sets the starting and ending colors of the gradient.

Parameters
valueAn array of two xtd::drawing::color structures that represents the starting and ending colors of the linear gradient.
Returns
Current linear_gradient_brush instance.

◆ rectangle() [1/3]

const xtd::drawing::rectangle_f & xtd::drawing::drawing_2d::linear_gradient_brush::rectangle ( ) const
noexcept

Gets a rectangular region that defines the starting and ending points of the linear gradient.

Returns
A xtd::drawing::rectangle_f structure that specifies the starting and ending points of the linear gradient.

◆ rectangle() [2/3]

linear_gradient_brush & xtd::drawing::drawing_2d::linear_gradient_brush::rectangle ( const xtd::drawing::rectangle_f value)
noexcept

Sets a rectangular region that defines the starting and ending points of the linear gradient.

Parameters
valueA xtd::drawing::rectangle_f structure that specifies the starting and ending points of the linear gradient.
Returns
Current linear_gradient_brush instance.

◆ rectangle() [3/3]

linear_gradient_brush & xtd::drawing::drawing_2d::linear_gradient_brush::rectangle ( const xtd::drawing::rectangle value)
noexcept

Sets a rectangular region that defines the starting and ending points of the linear gradient.

Parameters
valueA xtd::drawing::rectangle_f structure that specifies the starting and ending points of the linear gradient.
Returns
Current linear_gradient_brush instance.

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output :
//
// false
// false
// true
// true
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...

Reimplemented from xtd::drawing::brush.

◆ equals() [2/2]

template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals ( const object_a_t &  object_a,
const object_b_t &  object_b 
)
inlinestaticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Tom";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Carol";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
}
// This code produces the following output :
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.

The documentation for this class was generated from the following file: