3636#define _IO2D_API
3737#endif
3838
39+ /*
3940namespace std::experimental::io2d {
4041 inline namespace v1 {
4142
@@ -59,21 +60,33 @@ namespace std::experimental::io2d {
5960 template <class T>
6061 constexpr T quarter_tau = T(1.57079632679489661923132169163975144L);
6162
62- }
63- }
64-
65- #include " xenumclasses.h"
66- #include " xcolor.h"
67- #include " xlinear_algebra.h"
68- #include " xgeometry.h"
69-
70- namespace std ::experimental::io2d {
71- inline namespace v1 {
72-
7363 class image_surface;
7464 class display_surface;
7565
76- _IO2D_API int format_stride_for_width (format format, int width) noexcept ;
66+ enum class format {
67+ invalid,
68+ argb32,
69+ xrgb32,
70+ a8,
71+ rgb16_565,
72+ rgb30
73+ };
74+
75+ enum class scaling {
76+ letterbox, // Same as uniform except that the display_surface is cleared using the letterbox brush first
77+ uniform, // Maintain aspect ratio and center as needed, ignoring side areas that are not drawn to
78+ fill_uniform, // Maintain aspect ratio but fill entire display (some content may not be shown)
79+ fill_exact, // Ignore aspect ratio and use (possibly non-uniform) scale to fill exactly
80+ none // Do not scale.
81+ };
82+
83+ enum class refresh_rate {
84+ as_needed,
85+ as_fast_as_possible,
86+ fixed
87+ };
88+
89+ _IO2D_API int format_stride_for_width(format format, int width) noexcept;
7790 _IO2D_API display_surface make_display_surface(int preferredWidth,
7891 int preferredHeight, format preferredFormat,
7992 scaling scl = scaling::letterbox,
@@ -107,10 +120,267 @@ namespace std::experimental::io2d {
107120 const matrix_2d& m = matrix_2d{}) noexcept;
108121 }
109122}
123+ */
124+
125+ namespace std {
126+ namespace experimental {
127+ namespace io2d {
128+ inline namespace v1 {
129+
130+ template <class T >
131+ constexpr T pi = T(3 .14159265358979323846264338327950288L );
132+
133+ template <class T >
134+ constexpr T two_pi = T(6 .28318530717958647692528676655900577L );
135+
136+ template <class T >
137+ constexpr T half_pi = T(1 .57079632679489661923132169163975144L );
138+
139+ template <class T >
140+ constexpr T three_pi_over_two = T(4 .71238898038468985769396507491925432L );
141+
142+ template <class T >
143+ constexpr T tau = T(6 .28318530717958647692528676655900577L );
144+
145+ template <class T >
146+ constexpr T three_quarters_tau = T(4 .71238898038468985769396507491925432L );
147+
148+ template <class T >
149+ constexpr T half_tau = T(3 .14159265358979323846264338327950288L );
150+
151+ template <class T >
152+ constexpr T quarter_tau = T(1 .57079632679489661923132169163975144L );
153+ }
154+ }
155+ }
156+ }
110157
158+ #include " xcolor.h"
159+ #include " xlinear_algebra.h"
160+ #include " xgeometry.h"
161+ #include " xtext.h"
111162#include " xpath.h"
112163#include " xbrushes.h"
113164#include " xsurfaces.h"
165+ #include " xinput.h"
166+
167+ namespace std {
168+ namespace experimental {
169+ namespace io2d {
170+ inline namespace v1 {
171+
172+ using dashes = tuple<vector<float >, float >;
173+
174+ enum class wrap_mode ;
175+ enum class filter ;
176+ enum class brush_type ;
177+ enum class antialias ;
178+ enum class fill_rule ;
179+ enum class line_cap ;
180+ enum class line_join ;
181+ enum class compositing_op ;
182+ enum class format ;
183+ enum class scaling ;
184+ enum class refresh_rate ;
185+ enum class image_file_format ;
186+
187+ class bounding_box ;
188+ constexpr bool operator ==(const bounding_box& lhs, const bounding_box& rhs)
189+ noexcept ;
190+ constexpr bool operator !=(const bounding_box& lhs, const bounding_box& rhs)
191+ noexcept ;
192+
193+ class circle ;
194+ constexpr bool operator ==(const circle& lhs, const circle& rhs) noexcept ;
195+ constexpr bool operator !=(const circle& lhs, const circle& rhs) noexcept ;
196+
197+ class rgba_color ;
198+ constexpr bool operator ==(const rgba_color& lhs, const rgba_color& rhs)
199+ noexcept ;
200+ constexpr bool operator !=(const rgba_color& lhs, const rgba_color& rhs)
201+ noexcept ;
202+ template <class T >
203+ constexpr rgba_color operator *(const rgba_color& lhs, T rhs) noexcept ;
204+ template <class U >
205+ constexpr rgba_color operator *(const rgba_color& lhs, U rhs) noexcept ;
206+ template <class T >
207+ constexpr rgba_color operator *(T lhs, const rgba_color& rhs) noexcept ;
208+ template <class U >
209+ constexpr rgba_color operator *(U lhs, const rgba_color& rhs) noexcept ;
210+
211+ class point_2d ;
212+ constexpr bool operator ==(const point_2d& lhs, const point_2d& rhs)
213+ noexcept ;
214+ constexpr bool operator !=(const point_2d& lhs, const point_2d& rhs)
215+ noexcept ;
216+ constexpr point_2d operator +(const point_2d& lhs) noexcept ;
217+ constexpr point_2d operator +(const point_2d& lhs, const point_2d& rhs)
218+ noexcept ;
219+ constexpr point_2d operator -(const point_2d& lhs) noexcept ;
220+ constexpr point_2d operator -(const point_2d& lhs, const point_2d& rhs)
221+ noexcept ;
222+ constexpr point_2d operator *(const point_2d& lhs, float rhs) noexcept ;
223+ constexpr point_2d operator *(float lhs, const point_2d& rhs) noexcept ;
224+
225+ class matrix_2d ;
226+ constexpr matrix_2d operator *(const matrix_2d& lhs, const matrix_2d& rhs)
227+ noexcept ;
228+ constexpr bool operator ==(const matrix_2d& lhs, const matrix_2d& rhs)
229+ noexcept ;
230+ constexpr bool operator !=(const matrix_2d& lhs, const matrix_2d& rhs)
231+ noexcept ;
232+
233+ namespace figure_items {
234+ class abs_new_figure ;
235+ constexpr bool operator ==(const abs_new_figure&, const abs_new_figure&)
236+ noexcept ;
237+ constexpr bool operator !=(const abs_new_figure&, const abs_new_figure&)
238+ noexcept ;
239+
240+ class rel_new_figure ;
241+ constexpr bool operator ==(const rel_new_figure&, const rel_new_figure&)
242+ noexcept ;
243+ constexpr bool operator !=(const rel_new_figure&, const rel_new_figure&)
244+ noexcept ;
245+
246+ class close_figure ;
247+ constexpr bool operator ==(const close_figure&, const close_figure&) noexcept ;
248+ constexpr bool operator !=(const close_figure&, const close_figure&) noexcept ;
249+
250+ class abs_matrix ;
251+ constexpr bool operator ==(const abs_matrix&, const abs_matrix&) noexcept ;
252+ constexpr bool operator !=(const abs_matrix&, const abs_matrix&) noexcept ;
253+
254+ class rel_matrix ;
255+ constexpr bool operator ==(const rel_matrix&, const rel_matrix&) noexcept ;
256+ constexpr bool operator !=(const rel_matrix&, const rel_matrix&) noexcept ;
257+
258+ class revert_matrix ;
259+ constexpr bool operator ==(const revert_matrix&, const revert_matrix&)
260+ noexcept ;
261+ constexpr bool operator !=(const revert_matrix&, const revert_matrix&)
262+ noexcept ;
263+
264+ class abs_cubic_curve ;
265+ constexpr bool operator ==(const abs_cubic_curve&, const abs_cubic_curve&)
266+ noexcept ;
267+ constexpr bool operator !=(const abs_cubic_curve&, const abs_cubic_curve&)
268+ noexcept ;
269+
270+ class abs_line ;
271+ constexpr bool operator ==(const abs_line&, const abs_line&) noexcept ;
272+ constexpr bool operator !=(const abs_line&, const abs_line&) noexcept ;
273+
274+ class abs_quadratic_curve ;
275+ constexpr bool operator ==(const abs_quadratic_curve&,
276+ const abs_quadratic_curve&) noexcept ;
277+ constexpr bool operator !=(const abs_quadratic_curve&,
278+ const abs_quadratic_curve&) noexcept ;
279+
280+ class arc ;
281+ constexpr bool operator ==(const arc&, const arc&) noexcept ;
282+ constexpr bool operator !=(const arc&, const arc&) noexcept ;
283+
284+ class rel_cubic_curve ;
285+ constexpr bool operator ==(const rel_cubic_curve&, const rel_cubic_curve&)
286+ noexcept ;
287+ constexpr bool operator !=(const rel_cubic_curve&, const rel_cubic_curve&)
288+ noexcept ;
289+
290+ class rel_line ;
291+ constexpr bool operator ==(const rel_line&, const rel_line&) noexcept ;
292+ constexpr bool operator !=(const rel_line&, const rel_line&) noexcept ;
293+
294+ class rel_quadratic_curve ;
295+ constexpr bool operator ==(const rel_quadratic_curve&,
296+ const rel_quadratic_curve&) noexcept ;
297+ constexpr bool operator !=(const rel_quadratic_curve&,
298+ const rel_quadratic_curve&) noexcept ;
299+
300+ using figure_item = variant<abs_cubic_curve, abs_line, abs_matrix,
301+ abs_new_figure, abs_quadratic_curve, arc, close_figure,
302+ rel_cubic_curve, rel_line, rel_matrix, rel_new_figure, rel_quadratic_curve,
303+ revert_matrix>;
304+ }
305+
306+ class interpreted_path ;
307+ template <class Allocator = allocator<figure_items::figure_items_types>>
308+
309+ class path_builder ;
310+ template <class Allocator >
311+ bool operator ==(const path_builder<Allocator>& lhs,
312+ const path_builder<Allocator>& rhs) noexcept ;
313+ template <class Allocator >
314+ bool operator !=(const path_builder<Allocator>& lhs,
315+ const path_builder<Allocator>& rhs) noexcept ;
316+ template <class Allocator >
317+ void swap (path_builder<Allocator>& lhs, path_builder<Allocator>& rhs)
318+ noexcept (noexcept (lhs.swap(rhs))) { // Compiler error prevents forwrad declaration
319+ lhs.swap (rhs);
320+ }
321+
322+ class gradient_stop ;
323+ constexpr bool operator ==(const gradient_stop& lhs, const gradient_stop& rhs)
324+ noexcept ;
325+ constexpr bool operator !=(const gradient_stop& lhs, const gradient_stop& rhs)
326+ noexcept ;
327+
328+ class brush ;
329+ class render_props ;
330+ class brush_props ;
331+ class clip_props ;
332+ class stroke_props ;
333+ class mask_props ;
334+ class surface ;
335+ class image_surface ;
336+ class display_surface ;
337+ class mapped_surface ;
338+
339+ int format_stride_for_width (format format, int width) noexcept ;
340+
341+ display_surface make_display_surface (int preferredWidth,
342+ int preferredHeight, format preferredFormat,
343+ scaling scl = scaling::letterbox);
344+
345+ display_surface make_display_surface (int preferredWidth,
346+ int preferredHeight, format preferredFormat, error_code& ec,
347+ scaling scl = scaling::letterbox) noexcept ;
348+
349+ display_surface make_display_surface (int preferredWidth,
350+ int preferredHeight, format preferredFormat, int preferredDisplayWidth,
351+ int preferredDisplayHeight, scaling scl = scaling::letterbox);
352+
353+ display_surface make_display_surface (int preferredWidth,
354+ int preferredHeight, format preferredFormat, int preferredDisplayWidth,
355+ int preferredDisplayHeight, error_code& ec,
356+ scaling scl = scaling::letterbox) noexcept ;
357+
358+ image_surface make_image_surface (format format, int width, int height);
359+
360+ image_surface make_image_surface (format format, int width, int height,
361+ error_code& ec) noexcept ;
362+
363+ image_surface copy_image_surface (image_surface& sfc) noexcept ;
364+
365+ float angle_for_point (point_2d ctr, point_2d pt,
366+ point_2d scl = point_2d{ 1 .0f , 1 .0f }) noexcept ;
367+
368+ point_2d point_for_angle (float ang, float rad = 1 .0f ) noexcept ;
369+
370+ point_2d point_for_angle (float ang, point_2d rad) noexcept ;
371+
372+ point_2d arc_start (point_2d ctr, float sang, point_2d rad,
373+ const matrix_2d& m = matrix_2d{}) noexcept ;
374+
375+ point_2d arc_center (point_2d cpt, float sang, point_2d rad,
376+ const matrix_2d& m = matrix_2d{}) noexcept ;
377+
378+ point_2d arc_end (point_2d cpt, float eang, point_2d rad,
379+ const matrix_2d& m = matrix_2d{}) noexcept ;
380+ }
381+ }
382+ }
383+ }
114384
115385#include " xio2d_impl.h"
116386#endif
0 commit comments