xtd 0.2.0
graphics_path.h
Go to the documentation of this file.
1 #pragma once
5 #include "../../drawing_export.h"
6 #include "../font_family.h"
7 #include "../font_style.h"
8 #include "../rectangle.h"
9 #include "../rectangle_f.h"
10 #include "../string_format.h"
11 #include "drawing2d.h"
12 #include "fill_mode.h"
13 #include <xtd/object>
14 #include <xtd/ustring>
15 #include <cstdint>
16 #include <memory>
17 #include <ostream>
18 
20 namespace xtd {
22  namespace drawing {
24  namespace drawing_2d {
36  class drawing_export_ graphics_path final : public xtd::object, xtd::iequatable<graphics_path> {
37  struct data;
38 
39  public:
41 
43  graphics_path();
48 
52  ~graphics_path();
54 
56 
60  intptr handle() const noexcept;
61 
62 
70 
72 
80  void add_arc(const xtd::drawing::rectangle& rect, float start_angle, float sweep_angle);
87  void add_arc(const xtd::drawing::rectangle_f& rect, float start_angle, float sweep_angle);
97  void add_arc(int32 x, int32 y, int32 width, int32 height, float start_angle, float sweep_angle);
107  void add_arc(float x, float y, float width, float height, float start_angle, float sweep_angle);
108 
116  void add_bezier(const xtd::drawing::point& pt1, const xtd::drawing::point& pt2, const xtd::drawing::point& pt3, const xtd::drawing::point& pt4);
124  void add_bezier(const xtd::drawing::point_f& pt1, const xtd::drawing::point_f& pt2, const xtd::drawing::point_f& pt3, const xtd::drawing::point_f& pt4);
136  void add_bezier(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, int32 x4, int32 y4);
148  void add_bezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
149 
154  void add_beziers(const std::vector<xtd::drawing::point>& points);
159  void add_beziers(const std::vector<xtd::drawing::point_f>& points);
160 
164  void add_closed_curve(const std::vector<xtd::drawing::point>& points);
168  void add_closed_curve(const std::vector<xtd::drawing::point_f>& points);
173  void add_closed_curve(const std::vector<xtd::drawing::point>& points, float tension);
178  void add_closed_curve(const std::vector<xtd::drawing::point_f>& points, float tension);
179 
184  void add_curve(const std::vector<xtd::drawing::point>& points);
188  void add_curve(const std::vector<xtd::drawing::point_f>& points);
193  void add_curve(const std::vector<xtd::drawing::point>& points, float tension);
198  void add_curve(const std::vector<xtd::drawing::point_f>& points, float tension);
206  void add_curve(const std::vector<xtd::drawing::point>& points, size_t offset, size_t number_of_segments, float tension);
214  void add_curve(const std::vector<xtd::drawing::point_f>& points, size_t offset, size_t number_of_segments, float tension);
215 
218  void add_ellipse(const xtd::drawing::rectangle& rect);
221  void add_ellipse(const xtd::drawing::rectangle_f& rect);
227  void add_ellipse(int32 x, int32 y, int32 width, int32 height);
233  void add_ellipse(float x, float y, float width, float height);
234 
239  void add_line(const xtd::drawing::point& pt1, const xtd::drawing::point& pt2);
244  void add_line(const xtd::drawing::point_f& pt1, const xtd::drawing::point_f& pt2);
251  void add_line(int32 x1, int32 y1, int32 x2, int32 y2);
258  void add_line(float x1, float y1, float x2, float y2);
259 
263  void add_lines(const std::vector<xtd::drawing::point>& points);
267  void add_lines(const std::vector<xtd::drawing::point_f>& points);
268 
272  void add_path(const graphics_path& adding_path, bool connect);
273 
279  void add_pie(const xtd::drawing::rectangle& rect, float start_angle, float sweep_angle);
285  void add_pie(const xtd::drawing::rectangle_f& rect, float start_angle, float sweep_angle);
294  void add_pie(int32 x, int32 y, int32 width, int32 height, float start_angle, float sweep_angle);
303  void add_pie(float x, float y, float width, float height, float start_angle, float sweep_angle);
304 
308  void add_polygon(const std::vector<xtd::drawing::point>& points);
312  void add_polygon(const std::vector<xtd::drawing::point_f>& points);
313 
316  void add_rectangle(const xtd::drawing::rectangle& rect);
319  void add_rectangle(const xtd::drawing::rectangle_f& rect);
325  void add_rectangle(int32 x, int32 y, int32 width, int32 height);
331  void add_rectangle(float x, float y, float width, float height);
332 
335  void add_rectangles(const std::vector<xtd::drawing::rectangle>& rects);
338  void add_rectangles(const std::vector<xtd::drawing::rectangle_f>& rects);
339 
343  void add_rounded_rectangle(const xtd::drawing::rectangle& rect, float radius);
347  void add_rounded_rectangle(const xtd::drawing::rectangle_f& rect, float radius);
354  void add_rounded_rectangle(int32 x, int32 y, int32 width, int32 height, float radius);
361  void add_rounded_rectangle(float x, float y, float width, float height, float radius);
362 
369  void add_string(const xtd::ustring& s, const xtd::drawing::font_family& family, xtd::drawing::font_style style, float em_size, const xtd::drawing::point& origin, const xtd::drawing::string_format& format);
376  void add_string(const xtd::ustring& s, const xtd::drawing::font_family& family, xtd::drawing::font_style style, float em_size, const xtd::drawing::point_f& origin, const xtd::drawing::string_format& format);
383  void add_string(const xtd::ustring& s, const xtd::drawing::font_family& family, xtd::drawing::font_style style, float em_size, const xtd::drawing::rectangle& layout_rect, const xtd::drawing::string_format& format);
390  void add_string(const xtd::ustring& s, const xtd::drawing::font_family& family, xtd::drawing::font_style style, float em_size, const xtd::drawing::rectangle_f& layout_rect, const xtd::drawing::string_format& format);
391 
393  void close_all_figures();
394 
396  void close_figure();
397 
398  bool equals(const xtd::drawing::drawing_2d::graphics_path& value) const noexcept override;
399 
401  void flatten();
402 
406  xtd::drawing::rectangle_f get_bounds() const;
407 
410  xtd::drawing::point_f get_lat_point() const;
411 
415  bool is_vsible(const xtd::drawing::point& point) const;
419  bool is_vsible(const xtd::drawing::point_f& point) const;
424  bool is_vsible(int32 x, int32 y) const;
429  bool is_vsible(float x, float y) const;
430 
432  void reset();
433 
435  void reverse();
436 
440  void start_figure();
441 
442  xtd::ustring to_string() const noexcept override;
444 
445  private:
446  void recreate_handle();
447 
448  std::shared_ptr<data> data_;
449  };
450  }
451  }
452 }
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
Defines a group of type faces having a similar basic design and certain variations in styles...
Definition: font_family.h:38
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Stores a set of four floating-point numbers that represent the location and size of a rectangle...
Definition: rectangle_f.h:34
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
fill_mode
Specifies how the interior of a closed path is filled.
Definition: fill_mode.h:24
Contains xtd::drawing::drawing_2d/::fill_mode enum class.
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition: point_f.h:35
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:44
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
font_style
Specifies style information applied to text. This enumeration has a flags attribute that allows a bit...
Definition: font_style.h:17
Contains xtd::drawing::drawing_2d/::matrix class.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics_path.h:36
Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulat...
Definition: string_format.h:30