xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Classes | Public Member Functions | List of all members
xtd::drawing::drawing2d::hatch_brush Class Referencefinal

#include <hatch_brush.h>

Definition

Defines a rectangular xtd::drawing::brush with a hatch style, a foreground color, and a background color. This class cannot be inherited.

Namespace
xtd::drawing::drawing2d
Library
xtd.drawing
Remarks
The following illustration shows an ellipse filled with a horizontal hatch pattern.
Examples
The following code example demonstrate the use of hatch_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({340, 230});
}
protected:
void on_paint(paint_event_args& e) override {
e.graphics().fill_rectangle(brushes::transparent(), 10, 10, 100, 100);
e.graphics().fill_rectangle(solid_brush(color::red), 120, 10, 100, 100);
e.graphics().fill_rectangle(linear_gradient_brush(rectangle(230, 10, 100, 100), color::green, color::white, linear_gradient_mode::horizontal), 230, 10, 100, 100);
e.graphics().fill_rectangle(hatch_brush(hatch_style::diagonal_brick, color::blue, color::white), 10, 120, 100, 100);
e.graphics().fill_rectangle(texture_brush(create_circle_texture(color::yellow)), 120, 120, 100, 100);
form::on_paint(e);
}
private:
image create_circle_texture(const color& color) {
auto texture = bitmap(16, 16);
auto graphics = texture.create_graphics();
graphics.fill_ellipse(solid_brush(color), 0, 0, texture.width() - 1, texture.height() - 1);
graphics.draw_ellipse(pens::black(), 0, 0, texture.width() - 1, texture.height() - 1);
return texture;
}
};
}
int main() {
application::run(examples::form1());
}
static xtd::drawing::solid_brush transparent()
A system-defined brush object.
static const xtd::drawing::color yellow
Gets a system-defined color that has an ARGB value of 0xFFFFFF00. This field is constant.
Definition: color.h:465
static const xtd::drawing::color white
Gets a system-defined color that has an ARGB value of 0xFFFFFFFF. This field is constant.
Definition: color.h:459
static const xtd::drawing::color green
Gets a system-defined color that has an ARGB value of 0xFF008000. This field is constant.
Definition: color.h:201
static const xtd::drawing::color red
Gets a system-defined color that has an ARGB value of 0xFFFF0000. This field is constant.
Definition: color.h:390
static const xtd::drawing::color blue
Gets a system-defined color that has an ARGB value of 0xFF0000FF. This field is constant.
Definition: color.h:75
hatch_brush()
Initializes a new instance of the hatch_brush class.
static xtd::drawing::pen black()
A system-defined pen object with a width of 1.
@ e
The E key.
@ horizontal
Specifies a gradient from left to right.
@ diagonal_brick
Specifies a hatch that has the appearance of layered bricks that slant to the left from top points to...
The xtd::.drawing::drawing2d namespace provides advanced two-dimensional and vector graphics function...
Definition: hatch_brush.h:19
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition: bitmap.h:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17

Inherits xtd::drawing::brush.

Public Member Functions

 hatch_brush ()
 Initializes a new instance of the hatch_brush class. More...
 
 hatch_brush (xtd::drawing::drawing2d::hatch_style hatch_style, const xtd::drawing::color &fore_color)
 Initializes a new instance of the xtd::drawing::drawing2d::hatch_brush class with the specified xtd::drawing::drawing2d::hatch_style enumeration and foreground color. More...
 
 hatch_brush (xtd::drawing::drawing2d::hatch_style hatch_style, const xtd::drawing::color &fore_color, const xtd::drawing::color &back_color)
 Initializes a new instance of the xtd::drawing::drawing2d::hatch_brush class with the specified xtd::drawing::drawing2d::hatch_style enumeration, foreground color and background color. More...
 
xtd::drawing::color background_color () const
 Gets the color of spaces between the hatch lines drawn by this hatch_brush object. More...
 
xtd::drawing::color foreground_color () const
 Gets the color of hatch lines drawn by this hatch_brush object. More...
 
xtd::drawing::drawing2d::hatch_style hatch_style () const
 Gets the hatch style of this hatch_brush object. More...
 
- Public Member Functions inherited from xtd::drawing::brush
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...
 

Additional Inherited Members

- 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

◆ hatch_brush() [1/3]

xtd::drawing::drawing2d::hatch_brush::hatch_brush ( )

Initializes a new instance of the hatch_brush class.

◆ hatch_brush() [2/3]

xtd::drawing::drawing2d::hatch_brush::hatch_brush ( xtd::drawing::drawing2d::hatch_style  hatch_style,
const xtd::drawing::color fore_color 
)
inline

Initializes a new instance of the xtd::drawing::drawing2d::hatch_brush class with the specified xtd::drawing::drawing2d::hatch_style enumeration and foreground color.

Parameters
hatch_styleOne of the xtd::drawing::drawing2d::hatch_style values that represents the pattern drawn by this xtd::drawing::drawing2d::hatch_brush.
fore_colorThe xtd::drawing::color structure that represents the color of lines drawn by this xtd::drawing::drawing2d::hatch_brush.
Remarks
The background color is initialized to black.

◆ hatch_brush() [3/3]

xtd::drawing::drawing2d::hatch_brush::hatch_brush ( xtd::drawing::drawing2d::hatch_style  hatch_style,
const xtd::drawing::color fore_color,
const xtd::drawing::color back_color 
)

Initializes a new instance of the xtd::drawing::drawing2d::hatch_brush class with the specified xtd::drawing::drawing2d::hatch_style enumeration, foreground color and background color.

Parameters
hatch_styleOne of the xtd::drawing::drawing2d::hatch_style values that represents the pattern drawn by this xtd::drawing::drawing2d::hatch_brush.
fore_colorThe xtd::drawing::color structure that represents the color of lines drawn by this xtd::drawing::drawing2d::hatch_brush.
back_colorThe xtd::drawing::color structure that represents the color of spaces between the lines drawn by this xtd::drawing::drawing2d::hatch_brush.

Member Function Documentation

◆ background_color()

xtd::drawing::color xtd::drawing::drawing2d::hatch_brush::background_color ( ) const
inline

Gets the color of spaces between the hatch lines drawn by this hatch_brush object.

Returns
A xtd::drawing::color structure that represents the background color for this hatch_brush.

◆ foreground_color()

xtd::drawing::color xtd::drawing::drawing2d::hatch_brush::foreground_color ( ) const
inline

Gets the color of hatch lines drawn by this hatch_brush object.

Returns
A xtd::drawing::color structure that represents the foreground color for this hatch_brush.

◆ hatch_style()

xtd::drawing::drawing2d::hatch_style xtd::drawing::drawing2d::hatch_brush::hatch_style ( ) const
inline

Gets the hatch style of this hatch_brush object.

Returns
One of the xtd::drawing::drawing2d::hatch_style values that represents the pattern of this hatch_brush.

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