#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>
namespace fill_rectangle_example {
class form1 :
public form {
public:
form1() {
text(
"Fill rectangle example");
client_size({680, 340});
}
protected:
e.graphics().draw_rectangle(
pen {fore_color, 4},
rectangle {10, 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(
linear_gradient_brush {
rectangle {180, 180, 150, 150}, back_color, fore_color, 315},
rectangle {180, 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();
return texture;
}
};
}
auto main() -> int {
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:46
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
Encapsulates a xtd::drawing::brush with a conical gradient. This class cannot be inherited.
Definition conical_gradient_brush.hpp:35
Defines a rectangular xtd::drawing::brush with a hatch style, a foreground color, and a background co...
Definition hatch_brush.hpp:31
Encapsulates a xtd::drawing::brush with a linear gradient. This class cannot be inherited.
Definition linear_gradient_brush.hpp:30
Encapsulates a xtd::drawing::brush with a radial gradient. This class cannot be inherited.
Definition radial_gradient_brush.hpp:29
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.hpp:67
void fill_ellipse(const xtd::drawing::brush &brush, const xtd::drawing::rectangle &rect)
Fills the interior of an ellipse defined by a bounding rectangle specified by a xtd::drawing::rectang...
void draw_ellipse(const xtd::drawing::pen &pen, const xtd::drawing::rectangle &rect)
Draws an ellipse specified by a bounding xtd::drawing::rectangle structure.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:32
float width() const noexcept
Gets the width of this xtd::drawing::pen, in units of the xtd::drawing::graphics object used for draw...
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:29
Each property of the xtd::drawing::texture_brush class is a xtd::drawing::brush object that uses an i...
Definition texture_brush.hpp:29
@ e
The E key.
Definition console_key.hpp:96
@ diagonal_brick
Specifies a hatch that has the appearance of layered bricks that slant to the left from top points to...
Definition hatch_style.hpp:136
The xtd::drawing::drawing_2d namespace provides advanced two-dimensional and vector graphics function...
Definition compositing_mode.hpp:12
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
Stores a set of four integers that represent the location and size of a rectangle.
Definition rectangle.hpp:44