The following code example demonstrate the use of brush classes.
#include <xtd/xtd>
namespace examples {
class form1 :
public form {
public:
form1() {
text("Fill rectangle example");
client_size({340, 230});
}
protected:
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:
auto texture =
bitmap(16, 16);
auto graphics = texture.create_graphics();
return texture;
}
};
}
int main() {
application::run(examples::form1());
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition: bitmap.h:19
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Defines a rectangular xtd::drawing::brush with a hatch style, a foreground color, and a background co...
Definition: hatch_brush.h:31
Encapsulates a xtd::drawing::brush with a linear gradient. This class cannot be inherited.
Definition: linear_gradient_brush.h:28
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:48
void draw_ellipse(const xtd::drawing::pen &pen, const xtd::drawing::rectangle &rect)
Draws an ellipse specified by a bounding xtd::drawing::rectangle structure.
Definition: graphics.h:142
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition: image.h:34
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:25
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition: solid_brush.h:22
Each property of the xtd::drawing::texture_brush class is a xtd::drawing::brush object that uses an i...
Definition: texture_brush.h:22
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 namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17