Go to the documentation of this file.
20 #ifndef INCLUDE_WYKOBI_GRAPHICS_NET
21 #define INCLUDE_WYKOBI_GRAPHICS_NET
33 using namespace System;
34 using namespace System::Drawing;
41 const unsigned int& h)
42 : gc_(gc), width_(w), height_(h) {
43 pen_ =
gcnew Pen(System::Drawing::Color::Black, 1);
48 inline void set_pen(Pen ^ _pen)
const { pen_ = _pen; }
53 pen_->Width = float(w);
57 array<Single> ^ temp0 = {5.0F, 5.0F, 5.0F, 5.0F};
58 pen_->DashPattern = temp0;
62 array<Single> ^ temp0 = {1.0F, 0.0001F};
63 pen_->DashPattern = temp0;
66 inline void set_color(
const unsigned int& color)
const {
69 pen_->Color = System::Drawing::Color::Aqua;
72 pen_->Color = System::Drawing::Color::Black;
75 pen_->Color = System::Drawing::Color::Blue;
78 pen_->Color = System::Drawing::Color::Brown;
81 pen_->Color = System::Drawing::Color::Cyan;
84 pen_->Color = System::Drawing::Color::Gray;
87 pen_->Color = System::Drawing::Color::Green;
90 pen_->Color = System::Drawing::Color::Indigo;
93 pen_->Color = System::Drawing::Color::LimeGreen;
96 pen_->Color = System::Drawing::Color::Magenta;
99 pen_->Color = System::Drawing::Color::Orange;
102 pen_->Color = System::Drawing::Color::Purple;
105 pen_->Color = System::Drawing::Color::Red;
108 pen_->Color = System::Drawing::Color::Violet;
111 pen_->Color = System::Drawing::Color::White;
114 pen_->Color = System::Drawing::Color::Yellow;
119 inline unsigned int width()
const {
return width_; }
120 inline unsigned int height()
const {
return height_; }
121 inline unsigned int center_x()
const {
return width_ * 0.5; }
122 inline unsigned int center_y()
const {
return height_ * 0.5; }
125 gc_->DrawLine(pen_,
float(x),
float(y),
float(x + 1.0f),
float(y + 1.0f));
129 draw_pixel(point.
x, point.
y);
134 gc_->DrawLine(pen_,
float(x1),
float(y1),
float(x2),
float(y2));
139 draw_segment(point1.
x, point1.
y, point2.
x, point2.
y);
142 inline void draw_line(
const T& x1,
const T& y1,
const T& x2,
151 draw_segment(0.0, c, width_, m * width_ + c);
153 draw_segment(x1, 0, x1, height_);
156 inline void draw_triangle(
const T& x1,
const T& y1,
const T& x2,
const T& y2,
157 const T& x3,
const T& y3)
const {
158 draw_segment(x1, y1, x2, y2);
159 draw_segment(x2, y2, x3, y3);
160 draw_segment(x3, y3, x1, y1);
165 gc_->DrawRectangle(pen_,
float(x1),
float(y1), fabs(
float(x2 - x1)),
166 fabs(
float(y2 - y1)));
169 inline void draw_quadix(
const T& x1,
const T& y1,
const T& x2,
const T& y2,
170 const T& x3,
const T& y3,
const T& x4,
172 draw_segment(x1, y1, x2, y2);
173 draw_segment(x2, y2, x3, y3);
174 draw_segment(x3, y3, x4, y4);
175 draw_segment(x4, y4, x1, y1);
178 inline void draw_circle(
const T& x,
const T& y,
const T& radius)
const {
179 gc_->DrawEllipse(pen_,
float(x - radius),
float(y - radius),
180 float(2.0f * radius),
float(2.0f * radius));
184 draw_circle(center.
x, center.
y, radius);
188 for (std::size_t i = 0; i < point_list.size() - 1; ++i) {
189 draw_segment(point_list[i], point_list[i + 1]);
194 for (std::size_t i = 0; i < point_list.size() - 1; ++i) {
195 draw_segment(point_list[i], point_list[i + 1]);
200 draw_segment(p.
x - r, p.
y, p.
x + r, p.
y);
201 draw_segment(p.
x, p.
y - r, p.
x, p.
y + r);
204 inline void clear(System::Drawing::Color color)
const { gc_->Clear(color); }
206 inline void clear()
const {
clear(System::Drawing::Color::White); }
208 inline void clear(
const unsigned int& color)
const {
211 clear(System::Drawing::Color::Aqua);
214 clear(System::Drawing::Color::Black);
217 clear(System::Drawing::Color::Blue);
220 clear(System::Drawing::Color::Brown);
223 clear(System::Drawing::Color::Cyan);
226 clear(System::Drawing::Color::Gray);
229 clear(System::Drawing::Color::Green);
232 clear(System::Drawing::Color::Indigo);
235 clear(System::Drawing::Color::LimeGreen);
238 clear(System::Drawing::Color::Magenta);
241 clear(System::Drawing::Color::Orange);
244 clear(System::Drawing::Color::Purple);
247 clear(System::Drawing::Color::Red);
250 clear(System::Drawing::Color::Violet);
253 clear(System::Drawing::Color::White);
256 clear(System::Drawing::Color::Yellow);
259 clear(System::Drawing::Color::White);
265 draw_pixel(point.
x, point.
y);
304 const std::size_t& point_count)
const {
305 std::vector<point2d<T> > point_list;
306 point_list.reserve(point_count);
311 draw_polyline(point_list);
315 const std::size_t& point_count)
const {
316 std::vector<point2d<T> > point_list;
317 point_list.reserve(point_count);
322 draw_polyline(point_list);
325 template <
typename InputIterator>
326 inline void draw(
const InputIterator begin,
const InputIterator end)
const {
327 for (InputIterator it = begin; it != end; ++it) {
332 const static unsigned int clAqua = 0;
333 const static unsigned int clBlack = 1;
334 const static unsigned int clBlue = 2;
335 const static unsigned int clBrown = 3;
336 const static unsigned int clCyan = 4;
337 const static unsigned int clGray = 5;
338 const static unsigned int clGreen = 6;
339 const static unsigned int clIndigo = 7;
340 const static unsigned int clLimeGreen = 8;
341 const static unsigned int clMagenta = 9;
342 const static unsigned int clOrange = 10;
343 const static unsigned int clPurple = 11;
344 const static unsigned int clRed = 12;
345 const static unsigned int clViolet = 13;
346 const static unsigned int clWhite = 14;
347 const static unsigned int clYellow = 15;
351 unsigned int height_;
353 gcroot<Graphics ^> gc_;
Definition: wykobi.hpp:263
unsigned int width() const
Definition: wykobi_graphics_net.hpp:119
T radius
Definition: wykobi.hpp:428
Definition: wykobi.hpp:468
void draw(const quadix< T, 2 > &quadix) const
Definition: wykobi_graphics_net.hpp:282
void draw(const triangle< T, 2 > &triangle) const
Definition: wykobi_graphics_net.hpp:272
void draw_pixel(const point2d< T > &point) const
Definition: wykobi_graphics_net.hpp:128
Definition: wykobi.hpp:426
Definition: wykobi.hpp:383
~wykobi_graphics_net()
Definition: wykobi_graphics_net.hpp:46
void draw(const point2d< T > &point) const
Definition: wykobi_graphics_net.hpp:264
void draw_polyline(const std::vector< point3d< T > > &point_list) const
Definition: wykobi_graphics_net.hpp:193
Definition: wykobi.hpp:335
float get_pen_width() const
Definition: wykobi_graphics_net.hpp:50
std::size_t size() const
Definition: wykobi.hpp:412
Definition: wykobi_graphics_net.hpp:38
unsigned int center_x() const
Definition: wykobi_graphics_net.hpp:121
void set_nodash_mode() const
Definition: wykobi_graphics_net.hpp:61
T y
Definition: wykobi.hpp:104
wykobi_graphics_net(Graphics ^ gc, const unsigned int &w, const unsigned int &h)
Definition: wykobi_graphics_net.hpp:40
void draw(const InputIterator begin, const InputIterator end) const
Definition: wykobi_graphics_net.hpp:326
void clear(System::Drawing::Color color) const
Definition: wykobi_graphics_net.hpp:204
unsigned int height() const
Definition: wykobi_graphics_net.hpp:120
T x
Definition: wykobi.hpp:428
void draw(const segment< T, 2 > &segment) const
Definition: wykobi_graphics_net.hpp:268
Definition: wykobi.hpp:74
void set_color(const unsigned int &color) const
Definition: wykobi_graphics_net.hpp:66
T y
Definition: wykobi.hpp:428
void draw_polyline(const std::vector< point2d< T > > &point_list) const
Definition: wykobi_graphics_net.hpp:187
void draw_circle(const T &x, const T &y, const T &radius) const
Definition: wykobi_graphics_net.hpp:178
void set_dash_mode() const
Definition: wykobi_graphics_net.hpp:56
unsigned int center_y() const
Definition: wykobi_graphics_net.hpp:122
void draw(const polygon< T, 2 > &polygon) const
Definition: wykobi_graphics_net.hpp:291
Definition: wykobi.hpp:359
Definition: wykobi.hpp:311
void set_pen_width(const unsigned int &w) const
Definition: wykobi_graphics_net.hpp:52
void draw(const quadratic_bezier< T, 2 > &bezier, const std::size_t &point_count) const
Definition: wykobi_graphics_net.hpp:314
void draw_quadix(const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3, const T &x4, const T &y4) const
Definition: wykobi_graphics_net.hpp:169
void draw_circle(const point2d< T > center, const T &radius) const
Definition: wykobi_graphics_net.hpp:183
void draw(const circle< T > &circle) const
Definition: wykobi_graphics_net.hpp:287
Definition: wykobi.hpp:32
void draw(const rectangle< T > &rectangle) const
Definition: wykobi_graphics_net.hpp:277
T x
Definition: wykobi.hpp:104
Definition: wykobi.hpp:493
void draw_line(const T &x1, const T &y1, const T &x2, const T &y2) const
Definition: wykobi_graphics_net.hpp:142
void draw_triangle(const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3) const
Definition: wykobi_graphics_net.hpp:156
void clear(const unsigned int &color) const
Definition: wykobi_graphics_net.hpp:208
void draw_pixel(const T &x, const T &y) const
Definition: wykobi_graphics_net.hpp:124
void draw_crosshair(const point2d< T > &p, const T r) const
Definition: wykobi_graphics_net.hpp:199
void generate_bezier(const quadratic_bezier< T, 2 > &bezier, OutputIterator out, const std::size_t &point_count=1000)
void set_pen(Pen ^ _pen) const
Definition: wykobi_graphics_net.hpp:48
void draw_segment(const T &x1, const T &y1, const T &x2, const T &y2) const
Definition: wykobi_graphics_net.hpp:132
Definition: wykobi.hpp:108
void draw(const cubic_bezier< T, 2 > &bezier, const std::size_t &point_count) const
Definition: wykobi_graphics_net.hpp:303
void clear() const
Definition: wykobi_graphics_net.hpp:206
void draw_rectangle(const T &x1, const T &y1, const T &x2, const T &y2) const
Definition: wykobi_graphics_net.hpp:163
void draw_segment(const point2d< T > &point1, const point2d< T > &point2) const
Definition: wykobi_graphics_net.hpp:137