xtd 1.0.0
Loading...
Searching...
No Matches
xtd::drawing::solid_brush Class Referencefinal
Inheritance diagram for xtd::drawing::solid_brush:
xtd::drawing::brush xtd::object xtd::iequatable< brush > xtd::interface xtd::extensions::equality_operators< brush, iequatable< brush > >

Definition

Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes, such as rectangles, ellipses, pies, polygons, and paths. This class cannot be inherited.

Defines objects used to fill the interiors of graphical shapes such as rectangles,...
Definition brush.hpp:33
solid_brush()
Initializes a new xtd::drawing::solid_brush object with xtd::drawing::color::black.
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
Inheritance
xtd::objectxtd::drawing::brushxtd::drawing::solid_brush
Namespace
xtd::drawing
Library
xtd.drawing
Examples
The following code example demonstrates the use of solid_brush class.
#include <xtd/xtd>
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(drawing_2d::hatch_brush {drawing_2d::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(drawing_2d::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(drawing_2d::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(drawing_2d::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 {});
}
@ 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::text namespace provides advanced GDI+ typography functionality.
Definition font_collection.hpp:14
Remarks
This class inherits from the xtd::drawing::brush class.
Examples
hello_world_png.cpp.

Public Constructors

 solid_brush ()
 Initializes a new xtd::drawing::solid_brush object with xtd::drawing::color::black.
 solid_brush (const xtd::drawing::color &color)
 Initializes a new xtd::drawing::solid_brush object of the specified color.

Public Properties

auto color () const noexcept -> const xtd::drawing::color &
 Gets the color of this xtd::drawing::solid_brush object.
auto color (const xtd::drawing::color &value) noexcept -> xtd::drawing::solid_brush &
 Sets the color of this xtd::drawing::solid_brush object.

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ solid_brush() [1/2]

xtd::drawing::solid_brush::solid_brush ( )

Initializes a new xtd::drawing::solid_brush object with xtd::drawing::color::black.

◆ solid_brush() [2/2]

xtd::drawing::solid_brush::solid_brush ( const xtd::drawing::color & color)
explicit

Initializes a new xtd::drawing::solid_brush object of the specified color.

Parameters
colorA xtd::drawing::color structure that represents the color of this brush.

Member Function Documentation

◆ color() [1/2]

auto xtd::drawing::solid_brush::color ( ) const -> const xtd::drawing::color &
nodiscardnoexcept

Gets the color of this xtd::drawing::solid_brush object.

Returns
A xtd::drawing::color structure that represents the color of this brush.

◆ color() [2/2]

auto xtd::drawing::solid_brush::color ( const xtd::drawing::color & value) -> xtd::drawing::solid_brush &
noexcept

Sets the color of this xtd::drawing::solid_brush object.

Parameters
valueA xtd::drawing::color structure that represents the color of this brush.
Returns
This current instance.

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