xtd 0.2.0
xtd::drawing::drawing_2d::radial_gradient_brush Class Referencefinal
Inheritance diagram for xtd::drawing::drawing_2d::radial_gradient_brush:
xtd::drawing::brush xtd::object xtd::iequatable< brush > xtd::interface xtd::extensions::equality_operators< brush, iequatable< brush > >

Definition

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

Namespace
xtd::drawing::drawing_2d
Library
xtd.drawing
Examples
The following code example demonstrates the use of radial_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 {
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 {});
}
static const xtd::drawing::color transparent
Gets a system-defined color that has an ARGB value of 0x00000000. This field is constant.
Definition color.hpp:56
static const xtd::drawing::color white
Gets a system-defined color that has an ARGB value of 0xFFFFFFFF. This field is constant.
Definition color.hpp:470
static const xtd::drawing::color navy
Gets a system-defined color that has an ARGB value of 0xFF000080. This field is constant.
Definition color.hpp:344
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:32
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:29
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
void on_paint(paint_event_args &e) override
Raises the xtd::forms::control::paint event.
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.hpp:30
@ e
The E key.
Definition console_key.hpp:96
@ point
Specifies a printer's point (1/72 inch) as the unit of measure.
Definition graphics_unit.hpp:25
The xtd::drawing::drawing_2d namespace provides advanced two-dimensional and vector graphics function...
Definition compositing_mode.hpp:12
The xtd::drawing::text namespace provides advanced GDI+ typography functionality.
Definition font_collection.hpp:14
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44
Examples
fill_ellipse.cpp, fill_rectangle.cpp, fill_rounded_rectangle.cpp, form_paint.cpp, and graphics.cpp.

