xtd - Reference Guide 0.2.0
xtd::drawing::drawing2d::conical_gradient_brush Class Referencefinal

#include <conical_gradient_brush.h>

Definition

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

class drawing_export_ conical_gradient_brush final : public brush
Inheritance
xtd::objectxtd::drawing::brushxtd::drawing::drawing2d::conical_gradient_brush
Namespace
xtd::drawing::drawing2d
Library
xtd.drawing
conical_gradient_brush.png
Examples
The following code example demonstrates the use of conical_gradient_brush class.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::drawing::drawing2d;
using namespace xtd::forms;
namespace examples {
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().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().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:
image create_circle_texture(const color& fore_color, const color& back_color) {
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;
}
};
}
int main() {
application::run(examples::form1 {});
}
Examples:
fill_rectangle.cpp.

Constructors

 conical_gradient_brush ()
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with default values. More...
 
 conical_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::drawing2d::conical_gradient_brush class with the specified center point and colors. More...
 
 conical_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::drawing2d::conical_gradient_brush class with the specified center point and colors. More...
 
 conical_gradient_brush (const xtd::drawing::point &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float angle)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point ,colors and angle. More...
 
 conical_gradient_brush (const xtd::drawing::point_f &center, const xtd::drawing::color &color1, const xtd::drawing::color &color2, float angle)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point, colors and radiuus. More...
 
 conical_gradient_brush (const xtd::drawing::point &center, const std::vector< xtd::drawing::color > &conical_colors)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point and colors. More...
 
 conical_gradient_brush (const xtd::drawing::point_f &center, const std::vector< xtd::drawing::color > &conical_colors)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point and colors. More...
 
 conical_gradient_brush (const xtd::drawing::point &center, const std::vector< xtd::drawing::color > &conical_colors, float angle)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center poin, colors and angle. More...
 
 conical_gradient_brush (const xtd::drawing::point_f &center, const std::vector< xtd::drawing::color > &conical_colors, float angle)
 Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point, colors and angle. More...
 

Properties

float angle () const noexcept
 Gets the angle of the gradient. More...
 
conical_gradient_brushangle (float value) noexcept
 Sets the angle of the gradient. More...
 
xtd::drawing::point_f center_point () const noexcept
 Gets the center point of the conical gradient. More...
 
conical_gradient_brushcenter_point (const xtd::drawing::point_f &value) noexcept
 Gets the center point of the conical gradient. More...
 
conical_gradient_brushcenter_point (const xtd::drawing::point &value) noexcept
 Sets the center point of the conical gradient. More...
 
const xtd::drawing::drawing2d::gradient_stop_collectionconical_colors () const noexcept
 Gets the starting and ending colors of the gradient. More...
 
xtd::drawing::drawing2d::conical_gradient_brushconical_colors (const xtd::drawing::drawing2d::gradient_stop_collection &conical_colors)
 sets the starting and ending colors of the gradient. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ conical_gradient_brush() [1/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( )

Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with default values.

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

◆ conical_gradient_brush() [2/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_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::drawing2d::conical_gradient_brush class with the specified center point and colors.

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

◆ conical_gradient_brush() [3/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_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::drawing2d::conical_gradient_brush class with the specified center point and colors.

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

◆ conical_gradient_brush() [4/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point center,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
float  angle 
)

Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point ,colors and angle.

Parameters
centerA xtd::drawing::point structure that represents the center point of the conical gradient.
color1A xtd::drawing::color structure that represents the starting color of the conical gradient.
color2A xtd::drawing::color structure that represents the ending color of the conical gradient.
angleA float hat represents the angle of the conical gradient.

◆ conical_gradient_brush() [5/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point_f center,
const xtd::drawing::color color1,
const xtd::drawing::color color2,
float  angle 
)

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

Parameters
centerA xtd::drawing::point structure that represents the center point of the conical gradient.
color1A xtd::drawing::color structure that represents the starting color of the conical gradient.
color2A xtd::drawing::color structure that represents the ending color of the conical gradient.
angleA float hat represents the angle of the conical gradient.

◆ conical_gradient_brush() [6/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point center,
const std::vector< xtd::drawing::color > &  conical_colors 
)

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

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

◆ conical_gradient_brush() [7/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point_f center,
const std::vector< xtd::drawing::color > &  conical_colors 
)

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

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

◆ conical_gradient_brush() [8/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point center,
const std::vector< xtd::drawing::color > &  conical_colors,
float  angle 
)

Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center poin, colors and angle.

Parameters
centerA xtd::drawing::point structure that represents the center point of the conical gradient.
color1A xtd::drawing::color structure that represents the starting color of the conical gradient.
color2A xtd::drawing::color structure that represents the ending color of the conical gradient.
angleA float hat represents the angle of the conical gradient.

◆ conical_gradient_brush() [9/9]

xtd::drawing::drawing2d::conical_gradient_brush::conical_gradient_brush ( const xtd::drawing::point_f center,
const std::vector< xtd::drawing::color > &  conical_colors,
float  angle 
)

Initializes a new instance of the xtd::drawing::drawing2d::conical_gradient_brush class with the specified center point, colors and angle.

Parameters
centerA xtd::drawing::point structure that represents the center point of the conical gradient.
color1A xtd::drawing::color structure that represents the starting color of the conical gradient.
color2A xtd::drawing::color structure that represents the ending color of the conical gradient.
angleA float hat represents the angle of the conical gradient.

Member Function Documentation

◆ angle() [1/2]

float xtd::drawing::drawing2d::conical_gradient_brush::angle ( ) const
noexcept

Gets the angle of the gradient.

Returns
A float that specifies the angle of the conical gradient.
Remarks
The angle rotates in the clockwise direction. An angle of O° represents an angle from the center to the left. The angle turns in the clockwise direction. An angle of 90° represents an angle from the center downwards. An angle of 180° represents an angle from the center to the right. And so on.

◆ angle() [2/2]

conical_gradient_brush& xtd::drawing::drawing2d::conical_gradient_brush::angle ( float  value)
noexcept

Sets the angle of the gradient.

Parameters
valueA float that specifies the angle of the conicalconical gradient.
Returns
Current linear_gradient_brush instance.
Remarks
The angle rotates in the clockwise direction. An angle of O° represents an angle from the center to the left. The angle turns in the clockwise direction. An angle of 90° represents an angle from the center downwards. An angle of 180° represents an angle from the center to the right. And so on.

◆ center_point() [1/3]

xtd::drawing::point_f xtd::drawing::drawing2d::conical_gradient_brush::center_point ( ) const
noexcept

Gets the center point of the conical gradient.

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

◆ center_point() [2/3]

conical_gradient_brush& xtd::drawing::drawing2d::conical_gradient_brush::center_point ( const xtd::drawing::point_f value)
noexcept

Gets the center point of the conical gradient.

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

◆ center_point() [3/3]

conical_gradient_brush& xtd::drawing::drawing2d::conical_gradient_brush::center_point ( const xtd::drawing::point value)
noexcept

Sets the center point of the conical gradient.

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

◆ conical_colors() [1/2]

const xtd::drawing::drawing2d::gradient_stop_collection& xtd::drawing::drawing2d::conical_gradient_brush::conical_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.

◆ conical_colors() [2/2]

xtd::drawing::drawing2d::conical_gradient_brush& xtd::drawing::drawing2d::conical_gradient_brush::conical_colors ( const xtd::drawing::drawing2d::gradient_stop_collection conical_colors)

sets the starting and ending colors of the gradient.

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

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