Public Constructors

 radial_gradient_brush ()
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with default values.
 
 radial_gradient_brush (const xtd::drawing::point &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.
 
 radial_gradient_brush (const xtd::drawing::point_f &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.
 
 radial_gradient_brush (const xtd::drawing::point &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float radius)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point ,colors and radius.
 
 radial_gradient_brush (const xtd::drawing::point_f &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float radius)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point, colors and radiuus.
 
 radial_gradient_brush (const xtd::drawing::point &center, const xtd::array< xtd::drawing::color > &radial_colors)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.
 
 radial_gradient_brush (const xtd::drawing::point_f &center, const xtd::array< xtd::drawing::color > &radial_colors)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.
 
 radial_gradient_brush (const xtd::drawing::point &center, const xtd::array< xtd::drawing::color > &radial_colors, float radius)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center poin, colors and radius.
 
 radial_gradient_brush (const xtd::drawing::point_f &center, const xtd::array< xtd::drawing::color > &radial_colors, float radius)
 Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point, colors and radius.
 

Public Properties

xtd::drawing::point_f center_point () const noexcept
 Gets the center point of the radial gradient.
 
radial_gradient_brushcenter_point (const xtd::drawing::point_f &value) noexcept
 Gets the center point of the radial gradient.
 
radial_gradient_brushcenter_point (const xtd::drawing::point &value) noexcept
 Sets the center point of the radial gradient.
 
xtd::drawing::point_f focal_point () const noexcept
 Gets the focal point of the radial gradient.
 
radial_gradient_brushfocal_point (const xtd::drawing::point_f &value) noexcept
 Sets the focal point of the radial gradient.
 
radial_gradient_brushfocal_point (const xtd::drawing::point &value) noexcept
 Sets the focal point of the radial gradient.
 
const xtd::drawing::drawing_2d::gradient_stop_collectionradial_colors () const noexcept
 Gets the starting and ending colors of the gradient.
 
xtd::drawing::drawing_2d::radial_gradient_brushradial_colors (const xtd::drawing::drawing_2d::gradient_stop_collection &radial_colors)
 sets the starting and ending colors of the gradient.
 
float radius () const noexcept
 Gets the angle of the gradient.
 
radial_gradient_brushradius (float value) noexcept
 Sets the radius of the gradient.
 

Additional Inherited Members

intptr handle () const noexcept
 Gets the handle of the brush.
 
bool equals (const xtd::object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const brush &other) const noexcept override
 Determines whether the specified object is equal to the current object.
 
xtd::size get_hash_code () const noexcept override
 Serves as a hash function for a particular type.
 
xtd::string to_string () const noexcept override
 Converts this brush object to a human-readable string.
 
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual bool equals (const brush &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
template<class object_a_t, class 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<class object_a_t, class 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.
 
 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

◆ radial_gradient_brush() [1/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( )

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

Remarks
Center and focal points are set to {0, 0} and colors are set with two transparent colors.

◆ radial_gradient_brush() [2/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point & center,
const xtd::drawing::color & color1,
const xtd::drawing::color & color2 )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.

◆ radial_gradient_brush() [3/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point_f & center,
const xtd::drawing::color & color1,
const xtd::drawing::color & color2 )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.

◆ radial_gradient_brush() [4/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point & center,
const xtd::drawing::color & color1,
const xtd::drawing::color & color2,
float radius )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point ,colors and radius.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.
radiusA float hat represents the radius of the radial gradient.

◆ radial_gradient_brush() [5/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point_f & center,
const xtd::drawing::color & color1,
const xtd::drawing::color & color2,
float radius )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point, colors and radiuus.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.
radiusA float hat represents the radius of the radial gradient.

◆ radial_gradient_brush() [6/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point & center,
const xtd::array< xtd::drawing::color > & radial_colors )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.

◆ radial_gradient_brush() [7/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point_f & center,
const xtd::array< xtd::drawing::color > & radial_colors )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point and colors.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.

◆ radial_gradient_brush() [8/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point & center,
const xtd::array< xtd::drawing::color > & radial_colors,
float radius )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center poin, colors and radius.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.
radiusA float hat represents the radius of the radial gradient.

◆ radial_gradient_brush() [9/9]

xtd::drawing::drawing_2d::radial_gradient_brush::radial_gradient_brush ( const xtd::drawing::point_f & center,
const xtd::array< xtd::drawing::color > & radial_colors,
float radius )

Initializes a new instance of the xtd::drawing::drawing_2d::radial_gradient_brush class with the specified center point, colors and radius.

Parameters
centerA xtd::drawing::point structure that represents the center point of the radial gradient.
color1A xtd::drawing::color structure that represents the starting color of the radial gradient.
color2A xtd::drawing::color structure that represents the ending color of the radial gradient.
radiusA float hat represents the radius of the radial gradient.

Member Function Documentation

◆ center_point() [1/3]

xtd::drawing::point_f xtd::drawing::drawing_2d::radial_gradient_brush::center_point ( ) const
noexcept

Gets the center point of the radial gradient.

Returns
A xtd::drawing::point_f structure that specifies the center point of the radial gradient.

◆ center_point() [2/3]

radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::center_point ( const xtd::drawing::point_f & value)
noexcept

Gets the center point of the radial gradient.

Parameters
valueA xtd::drawing::point_f structure that specifies the center point of the radial gradient.
Returns
This current instance.

◆ center_point() [3/3]

radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::center_point ( const xtd::drawing::point & value)
noexcept

Sets the center point of the radial gradient.

Parameters
valueA xtd::drawing::point_f structure that specifies the center point of the radial gradient.
Returns
This current instance.

◆ focal_point() [1/3]

xtd::drawing::point_f xtd::drawing::drawing_2d::radial_gradient_brush::focal_point ( ) const
noexcept

Gets the focal point of the radial gradient.

Returns
A xtd::drawing::point_f structure that specifies the focal point of the radial gradient.

◆ focal_point() [2/3]

radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::focal_point ( const xtd::drawing::point_f & value)
noexcept

Sets the focal point of the radial gradient.

Parameters
valueA xtd::drawing::point_f structure that specifies the focal point of the radial gradient.
Returns
This current instance.

◆ focal_point() [3/3]

radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::focal_point ( const xtd::drawing::point & value)
noexcept

Sets the focal point of the radial gradient.

Parameters
valueA xtd::drawing::point_f structure that specifies the focal point of the radial gradient.
Returns
This current instance.

◆ radial_colors() [1/2]

const xtd::drawing::drawing_2d::gradient_stop_collection & xtd::drawing::drawing_2d::radial_gradient_brush::radial_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 gradient.

◆ radial_colors() [2/2]

xtd::drawing::drawing_2d::radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::radial_colors ( const xtd::drawing::drawing_2d::gradient_stop_collection & radial_colors)

sets the starting and ending colors of the gradient.

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

◆ radius() [1/2]

float xtd::drawing::drawing_2d::radial_gradient_brush::radius ( ) const
noexcept

Gets the angle of the gradient.

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

◆ radius() [2/2]

radial_gradient_brush & xtd::drawing::drawing_2d::radial_gradient_brush::radius ( float value)
noexcept

Sets the radius of the gradient.

Parameters
valueA float that specifies the radius of the radial gradient.
Returns
Current linear_gradient_brush instance.

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