From da4e041c3d2a50d2ba56824e73829b36fea76739 Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 24 Oct 2024 16:11:53 +0200 Subject: [PATCH 01/15] [graphics] early ColorMap structure --- src/graphics/CMakeLists.txt | 2 ++ src/graphics/styles/codac2_ColorMap.cpp | 10 +++++++++ src/graphics/styles/codac2_ColorMap.h | 29 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 src/graphics/styles/codac2_ColorMap.cpp create mode 100644 src/graphics/styles/codac2_ColorMap.h diff --git a/src/graphics/CMakeLists.txt b/src/graphics/CMakeLists.txt index 7b38751b..c18ba4b8 100644 --- a/src/graphics/CMakeLists.txt +++ b/src/graphics/CMakeLists.txt @@ -22,6 +22,8 @@ ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.h + ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.h ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.h ) diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp new file mode 100644 index 00000000..c10a8007 --- /dev/null +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -0,0 +1,10 @@ +/** + * codac2_ColorMap.cpp + * ---------------------------------------------------------------------------- + * \date 2024 + * \author Simon Rohou, Maël Godard + * \copyright Copyright 2024 Codac Team + * \license GNU Lesser General Public License (LGPL) + */ + +#include "codac2_ColorMap.h" \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h new file mode 100644 index 00000000..9244579f --- /dev/null +++ b/src/graphics/styles/codac2_ColorMap.h @@ -0,0 +1,29 @@ +/** + * \file codac2_ColorMap.h + * ---------------------------------------------------------------------------- + * \date 2024 + * \author Simon Rohou, Maël Godard + * \copyright Copyright 2024 Codac Team + * \license GNU Lesser General Public License (LGPL) + */ + +#pragma once + +#include +#include "codac2_Color.h" + +namespace codac2 +{ + /** + * \struct ColorMap + * \brief Represents a set of RGB values + */ + struct ColorMap + { + std::map m_colormap; //!< map of colors + + void add_color_point(Color color, float index); + + static ColorMap haxby(); + }; +} \ No newline at end of file From 8d50269d1be52f6db0f3f21a3c619763b6cd416e Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 24 Oct 2024 17:22:31 +0200 Subject: [PATCH 02/15] [graphics] HAXBY ColorMap + Binding + example --- examples/00_graphics/graphic_examples.py | 12 +++- python/src/graphics/CMakeLists.txt | 1 + python/src/graphics/codac2_py_graphics.cpp | 2 + .../src/graphics/styles/codac2_py_Color.cpp | 3 + .../graphics/styles/codac2_py_ColorMap.cpp | 45 ++++++++++++ src/graphics/styles/codac2_Color.cpp | 4 ++ src/graphics/styles/codac2_Color.h | 1 + src/graphics/styles/codac2_ColorMap.cpp | 69 ++++++++++++++++++- src/graphics/styles/codac2_ColorMap.h | 12 +++- 9 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 python/src/graphics/styles/codac2_py_ColorMap.cpp diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index 97777710..cdaeba17 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -45,4 +45,14 @@ fig2.draw_polyline([[-0.8,0],[0,1.5]], 0.2, [Color.red(),Color.black(0.3)]) fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)]) fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)]) -fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) \ No newline at end of file +fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) + +fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) +fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,1.5])) +fig3.set_window_properties([250,250],[500,500]) + +cmap=ColorMap.HAXBY + +for i in range (20): + ratio=i/20 + fig3.draw_box([[i,i+1],[0,1]],[cmap.color(ratio),cmap.color(ratio)]) \ No newline at end of file diff --git a/python/src/graphics/CMakeLists.txt b/python/src/graphics/CMakeLists.txt index 29bd2047..8b5add11 100644 --- a/python/src/graphics/CMakeLists.txt +++ b/python/src/graphics/CMakeLists.txt @@ -12,6 +12,7 @@ paver/codac2_py_drawwhilepaving.cpp styles/codac2_py_Color.cpp + styles/codac2_py_ColorMap.cpp styles/codac2_py_StyleProperties.cpp ) diff --git a/python/src/graphics/codac2_py_graphics.cpp b/python/src/graphics/codac2_py_graphics.cpp index 5ae28b1d..c5f9b520 100644 --- a/python/src/graphics/codac2_py_graphics.cpp +++ b/python/src/graphics/codac2_py_graphics.cpp @@ -22,6 +22,7 @@ void export_drawwhilepaving(py::module& m); // styles void export_Color(py::module& m); +void export_ColorMap(py::module& m); void export_StyleProperties(py::module& m); @@ -31,6 +32,7 @@ PYBIND11_MODULE(_graphics, m) // styles export_Color(m); + export_ColorMap(m); export_StyleProperties(m); // figures diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index f86cfdec..1f6abda7 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -30,6 +30,9 @@ void export_Color(py::module& m) .def_readwrite("alpha", &Color::alpha) .def_readwrite("hex_str", &Color::hex_str) + .def(py::init<>(), + COLOR_COLOR) + .def(py::init(), COLOR_COLOR_INT_INT_INT_INT, "r"_a, "g"_a, "b"_a, "alpha"_a=255) diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp new file mode 100644 index 00000000..2a955fdb --- /dev/null +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -0,0 +1,45 @@ +/** + * Codac binding (core) + * ---------------------------------------------------------------------------- + * \date 2024 + * \author Simon Rohou, Maël Godard + * \copyright Copyright 2024 Codac Team + * \license GNU Lesser General Public License (LGPL) + */ + +#include +#include +#include +#include +#include "codac2_py_ColorMap_docs.h" // Generated file from Doxygen XML (doxygen2docstring.py): + +using namespace std; +using namespace codac2; +namespace py = pybind11; +using namespace pybind11::literals; + +void export_ColorMap(py::module& m) +{ + py::class_ exported_colormap(m, "ColorMap", COLORMAP_MAIN); + exported_colormap + + .def_readwrite("colormap", &ColorMap::colormap) + + .def(py::init<>(), + COLORMAP_COLORMAP) + + .def("add_color_point", &ColorMap::add_color_point, + VOID_COLORMAP_ADD_COLOR_POINT_COLOR_FLOAT, + "color"_a, "index"_a) + + .def("color", &ColorMap::color, + COLOR_COLORMAP_COLOR_FLOAT_CONST, + "r"_a) + + // Predifined color maps + + .def_readonly_static("HAXBY", &ColorMap::HAXBY, + CONST_COLORMAP_COLORMAP_HAXBY) + + ; +} \ No newline at end of file diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 05a09905..2d967b10 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -12,6 +12,10 @@ using namespace std; using namespace codac2; +Color::Color() + : r(1.), g(1.), b(1.), alpha(1.), hex_str("#FFFFFF") +{} + Color::Color(float r_, float g_, float b_, float alpha_) : r(r_), g(g_), b(b_), alpha(alpha_), hex_str([&] diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index dee7addd..b5fa0481 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -27,6 +27,7 @@ namespace codac2 float alpha = 1.; ///< opacity, value between 0. (transparent) and 1. (opaque) std::string hex_str; ///< represents an RGB value in a HTML standard + explicit Color(); explicit Color(float r_, float g_, float b_, float alpha_ = 1.); explicit Color(int r_, int g_, int b_, int alpha_ = 255); explicit Color(const std::string& hex_str_); diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index c10a8007..46719ce0 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -7,4 +7,71 @@ * \license GNU Lesser General Public License (LGPL) */ -#include "codac2_ColorMap.h" \ No newline at end of file +#include "codac2_ColorMap.h" + +using namespace std; +using namespace codac2; + + +ColorMap::ColorMap() + : colormap() +{} + +void ColorMap::add_color_point(Color color, float index) +{ + colormap[index] = color; +} + +Color ColorMap::color(float r) const +{ + assert (colormap.size() >= 2); + if(std::isnan(r)) // undefined ratio + return Color((float)0.5, 0.5, 0.5); + assert(Interval(0.,1.).contains(r)); + + Interval map_domain = Interval(colormap.begin()->first,prev(colormap.end())->first); + float real_index = map_domain.lb() + r*map_domain.diam(); + + if(colormap.find(real_index) == colormap.end()) // color interpolation + { + typename map::const_iterator it_ub; + it_ub = colormap.lower_bound(real_index); + Color color_lb = prev(it_ub)->second; + Color color_ub = it_ub->second; + + float local_ratio = (real_index - prev(it_ub)->first) / (it_ub->first - prev(it_ub)->first); + + return Color((float)(color_lb.r + (color_ub.r - color_lb.r) * local_ratio), + (float)(color_lb.g + (color_ub.g - color_lb.g) * local_ratio), + (float)(color_lb.b + (color_ub.b - color_lb.b) * local_ratio), + (float)(color_lb.alpha + (color_ub.alpha - color_lb.alpha) * local_ratio)); + + } + + else // color key + return colormap.at(real_index); +} + +ColorMap make_haxby() + { + ColorMap map; + map.add_color_point(Color(39,90,211), 0); + map.add_color_point(Color(40,123,245), 1); + map.add_color_point(Color(45,155,253), 2); + map.add_color_point(Color(73,209,255), 3); + map.add_color_point(Color(100,230,254), 4); + map.add_color_point(Color(118,235,226), 5); + map.add_color_point(Color(135,236,187), 6); + map.add_color_point(Color(194,252,165), 7); + map.add_color_point(Color(217,251,151), 8); + map.add_color_point(Color(233,241,131), 9); + map.add_color_point(Color(252,201,96), 10); + map.add_color_point(Color(255,184,84), 11); + map.add_color_point(Color(255,170,75), 12); + map.add_color_point(Color(255,167,83), 13); + map.add_color_point(Color(255,200,158), 14); + map.add_color_point(Color(255,233,217), 15); + return map; + } + +const ColorMap ColorMap::HAXBY = make_haxby(); \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 9244579f..e087f4c0 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -10,7 +10,10 @@ #pragma once #include +#include #include "codac2_Color.h" +#include "codac2_Interval.h" +#include"codac2_assert.h" namespace codac2 { @@ -20,10 +23,15 @@ namespace codac2 */ struct ColorMap { - std::map m_colormap; //!< map of colors + + ColorMap(); + + std::map colormap; //!< map of colors void add_color_point(Color color, float index); - static ColorMap haxby(); + Color color (float r) const; + + static const ColorMap HAXBY; }; } \ No newline at end of file From 7b5a463b21d5a4c597078405b5fb09212e4508c7 Mon Sep 17 00:00:00 2001 From: godardma Date: Fri, 25 Oct 2024 17:41:27 +0200 Subject: [PATCH 03/15] [graphics] added BLUE_TUBE and RED_TUBE colormaps --- examples/00_graphics/graphic_examples.py | 10 ++++++--- .../graphics/styles/codac2_py_ColorMap.cpp | 7 ++++++ src/graphics/styles/codac2_ColorMap.cpp | 22 ++++++++++++++++++- src/graphics/styles/codac2_ColorMap.h | 2 ++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index cdaeba17..6439ef51 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -48,11 +48,15 @@ fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) -fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,1.5])) +fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,3.5])) fig3.set_window_properties([250,250],[500,500]) -cmap=ColorMap.HAXBY +cmap_haxby=ColorMap.HAXBY +cmap_blue_tube=ColorMap.BLUE_TUBE +cmap_red_tube=ColorMap.RED_TUBE for i in range (20): ratio=i/20 - fig3.draw_box([[i,i+1],[0,1]],[cmap.color(ratio),cmap.color(ratio)]) \ No newline at end of file + fig3.draw_box([[i,i+1],[0,1]],[Color.black(),cmap_haxby.color(ratio)]) + fig3.draw_box([[i,i+1],[1,2]],[Color.black(),cmap_blue_tube.color(ratio)]) + fig3.draw_box([[i,i+1],[2,3]],[Color.black(),cmap_red_tube.color(ratio)]) \ No newline at end of file diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 2a955fdb..773b9564 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -41,5 +41,12 @@ void export_ColorMap(py::module& m) .def_readonly_static("HAXBY", &ColorMap::HAXBY, CONST_COLORMAP_COLORMAP_HAXBY) + .def_readonly_static("BLUE_TUBE", &ColorMap::BLUE_TUBE, + CONST_COLORMAP_COLORMAP_BLUE_TUBE) + + .def_readonly_static("RED_TUBE", &ColorMap::RED_TUBE, + CONST_COLORMAP_COLORMAP_RED_TUBE) + + ; } \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 46719ce0..42ea0410 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -74,4 +74,24 @@ ColorMap make_haxby() return map; } -const ColorMap ColorMap::HAXBY = make_haxby(); \ No newline at end of file +const ColorMap ColorMap::HAXBY = make_haxby(); + +ColorMap make_blue_tube() +{ + ColorMap map; + map.add_color_point(Color(76,110,127), 0.); + map.add_color_point(Color(136,197,228), 1.); + return map; +} + +const ColorMap ColorMap::BLUE_TUBE = make_blue_tube(); + +ColorMap make_red_tube() +{ + ColorMap map; + map.add_color_point(Color(169,55,0), 0.); + map.add_color_point(Color(241,140,54), 1.); + return map; +} + +const ColorMap ColorMap::RED_TUBE = make_red_tube(); \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index e087f4c0..e11f2d0a 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -33,5 +33,7 @@ namespace codac2 Color color (float r) const; static const ColorMap HAXBY; + static const ColorMap BLUE_TUBE; + static const ColorMap RED_TUBE; }; } \ No newline at end of file From 25ae46106fd8a34ad1dffeed259917dc2dcd0349 Mon Sep 17 00:00:00 2001 From: godardma Date: Fri, 29 Nov 2024 17:58:52 +0100 Subject: [PATCH 04/15] [graphics] Color variant version, python binding to do --- examples/00_graphics/graphic_examples.py | 18 +-- src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 40 ++--- .../3rd/vibes/codac2_Figure2D_VIBes.cpp | 2 +- src/graphics/CMakeLists.txt | 4 +- src/graphics/styles/codac2_Color.cpp | 145 ++++++++++++++---- src/graphics/styles/codac2_Color.h | 38 ++++- 6 files changed, 175 insertions(+), 72 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index 077c5ecc..aed875bf 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -51,12 +51,12 @@ fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,3.5])) fig3.set_window_properties([250,250],[500,500]) -cmap_haxby=ColorMap.HAXBY -cmap_blue_tube=ColorMap.BLUE_TUBE -cmap_red_tube=ColorMap.RED_TUBE - -for i in range (20): - ratio=i/20 - fig3.draw_box([[i,i+1],[0,1]],[Color.black(),cmap_haxby.color(ratio)]) - fig3.draw_box([[i,i+1],[1,2]],[Color.black(),cmap_blue_tube.color(ratio)]) - fig3.draw_box([[i,i+1],[2,3]],[Color.black(),cmap_red_tube.color(ratio)]) \ No newline at end of file +# cmap_haxby=ColorMap.HAXBY +# cmap_blue_tube=ColorMap.BLUE_TUBE +# cmap_red_tube=ColorMap.RED_TUBE + +# for i in range (20): +# ratio=i/20 +# fig3.draw_box([[i,i+1],[0,1]],[Color.black(),cmap_haxby.color(ratio)]) +# fig3.draw_box([[i,i+1],[1,2]],[Color.black(),cmap_blue_tube.color(ratio)]) +# fig3.draw_box([[i,i+1],[2,3]],[Color.black(),cmap_red_tube.color(ratio)]) \ No newline at end of file diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 5dab8020..789cbdc7 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -35,7 +35,7 @@ Figure2D_IPE::Figure2D_IPE(const Figure2D& fig) for(const auto& ci : codac_colors) // substr is needed to remove the "#" at the beginning of hex_str (deprecated by IPE) - _colors.emplace(ci.hex_str.substr(1), ci); + _colors.emplace(ci.hex_str().substr(1), ci); } Figure2D_IPE::~Figure2D_IPE() @@ -78,15 +78,15 @@ void Figure2D_IPE::center_viewbox([[maybe_unused]] const Vector& c, [[maybe_unus void Figure2D_IPE::begin_path(const StyleProperties& s, bool tip=false) { // substr is needed to remove the "#" at the beginning of hex_str (deprecated by IPE) - _colors.emplace(s.stroke_color.hex_str.substr(1), s.stroke_color); - _colors.emplace(s.fill_color.hex_str.substr(1), s.fill_color); + _colors.emplace(s.stroke_color.hex_str().substr(1), s.stroke_color); + _colors.emplace(s.fill_color.hex_str().substr(1), s.fill_color); _f_temp_content << "\n \ "; } @@ -545,7 +545,7 @@ void Figure2D_IPE::print_header_page() for(const auto& [k,c] : _colors) _f << " \n"; + << "value=\"" << c.r() << " " << c.g() << " " << c.b() << "\" /> \n"; _f << " \n \ \n \ diff --git a/src/graphics/3rd/vibes/codac2_Figure2D_VIBes.cpp b/src/graphics/3rd/vibes/codac2_Figure2D_VIBes.cpp index 3b5a9d94..582e5a97 100644 --- a/src/graphics/3rd/vibes/codac2_Figure2D_VIBes.cpp +++ b/src/graphics/3rd/vibes/codac2_Figure2D_VIBes.cpp @@ -144,5 +144,5 @@ void Figure2D_VIBes::draw_AUV(const Vector& x, float size, const StyleProperties string Figure2D_VIBes::to_vibes_style(const StyleProperties& s) { - return s.stroke_color.hex_str + "[" + s.fill_color.hex_str + "]"; + return s.stroke_color.hex_str() + "[" + s.fill_color.hex_str() + "]"; } \ No newline at end of file diff --git a/src/graphics/CMakeLists.txt b/src/graphics/CMakeLists.txt index c18ba4b8..533e3562 100644 --- a/src/graphics/CMakeLists.txt +++ b/src/graphics/CMakeLists.txt @@ -22,8 +22,8 @@ ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.h - ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.h + # ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.cpp + # ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.h ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.h ) diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index a2638c5c..6b69560f 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -12,50 +12,131 @@ using namespace std; using namespace codac2; +std::string DataRGB::to_hex_str() const +{ + stringstream ss; + ss << "#" << hex << setfill('0') << setw(2) << (int)(r*255) << setw(2) << (int)(g*255) << setw(2) << (int)(b*255) << setw(2) << (int)(a*255); + return ss.str(); +} + +DataRGB DataHSV::to_rgb() const +{ + float r = 1., g = 1., b = 1.; + + int i = static_cast(h * 6); + float f = (h * 6) - i; + i = i % 6; + + float p = v * (1 - s); + float q = v * (1 - f * s); + float t = v * (1 - (1 - f) * s); + + switch (i) { + case 0: r = v; g = t; b = p; break; + case 1: r = q; g = v; b = p; break; + case 2: r = p; g = v; b = t; break; + case 3: r = p; g = q; b = v; break; + case 4: r = t; g = p; b = v; break; + case 5: r = v; g = p; b = q; break; + } + + return DataRGB{r, g, b, a}; +} + +std::string DataHSV::to_hex_str() const +{ + return to_rgb().to_hex_str(); +} + Color::Color() - : r(1.), g(1.), b(1.), alpha(1.), hex_str("#FFFFFF") + : data("#FFFFFFFF") {} -Color::Color(float r_, float g_, float b_, float alpha_) - : r(r_), g(g_), b(b_), alpha(alpha_), - hex_str([&] - { - std::stringstream s; - s << std::hex << std::setfill('0'); - s << std::setw(2) << (int)(r*255) << std::setw(2) << (int)(g*255) << std::setw(2) << (int)(b*255); - if(alpha != 1.) - s << std::setw(2) << (int)(alpha*255); - return "#"+s.str(); - }()) +Color::Color(float x1, float x2, float x3, float alpha,InterpolMode interpol_mode) { - assert(r_ >= 0. && r_ <= 1. && g_ >= 0. && g_ <= 1. && b_ >= 0. && b_ <= 1. && alpha_ >= 0. && alpha_ <= 1.); + assert(x1 >= 0. && x1 <= 1. && x2 >= 0. && x2 <= 1. && x3 >= 0. && x3 <= 1. && alpha >= 0. && alpha <= 1.); + if(interpol_mode == InterpolMode::RGB) + data = DataRGB{x1, x2, x3, alpha}; + else + data = DataHSV{x1, x2, x3, alpha}; +} + +Color::Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode) + : Color((float)(x1/255.), (float)(x2/255.), (float)(x3/255.), (float)(alpha/255.),interpol_mode) +{ + assert(x1 >= 0 && x1 <= 255 && x2 >= 0 && x2 <= 255 && x3 >= 0 && x3 <= 255 && alpha >= 0 && alpha <= 255); } -Color::Color(int r_, int g_, int b_, int alpha_) - : Color((float)(r_/255.), (float)(g_/255.), (float)(b_/255.), (float)(alpha_/255.)) +Color::Color(const std::string& hex_str) + : data(hex_str) { - assert(r_ >= 0 && r_ <= 255 && g_ >= 0 && g_ <= 255 && b_ >= 0 && b_ <= 255 && alpha_ >= 0 && alpha_ <= 255); + assert(hex_str.size() == 7 || hex_str.size() == 9); + assert(hex_str[0] == '#'); } -Color::Color(const std::string& hex_str_) - : hex_str(hex_str_) +std::string Color::hex_str() const { - assert(hex_str_.size() == 7 || hex_str_.size() == 9); - assert(hex_str_[0] == '#'); + switch(data.index()) + { + case 0: return std::get<0>(data); + case 1: return std::get<1>(data).to_hex_str(); + case 2: return std::get<2>(data).to_hex_str(); + } + return ""; +} + +float Color::r() const +{ + switch(data.index()) + { + case 0: + float r; + std::istringstream(std::get<0>(data).substr(1,2)) >> std::hex >> r; + return r/255.; + case 1: return std::get<1>(data).r; + case 2: return std::get<2>(data).to_rgb().r; + } + return 0.; +} + +float Color::g() const +{ + switch(data.index()) + { + case 0: + float g; + std::istringstream(std::get<0>(data).substr(3,2)) >> std::hex >> g; + return g/255.; + case 1: return std::get<1>(data).g; + case 2: return std::get<2>(data).to_rgb().g; + } + return 0.; +} - int red,green,blue,a; - std::istringstream(hex_str_.substr(1,2)) >> std::hex >> red; - std::istringstream(hex_str_.substr(3,2)) >> std::hex >> green; - std::istringstream(hex_str_.substr(5,2)) >> std::hex >> blue; - r = (float)red/255.; - g = (float)green/255.; - b = (float)blue/255.; +float Color::b() const +{ + switch(data.index()) + { + case 0: + float b; + std::istringstream(std::get<0>(data).substr(5,2)) >> std::hex >> b; + return b/255.; + case 1: return std::get<1>(data).b; + case 2: return std::get<2>(data).to_rgb().b; + } + return 0.; +} - // Alpha (transparency) component may be appended to the #hexa notation. - // Value is '1' (max opacity) by default. - if(hex_str_.size() == 9) +float Color::alpha() const +{ + switch(data.index()) { - std::istringstream(hex_str_.substr(7,2)) >> std::hex >> a; - alpha = (float)a/255.; + case 0: + float alpha; + std::istringstream(std::get<0>(data).substr(7,2)) >> std::hex >> alpha; + return alpha/255.; + case 1: return std::get<1>(data).a; + case 2: return std::get<2>(data).a; } + return 0.; } \ No newline at end of file diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index 6d8a992c..9cf18cdb 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -11,26 +11,48 @@ #include #include +#include #include"codac2_assert.h" namespace codac2 { + enum class InterpolMode { RGB, HSV }; /** - * \struct Color + * \struct DataRGB * \brief Represents an RGB value */ + struct DataRGB { + float r, g, b, a; + std::string to_hex_str() const; + }; + /** + * \struct DataHSV + * \brief Represents an HSV value + */ + struct DataHSV { + float h, s, v, a; + DataRGB to_rgb() const; + std::string to_hex_str() const; + }; + /** + * \struct Color + * \brief Represents an html color + */ struct Color { - float r; ///< red, value between 0. and 1. - float g; ///< green, value between 0. and 1. - float b; ///< blue, value between 0. and 1. - float alpha = 1.; ///< opacity, value between 0. (transparent) and 1. (opaque) - std::string hex_str; ///< represents an RGB value in a HTML standard + std::variant< std::string, DataRGB, DataHSV > data; - explicit Color(float r, float g, float b, float alpha = 1.); - explicit Color(int r, int g, int b, int alpha = 255); + explicit Color(); + explicit Color(float x1, float x2, float x3, float alpha = 1.,InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(int x1, int x2, int x3, int alpha = 255,InterpolMode interpol_mode = InterpolMode::RGB); explicit Color(const std::string& hex_str); + std::string hex_str() const; + float r() const; + float g() const; + float b() const; + float alpha() const; + static Color none() { return Color(255, 255, 255, 0 ); }; static Color black(float alpha = 1) { return Color(0, 0, 0, (int)(alpha*255)); }; static Color white(float alpha = 1) { return Color(255, 255, 255, (int)(alpha*255)); }; From 7d691d5dc0e7479968cf330f2b569e1ce69bf0b4 Mon Sep 17 00:00:00 2001 From: godardma Date: Fri, 29 Nov 2024 23:51:08 +0100 Subject: [PATCH 05/15] [graphics] changed Color representation to variant --- examples/00_graphics/graphic_examples.py | 7 +- python/src/graphics/CMakeLists.txt | 2 +- python/src/graphics/codac2_py_graphics.cpp | 4 +- .../src/graphics/styles/codac2_py_Color.cpp | 65 +++++++++++++++---- src/graphics/styles/codac2_Color.cpp | 21 +++--- src/graphics/styles/codac2_Color.h | 6 +- 6 files changed, 77 insertions(+), 28 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index aed875bf..71625bf2 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -46,10 +46,11 @@ fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)]) fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)]) fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) +fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color(0.305555556,0.9,0.78,interpol_mode=InterpolMode.HSV),Color(0.305555556,0.9,0.78,0.2,InterpolMode.HSV)]) -fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) -fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,3.5])) -fig3.set_window_properties([250,250],[500,500]) +# fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) +# fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,3.5])) +# fig3.set_window_properties([250,250],[500,500]) # cmap_haxby=ColorMap.HAXBY # cmap_blue_tube=ColorMap.BLUE_TUBE diff --git a/python/src/graphics/CMakeLists.txt b/python/src/graphics/CMakeLists.txt index 8b5add11..b46e24dd 100644 --- a/python/src/graphics/CMakeLists.txt +++ b/python/src/graphics/CMakeLists.txt @@ -12,7 +12,7 @@ paver/codac2_py_drawwhilepaving.cpp styles/codac2_py_Color.cpp - styles/codac2_py_ColorMap.cpp + # styles/codac2_py_ColorMap.cpp styles/codac2_py_StyleProperties.cpp ) diff --git a/python/src/graphics/codac2_py_graphics.cpp b/python/src/graphics/codac2_py_graphics.cpp index c5f9b520..05d37453 100644 --- a/python/src/graphics/codac2_py_graphics.cpp +++ b/python/src/graphics/codac2_py_graphics.cpp @@ -22,7 +22,7 @@ void export_drawwhilepaving(py::module& m); // styles void export_Color(py::module& m); -void export_ColorMap(py::module& m); +// void export_ColorMap(py::module& m); void export_StyleProperties(py::module& m); @@ -32,7 +32,7 @@ PYBIND11_MODULE(_graphics, m) // styles export_Color(m); - export_ColorMap(m); + // export_ColorMap(m); export_StyleProperties(m); // figures diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index ec541404..b744bd0f 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -19,32 +19,71 @@ using namespace codac2; namespace py = pybind11; using namespace pybind11::literals; + void export_Color(py::module& m) { + py::enum_(m, "InterpolMode") + .value("RGB", InterpolMode::RGB) + .value("HSV", InterpolMode::HSV) + ; + + py::class_ exported_data_rgb(m, "DataRGB", DATARGB_MAIN); + exported_data_rgb + .def_readwrite("r", &DataRGB::r) + .def_readwrite("g", &DataRGB::g) + .def_readwrite("b", &DataRGB::b) + .def_readwrite("a", &DataRGB::a) + .def("to_hex_str", &DataRGB::to_hex_str, STRING_DATARGB_TO_HEX_STR_CONST) + ; + + py::class_ exported_data_hsv(m, "DataHSV", DATAHSV_MAIN); + exported_data_hsv + .def_readwrite("h", &DataHSV::h) + .def_readwrite("s", &DataHSV::s) + .def_readwrite("v", &DataHSV::v) + .def_readwrite("a", &DataHSV::a) + .def("to_rgb", &DataHSV::to_rgb, DATARGB_DATAHSV_TO_RGB_CONST) + .def("to_hex_str", &DataHSV::to_hex_str, STRING_DATAHSV_TO_HEX_STR_CONST) + ; + + py::class_ exported_color(m, "Color", COLOR_MAIN); exported_color - .def_readwrite("r", &Color::r) - .def_readwrite("g", &Color::g) - .def_readwrite("b", &Color::b) - .def_readwrite("alpha", &Color::alpha) - .def_readwrite("hex_str", &Color::hex_str) + .def_readwrite("data", &Color::data, + VARIANT_STRINGDATARGBDATAHSV_COLOR_DATA) - .def(py::init<>(), - COLOR_COLOR) + .def(py::init<>(),COLOR_COLOR) - .def(py::init(), - COLOR_COLOR_INT_INT_INT_INT, - "r"_a, "g"_a, "b"_a, "alpha"_a=255) + .def(py::init(), + COLOR_COLOR_FLOAT_FLOAT_FLOAT_FLOAT_INTERPOLMODE, + "x1"_a, "x2"_a, "x3"_a, "alpha"_a=1., "interpol_mode"_a=InterpolMode::RGB) - .def(py::init(), - COLOR_COLOR_FLOAT_FLOAT_FLOAT_FLOAT, - "r"_a, "g"_a, "b"_a, "alpha"_a=1.) + .def(py::init(), + COLOR_COLOR_INT_INT_INT_INT_INTERPOLMODE, + "x1"_a, "x2"_a, "x3"_a, "alpha"_a=255, "interpol_mode"_a=InterpolMode::RGB) .def(py::init(), COLOR_COLOR_CONST_STRING_REF, "hex_str"_a) + // Properties + + .def("hex_str", &Color::hex_str, + STRING_COLOR_HEX_STR_CONST) + + .def("r", &Color::r, + FLOAT_COLOR_R_CONST) + + .def("g", &Color::g, + FLOAT_COLOR_G_CONST) + + .def("b", &Color::b, + FLOAT_COLOR_B_CONST) + + .def("alpha", &Color::alpha, + FLOAT_COLOR_ALPHA_CONST) + // Predefined colors .def_static("none", &Color::none, diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 6b69560f..f643f0d4 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -90,9 +90,9 @@ float Color::r() const switch(data.index()) { case 0: - float r; + int r; std::istringstream(std::get<0>(data).substr(1,2)) >> std::hex >> r; - return r/255.; + return (float) r/255.; case 1: return std::get<1>(data).r; case 2: return std::get<2>(data).to_rgb().r; } @@ -104,9 +104,9 @@ float Color::g() const switch(data.index()) { case 0: - float g; + int g; std::istringstream(std::get<0>(data).substr(3,2)) >> std::hex >> g; - return g/255.; + return (float) g/255.; case 1: return std::get<1>(data).g; case 2: return std::get<2>(data).to_rgb().g; } @@ -118,9 +118,9 @@ float Color::b() const switch(data.index()) { case 0: - float b; + int b; std::istringstream(std::get<0>(data).substr(5,2)) >> std::hex >> b; - return b/255.; + return (float) b/255.; case 1: return std::get<1>(data).b; case 2: return std::get<2>(data).to_rgb().b; } @@ -133,8 +133,13 @@ float Color::alpha() const { case 0: float alpha; - std::istringstream(std::get<0>(data).substr(7,2)) >> std::hex >> alpha; - return alpha/255.; + if (std::get<0>(data).size() == 7) + return 1.; + else + { + std::istringstream(std::get<0>(data).substr(7,2)) >> std::hex >> alpha; + return alpha/255.; + } case 1: return std::get<1>(data).a; case 2: return std::get<2>(data).a; } diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index 9cf18cdb..7eb4f7e1 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -16,7 +16,11 @@ namespace codac2 { - enum class InterpolMode { RGB, HSV }; + enum class InterpolMode + { + RGB = 0x01, + HSV = 0x02 + }; /** * \struct DataRGB * \brief Represents an RGB value From be1ced1883045478a87c1893144b3d25f5e6ae7f Mon Sep 17 00:00:00 2001 From: godardma Date: Sat, 30 Nov 2024 01:05:04 +0100 Subject: [PATCH 06/15] [graphics] Colormaps, rainbow and default --- examples/00_graphics/graphic_examples.py | 30 ++++++---- python/src/graphics/CMakeLists.txt | 2 +- python/src/graphics/codac2_py_graphics.cpp | 4 +- .../graphics/styles/codac2_py_ColorMap.cpp | 5 ++ src/graphics/CMakeLists.txt | 4 +- src/graphics/styles/codac2_Color.cpp | 5 +- src/graphics/styles/codac2_ColorMap.cpp | 60 +++++++++++++++++-- src/graphics/styles/codac2_ColorMap.h | 8 ++- 8 files changed, 91 insertions(+), 27 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index 71625bf2..4d8549bb 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -48,16 +48,20 @@ fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color(0.305555556,0.9,0.78,interpol_mode=InterpolMode.HSV),Color(0.305555556,0.9,0.78,0.2,InterpolMode.HSV)]) -# fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) -# fig3.set_axes(axis(0,[-1,21]), axis(1,[-0.5,3.5])) -# fig3.set_window_properties([250,250],[500,500]) - -# cmap_haxby=ColorMap.HAXBY -# cmap_blue_tube=ColorMap.BLUE_TUBE -# cmap_red_tube=ColorMap.RED_TUBE - -# for i in range (20): -# ratio=i/20 -# fig3.draw_box([[i,i+1],[0,1]],[Color.black(),cmap_haxby.color(ratio)]) -# fig3.draw_box([[i,i+1],[1,2]],[Color.black(),cmap_blue_tube.color(ratio)]) -# fig3.draw_box([[i,i+1],[2,3]],[Color.black(),cmap_red_tube.color(ratio)]) \ No newline at end of file +fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) +fig3.set_axes(axis(0,[-1,21]), axis(1,[-5.5,0.5])) +fig3.set_window_properties([800,250],[500,500]) + +cmap_haxby=ColorMap.HAXBY +cmap_default=ColorMap.DEFAULT +cmap_blue_tube=ColorMap.BLUE_TUBE +cmap_red_tube=ColorMap.RED_TUBE +cmap_rainbow=ColorMap.RAINBOW + +for i in range (20): + ratio=i/20 + fig3.draw_box([[i,i+1],[-1,0]],[Color.black(),cmap_haxby.color(ratio)]) + fig3.draw_box([[i,i+1],[-2,-1]],[Color.black(),cmap_default.color(ratio)]) + fig3.draw_box([[i,i+1],[-3,-2]],[Color.black(),cmap_blue_tube.color(ratio)]) + fig3.draw_box([[i,i+1],[-4,-3]],[Color.black(),cmap_red_tube.color(ratio)]) + fig3.draw_box([[i,i+1],[-5,-4]],[Color.black(),cmap_rainbow.color(ratio)]) \ No newline at end of file diff --git a/python/src/graphics/CMakeLists.txt b/python/src/graphics/CMakeLists.txt index b46e24dd..8b5add11 100644 --- a/python/src/graphics/CMakeLists.txt +++ b/python/src/graphics/CMakeLists.txt @@ -12,7 +12,7 @@ paver/codac2_py_drawwhilepaving.cpp styles/codac2_py_Color.cpp - # styles/codac2_py_ColorMap.cpp + styles/codac2_py_ColorMap.cpp styles/codac2_py_StyleProperties.cpp ) diff --git a/python/src/graphics/codac2_py_graphics.cpp b/python/src/graphics/codac2_py_graphics.cpp index 05d37453..c5f9b520 100644 --- a/python/src/graphics/codac2_py_graphics.cpp +++ b/python/src/graphics/codac2_py_graphics.cpp @@ -22,7 +22,7 @@ void export_drawwhilepaving(py::module& m); // styles void export_Color(py::module& m); -// void export_ColorMap(py::module& m); +void export_ColorMap(py::module& m); void export_StyleProperties(py::module& m); @@ -32,7 +32,7 @@ PYBIND11_MODULE(_graphics, m) // styles export_Color(m); - // export_ColorMap(m); + export_ColorMap(m); export_StyleProperties(m); // figures diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 773b9564..11b66b9d 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -41,12 +41,17 @@ void export_ColorMap(py::module& m) .def_readonly_static("HAXBY", &ColorMap::HAXBY, CONST_COLORMAP_COLORMAP_HAXBY) + .def_readonly_static("DEFAULT", &ColorMap::DEFAULT, + CONST_COLORMAP_COLORMAP_DEFAULT) + .def_readonly_static("BLUE_TUBE", &ColorMap::BLUE_TUBE, CONST_COLORMAP_COLORMAP_BLUE_TUBE) .def_readonly_static("RED_TUBE", &ColorMap::RED_TUBE, CONST_COLORMAP_COLORMAP_RED_TUBE) + .def_readonly_static("RAINBOW", &ColorMap::RAINBOW, + CONST_COLORMAP_COLORMAP_RAINBOW) ; } \ No newline at end of file diff --git a/src/graphics/CMakeLists.txt b/src/graphics/CMakeLists.txt index 533e3562..c18ba4b8 100644 --- a/src/graphics/CMakeLists.txt +++ b/src/graphics/CMakeLists.txt @@ -22,8 +22,8 @@ ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_Color.h - # ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.cpp - # ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.h + ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_ColorMap.h ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.cpp ${CMAKE_CURRENT_SOURCE_DIR}/styles/codac2_StyleProperties.h ) diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index f643f0d4..00892b65 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -62,9 +62,12 @@ Color::Color(float x1, float x2, float x3, float alpha,InterpolMode interpol_mod } Color::Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode) - : Color((float)(x1/255.), (float)(x2/255.), (float)(x3/255.), (float)(alpha/255.),interpol_mode) { assert(x1 >= 0 && x1 <= 255 && x2 >= 0 && x2 <= 255 && x3 >= 0 && x3 <= 255 && alpha >= 0 && alpha <= 255); + if (interpol_mode == InterpolMode::RGB) + data = DataRGB{(float)x1/255., (float)x2/255., (float)x3/255., (float)alpha/255.}; + else + data = DataHSV{(float)x1/360., (float)x2/100., (float)x3/100., (float)alpha/100.}; } Color::Color(const std::string& hex_str) diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 42ea0410..2b729b9d 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -41,10 +41,10 @@ Color ColorMap::color(float r) const float local_ratio = (real_index - prev(it_ub)->first) / (it_ub->first - prev(it_ub)->first); - return Color((float)(color_lb.r + (color_ub.r - color_lb.r) * local_ratio), - (float)(color_lb.g + (color_ub.g - color_lb.g) * local_ratio), - (float)(color_lb.b + (color_ub.b - color_lb.b) * local_ratio), - (float)(color_lb.alpha + (color_ub.alpha - color_lb.alpha) * local_ratio)); + return Color((float)(color_lb.r() + (color_ub.r() - color_lb.r()) * local_ratio), + (float)(color_lb.g() + (color_ub.g() - color_lb.g()) * local_ratio), + (float)(color_lb.b() + (color_ub.b() - color_lb.b()) * local_ratio), + (float)(color_lb.alpha() + (color_ub.alpha() - color_lb.alpha()) * local_ratio)); } @@ -76,6 +76,46 @@ ColorMap make_haxby() const ColorMap ColorMap::HAXBY = make_haxby(); +ColorMap make_default() + { + ColorMap map; + map.add_color_point(Color(10,0,121), 0); + map.add_color_point(Color(40,0,150), 1); + map.add_color_point(Color(20,5,175), 2); + map.add_color_point(Color(0,10,200), 3); + map.add_color_point(Color(0,25,212), 4); + map.add_color_point(Color(0,40,224), 5); + map.add_color_point(Color(26,102,240), 6); + map.add_color_point(Color(13,129,248), 7); + map.add_color_point(Color(25,175,255), 8); + map.add_color_point(Color(50,190,255), 9); + map.add_color_point(Color(68,202,255), 10); + map.add_color_point(Color(97,225,240), 11); + map.add_color_point(Color(106,235,225), 12); + map.add_color_point(Color(124,235,200), 13); + map.add_color_point(Color(138,236,174), 14); + map.add_color_point(Color(172,245,168), 15); + map.add_color_point(Color(205,255,162), 16); + map.add_color_point(Color(223,245,141), 17); + map.add_color_point(Color(240,236,121), 18); + map.add_color_point(Color(247,215,104), 19); + map.add_color_point(Color(255,189,87), 20); + map.add_color_point(Color(255,160,69), 21); + map.add_color_point(Color(244,117,75), 22); + map.add_color_point(Color(238,80,78), 23); + map.add_color_point(Color(255,90,90), 24); + map.add_color_point(Color(255,124,124), 25); + map.add_color_point(Color(255,158,158), 26); + map.add_color_point(Color(245,179,174), 27); + map.add_color_point(Color(255,196,196), 28); + map.add_color_point(Color(255,215,215), 29); + map.add_color_point(Color(255,235,235), 31); + map.add_color_point(Color(255,254,253), 32); + return map; + } + + const ColorMap ColorMap::DEFAULT = make_default(); + ColorMap make_blue_tube() { ColorMap map; @@ -94,4 +134,14 @@ ColorMap make_red_tube() return map; } -const ColorMap ColorMap::RED_TUBE = make_red_tube(); \ No newline at end of file +const ColorMap ColorMap::RED_TUBE = make_red_tube(); + +ColorMap make_rainbow() + { + ColorMap map; + for(int h = 300 ; h > 0 ; h-=10) + map.add_color_point(Color(h,100,100,100,InterpolMode::HSV), (300.-h)/300.); + return map; + } + + const ColorMap ColorMap::RAINBOW = make_rainbow(); \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index e11f2d0a..36d44cd6 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -32,8 +32,10 @@ namespace codac2 Color color (float r) const; - static const ColorMap HAXBY; - static const ColorMap BLUE_TUBE; - static const ColorMap RED_TUBE; + static const ColorMap HAXBY; //!< predefined HAXBY color map (mainly used for DEM) + static const ColorMap DEFAULT; //!< a predefined default color map + static const ColorMap BLUE_TUBE; //!< a predefined color map for tubes + static const ColorMap RED_TUBE; //!< a predefined color map for tubes + static const ColorMap RAINBOW; //!< a predefined color map }; } \ No newline at end of file From ed288e5c96bb9b44c447ccac9f05629562ade6c4 Mon Sep 17 00:00:00 2001 From: godardma Date: Mon, 2 Dec 2024 21:27:08 +0100 Subject: [PATCH 07/15] [graphics] changed Color structure, added tests --- examples/00_graphics/CMakeCache.txt | 381 +++++++++ .../CMakeFiles/3.22.1/CMakeCCompiler.cmake | 72 ++ .../CMakeFiles/3.22.1/CMakeCXXCompiler.cmake | 83 ++ .../3.22.1/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 15968 bytes .../3.22.1/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 15992 bytes .../CMakeFiles/3.22.1/CMakeSystem.cmake | 15 + .../3.22.1/CompilerIdC/CMakeCCompilerId.c | 803 ++++++++++++++++++ .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 791 +++++++++++++++++ .../CMakeDirectoryInformation.cmake | 16 + .../00_graphics/CMakeFiles/Makefile.cmake | 121 +++ examples/00_graphics/CMakeFiles/Makefile2 | 86 ++ .../CMakeFiles/TargetDirectories.txt | 2 + .../00_graphics/CMakeFiles/cmake.check_cache | 1 + .../00_graphics/CMakeFiles/progress.marks | 1 + examples/00_graphics/Makefile | 140 +++ examples/00_graphics/cmake_install.cmake | 54 ++ .../src/graphics/styles/codac2_py_Color.cpp | 77 +- src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 22 +- src/graphics/styles/codac2_Color.cpp | 253 +++--- src/graphics/styles/codac2_Color.h | 59 +- src/graphics/styles/codac2_ColorMap.cpp | 14 +- .../styles/codac2_StyleProperties.cpp | 6 +- tests/CMakeLists.txt | 2 + tests/graphics/styles/codac2_tests_Color.cpp | 307 +++++++ tests/graphics/styles/codac2_tests_Color.py | 184 ++++ 25 files changed, 3314 insertions(+), 176 deletions(-) create mode 100644 examples/00_graphics/CMakeCache.txt create mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake create mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake create mode 100755 examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin create mode 100755 examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin create mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeSystem.cmake create mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c create mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100644 examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake create mode 100644 examples/00_graphics/CMakeFiles/Makefile.cmake create mode 100644 examples/00_graphics/CMakeFiles/Makefile2 create mode 100644 examples/00_graphics/CMakeFiles/TargetDirectories.txt create mode 100644 examples/00_graphics/CMakeFiles/cmake.check_cache create mode 100644 examples/00_graphics/CMakeFiles/progress.marks create mode 100644 examples/00_graphics/Makefile create mode 100644 examples/00_graphics/cmake_install.cmake create mode 100644 tests/graphics/styles/codac2_tests_Color.cpp create mode 100644 tests/graphics/styles/codac2_tests_Color.py diff --git a/examples/00_graphics/CMakeCache.txt b/examples/00_graphics/CMakeCache.txt new file mode 100644 index 00000000..e13e7fa5 --- /dev/null +++ b/examples/00_graphics/CMakeCache.txt @@ -0,0 +1,381 @@ +# This is the CMakeCache file. +# For build in directory: /home/neo/codac/examples/00_graphics +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//No help, variable specified on the command line. +BUILD_TESTS:UNINITIALIZED=ON + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING=Release + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING=-fPIC + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING=-fPIC + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/home/neo/codac/build_install + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=Project + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//No help, variable specified on the command line. +FAST_RELEASE:UNINITIALIZED=1 + +//Value Computed by CMake +Project_BINARY_DIR:STATIC=/home/neo/codac/examples/00_graphics + +//Value Computed by CMake +Project_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +Project_SOURCE_DIR:STATIC=/home/neo/codac/examples + +//No help, variable specified on the command line. +TEST_EXAMPLES:UNINITIALIZED=ON + +//No help, variable specified on the command line. +WITH_PYTHON:UNINITIALIZED=ON + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/neo/codac/examples/00_graphics +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=22 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/neo/codac/examples +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake new file mode 100644 index 00000000..488ad375 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake @@ -0,0 +1,72 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "11.4.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake new file mode 100644 index 00000000..345e9307 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake @@ -0,0 +1,83 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "11.4.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-11") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin b/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000000000000000000000000000000000000..a8dc0758bdd947d6c1b6426579ede08176cb0ecb GIT binary patch literal 15968 zcmeHOeQX?85r21f5~umNOB;j9=TcHgTD-BH!~~v2U;azv*%me+unz} zw@2*~nn)=qCIp2FQObuD3IZhhM=Kzqpu&})B9JKL4@#gC3WQ2Qq{M}Q45T?`-kZ6s zH|G`=gh1Lk?arIue7v`_Z|~mT&K^wl_eCQS!PFq$El^6t6_Ox@_6}+QONh;45$sor z6=E*PjS^G(gkqpobT&GZHxb?d9Q|6bQHQTkF!Z2^M~EE#W+P*s(l8fv9OyR(RU`-b zlhgro*4O&e&>2XR`x+l4KjwZv%*|A*vY*;AlWUZhwZz#EMf4N8vWL^5hZPLIA-l$LX|Um(+B&dX zK$r?*ltvLfq-2hVx}~H?`{v@ZOAmeYeBa>8JML+Gy5+eG$s6{f4UQXq&;|+P@f2Yh z`$QYe$B{d~5Lsh4-ip|K*cQXqllu9^d*&yf|MvNZ51g@|%P;JDWWnR_IbZ3>yztW5 z`|etC@4?R;c&cU2x4?8(!g1VKM~ml0tApof!9O<(emCH8@kS9(K*LA-p^dmm_&{hL zm3WJ23E-HAn_&x51^}&2oCAO_!7OXa19Ofv4BL&6y#!61w@OrqQzs zl;H=--T;pAHBAA{gbULg8n?`0r(orr2W${wf(@A^&vHF8Z#e~lGS06~VWtPSnOWPl zN1T#pyMx=3xnjW{v@$tcIECS&S%L_~VKY1Cxx%!wmS;gcWGWsABl%*1f}0R;JG8S- z!7P{TEO-=PXJ$$zHpl+z_O`V@-IFvs^bUQK;P!@%ct}y0f!96_zBZl_oS#v7UMQWS zyv%{=*&t4W4zX{1;!`kvqvHE$48-4${Jo@6UZ?4MlksyDuqh$k1mi59yV^cj1O15X!U2t;U6@emWNQ?^ccW@s^0QNV6oK#?Lm54O1(nL?JuP#&%EE5 z{H<~LcT+nCQ|*=Z9~sBC{1^gMn@eDMd03CFen`dx{82!RV{;xx_ReXq8M=NiwxR3! z)pN1chtTjeaj6 zO@8R2FDoD}ofYglq%Z?v2Eq)483;2FW+2Q!n1L_@VFtnsgc%4k@ULe8 zpVPb=r3d=9cln+-?P=S*&u>4F-rkq#@+M5%E!x>VZo0?ZI*>~D4s;7?C;c-Mo^2Lg zc%-$bKRr0upE6Sez3J`&u#kEyO#+G5mK0e zFau!*!VH8N2s037Ak09RfiMGM2L3lPz;$(8N5?gC@}>udxR8fQb#{wL{u0&Wy@_P5 z*IQ09-})>gnd|oOehG>7f4N#MqWlCE+sT@2kVmP3b$gQV1`y~5#l%mDFCgARyjEXH zGS~1`s7{Z{!Nm~@%;Tt#J=V-3alBPZtc~{{RW)A7lXSgG@?8`Uo(#+5;XJ~vsgyfO z|2L9(TonF4$GATH-;BuhlUtL?E^Y1ZOu68dwf1&>qu$oqUY26}gB=}u+s1VSzj}w5 zk4EuwHE4zTj)3N4ln{*!ZUSD<9?wS<>T<_uK9af62tN_PHxSPAo9)xki1_Mw`FvrO zbp-DAdA_p!0cc>qe7!J!MB3j}t5;?GE6}Jn{_jZpxJYQqlIPd+gzqPun7B;%Ap)Qp zK+cDx-0A8>D{2<^OJNx)IC4PO~_-6sHSC9QT;PvXy zzfQPF_<}>TBID1*Q2Hsw7n;)1*OvITjB|ax`cr_{t1~}O_QAYeBKu&S`DMVVOVu&$ z7sKCq{9Qgnv1`cn+Vvt7e#5_Qre}=^07_nYcvv42*NV+eFK-TExp@go%8TYmu9&fM zX4WgZCDSU8i=kqEEN6RmR&T3sfi>=qX}PWie+m{ncR~!iR^B$V<$QhuTzrxVmfj50 z$~m5wvu9}GXra@-o!#5yzm6u9 z!{Y#P?4_bPY8A3jRd4p*JFzhT_x0^c z4Vr`9J@8+qkcR0(7A`yucte zAF$n$Q!LC7OwhS@&O!&F<5Us)SWfNqks>radmQ%ibn0$Vz6YV(qcp=tv*6E?@>f$$ zd2kzoTX|;)hJ&wB=m#^S;X6)I@O?L4ACX$xavS+uV8b;G z`_J}X7uq86`bJ4YbV9@LAAG+H{}1;Qe}6HCzngx4{@rG-u_5uG|N8*{E3AQd{JidC z-cNqK?hB6J0zIzz*dKmm6%ilBofdc0q_g`B_>dK>n z2M2`nABp|=JboE4G+}>UKUUVGwGaupzqVt4=F_0^`_~-Wln?jA5!jFAtI$A<`{(sp zocx3KbU5rT8UR3y%xgIN-&R9ZgZ=%yHurqC2@3dC8W>*3cyG?*;qO1Z-{P_R+{FdF cQ36^Q2+sW~Ev}vG`!B&C7NCUzhkz*l2~FWervLx| literal 0 HcmV?d00001 diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin b/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000000000000000000000000000000000000..cfa527b53452d63fe64b6a8e2d060ddc5e29a3a6 GIT binary patch literal 15992 zcmeHOYit}>6~4Q666fh{noyIZ%}^TT5InIR$2dlA){nJk!LK9^1VWh1ddK#VeYmr; z#15f}lorK=pim(~k&r@p6bXJb5+VXo*ea-q@=)_5B&dG^p(u!ix;&RLJg z>z1d4&>U;`-1FV@-FxTUJL@|$XO6{syThT7V5txf3$&sU7l~3u%R8w6Dk@sUO8CBC zY!HjVu9TQtA9WSfx^guiWZUxI(%>{juhF zVodPULhY9IP5mu24-tw#YYMN}nz9njOcgFYzO9xoBL zu}}2Dc%0nz#gJlF)*`kPJ}4cr%Qru~wDafRx&Fk_OXkngD_YMk|HgZ+7a9{U-Mae7 zz72NHPgyIp2*N7S) zj>rEXeEhNt0HsVjhXB6^qpP?Kj5P{Id9_$o`n`LbM1?p8IwET3jq`r;-+Yhj_)+o~ zx;{K%=p$CfNLfcrFkt}=>p91;9X)MW8G$ygpJt)Qhx+uSX`7=~&N1zwzRpxOV-6XK z6!6TX;TS+i<fCh?dbKv=>5w&{bW3oNKp9DlZ zz32&4J7%1<(Di$<3|%iRUaQ`C933x`27gQXZ%?4wd{>*A)}H(QPVKpw3N7@!cImFO z1{&Bz4OA7cjZ|-haWNmqd%O*+MSja(?L=D`i`vx7&I;{R+hQL?DPj5P={9K?H&b z1Q7@#5Jcb~j{rX3c|D2ucMr7Y;E7gtL{E-8_Wt^o1783B_&|4})tS^yJ8LHQ+wl&) zr#}|&>Teg)Px2F!j;UvDc;vOeH$F7f8`ER`UGesQ@R0RJ!rBjc2uKL6uXqL?DPj5P={9K?MFcBEb20oPWo;b@HMI zhPZ-u=vJX3>6zlJqcd6-A>0=KG<{ zQ2jF36yGJioOBK8wWL{b?q7lO`zRe;3{t~9jsg)lXO`Q0fN=KvYtbDq#7RPT$yTU6 zcrq-HhvNvBrqZsY`oECPi4s zzS%zxg^(wom*)%fe?xG$fY&SgAB6(;%jXN@C#C+Uw;2MH%7YGA-25fR4;fGhzi3&m}d^j|Fo-$ITaRc@Tyz&|Xi1)t~azC*Ti zpWyYuc(=siXngB$0C3E-KBKUws}t0YKkqvu@iz%RUzzn7;9&u0yKjC!0eHFm^rr#$ zbt#+riNxpUm0twBTps!hgo`MT#MM`1J99C#egk;9yz<+!o%wm|F9KdJ-~2W5_s3^3 z+@3>!f4=#0z?J#K5t{&iunaEt4BJkFnuSbpxZ9>X#;5=w=j2C5)L}83jIKLreHhcx zbC`pk)kjm=gptydPS(!pMt(vJXVc>;(=n53eR&Vefwy$Swhg!`m~re$F=88OQ%~m8 z=}Dk?EFCI_2YMTtt;|SP_uPv_w9!Rp?=b2K zYZO!BEh8iAcSx3}K4m#h%JjIjNDqh#46b{3d!M{JsY9MU9ta*|E~}3jnIvZCcfG&A zy)WJgD7>Jd$21~nUAqB-M1H)niPWCnfsXcGeW1I0Pi#mZYVUx1oGRCA0L-dGa&Y`J`Q1-c9_L*qu;8iwKE>liA$T_IFh z`e|6v<<72u8pC}PobvD+=ZgP5INmo=we;mO>bJrN_cqL5=zTBrMdAI7YYEW|1ux(K z-WT2{_X^&R_X_?$_44`uIcvr13}rw6eSrNL_C`E@-Vd_Yh|l{$|M(54$Gsr)dB4bd z5Q7VXW5go!d7ozihFcKk^Zt`H?>E6k3N^>3cmztg_hUZq_gM4%@%Y(~^`pSYy(HVb zpJZK6J^9Da12_!@j4AVZf6KZ+j@-Zh_|HN;9uwD>{?F3?Ti(}GGxO%}3qHO=Jl4K{ z+y3UoQ$Bt@5m>(w|LZ<}lnAVoz6tZUcizY6eGhBC?g2L`{`GqSQ0#)^FBIt}SbvI4 zR$R@tyDyyO^L~jnzyHYo{{DXo72f^})B)?yFp)IRKf_m`fO|;3F5&$wzbEPUXPfnP z;8uJ1ynmjl0}zD$Tx-^5{1vFcwa5LJ_K~W~DB!_?;QB{l9?#=f0Yew&^Zv206}^Rs z%J11P=ChuGDlfl8sCPNs54XTPw(mj#G47xDZ4u)8{poO+E-C;(jND5&^S6``x4?X_ zF0DO}Z>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 00000000..25c62a8c --- /dev/null +++ b/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,791 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake b/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 00000000..c92a10b9 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.22 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/neo/codac/examples") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/neo/codac/examples/00_graphics") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/examples/00_graphics/CMakeFiles/Makefile.cmake b/examples/00_graphics/CMakeFiles/Makefile.cmake new file mode 100644 index 00000000..fbd61b2d --- /dev/null +++ b/examples/00_graphics/CMakeFiles/Makefile.cmake @@ -0,0 +1,121 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.22 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "CMakeFiles/3.22.1/CMakeCCompiler.cmake" + "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" + "CMakeFiles/3.22.1/CMakeSystem.cmake" + "../CMakeLists.txt" + "/usr/share/cmake-3.22/Modules/CMakeCCompiler.cmake.in" + "/usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c" + "/usr/share/cmake-3.22/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.22/Modules/CMakeCXXCompiler.cmake.in" + "/usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp" + "/usr/share/cmake-3.22/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.22/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.22/Modules/CMakeCompilerIdDetection.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCCompiler.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCompileFeatures.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineCompilerId.cmake" + "/usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake" + "/usr/share/cmake-3.22/Modules/CMakeFindBinUtils.cmake" + "/usr/share/cmake-3.22/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.22/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.22/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.22/Modules/CMakeParseImplicitIncludeInfo.cmake" + "/usr/share/cmake-3.22/Modules/CMakeParseImplicitLinkInfo.cmake" + "/usr/share/cmake-3.22/Modules/CMakeParseLibraryArchitecture.cmake" + "/usr/share/cmake-3.22/Modules/CMakeSystem.cmake.in" + "/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake" + "/usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake" + "/usr/share/cmake-3.22/Modules/CMakeTestCompilerCommon.cmake" + "/usr/share/cmake-3.22/Modules/CMakeUnixFindMake.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/ADSP-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/ARMClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Borland-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Clang-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Cray-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GHS-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU-FindBinUtils.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/HP-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/IAR-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Intel-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/MSVC-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/NVHPC-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/PGI-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/PathScale-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/SCO-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/TI-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/Watcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/XL-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/XLClang-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/zOS-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.22/Modules/Internal/FeatureTesting.cmake" + "/usr/share/cmake-3.22/Modules/Platform/Linux-Determine-CXX.cmake" + "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.22/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.22/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/3.22.1/CMakeSystem.cmake" + "CMakeFiles/3.22.1/CMakeCCompiler.cmake" + "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" + "CMakeFiles/3.22.1/CMakeCCompiler.cmake" + "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + ) diff --git a/examples/00_graphics/CMakeFiles/Makefile2 b/examples/00_graphics/CMakeFiles/Makefile2 new file mode 100644 index 00000000..51210666 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/Makefile2 @@ -0,0 +1,86 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.22 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/neo/codac/examples + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/neo/codac/examples/00_graphics + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: +.PHONY : preinstall + +# The main recursive "clean" target. +clean: +.PHONY : clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/examples/00_graphics/CMakeFiles/TargetDirectories.txt b/examples/00_graphics/CMakeFiles/TargetDirectories.txt new file mode 100644 index 00000000..68996981 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,2 @@ +/home/neo/codac/examples/00_graphics/CMakeFiles/edit_cache.dir +/home/neo/codac/examples/00_graphics/CMakeFiles/rebuild_cache.dir diff --git a/examples/00_graphics/CMakeFiles/cmake.check_cache b/examples/00_graphics/CMakeFiles/cmake.check_cache new file mode 100644 index 00000000..3dccd731 --- /dev/null +++ b/examples/00_graphics/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/examples/00_graphics/CMakeFiles/progress.marks b/examples/00_graphics/CMakeFiles/progress.marks new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/examples/00_graphics/CMakeFiles/progress.marks @@ -0,0 +1 @@ +0 diff --git a/examples/00_graphics/Makefile b/examples/00_graphics/Makefile new file mode 100644 index 00000000..093c9a05 --- /dev/null +++ b/examples/00_graphics/Makefile @@ -0,0 +1,140 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.22 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/neo/codac/examples + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/neo/codac/examples/00_graphics + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/neo/codac/examples/00_graphics/CMakeFiles /home/neo/codac/examples/00_graphics//CMakeFiles/progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/neo/codac/examples/00_graphics/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/examples/00_graphics/cmake_install.cmake b/examples/00_graphics/cmake_install.cmake new file mode 100644 index 00000000..92777670 --- /dev/null +++ b/examples/00_graphics/cmake_install.cmake @@ -0,0 +1,54 @@ +# Install script for directory: /home/neo/codac/examples + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/home/neo/codac/build_install") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Release") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/neo/codac/examples/00_graphics/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index b744bd0f..2ff64ecc 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -27,62 +27,77 @@ void export_Color(py::module& m) .value("HSV", InterpolMode::HSV) ; - py::class_ exported_data_rgb(m, "DataRGB", DATARGB_MAIN); - exported_data_rgb - .def_readwrite("r", &DataRGB::r) - .def_readwrite("g", &DataRGB::g) - .def_readwrite("b", &DataRGB::b) - .def_readwrite("a", &DataRGB::a) - .def("to_hex_str", &DataRGB::to_hex_str, STRING_DATARGB_TO_HEX_STR_CONST) - ; - - py::class_ exported_data_hsv(m, "DataHSV", DATAHSV_MAIN); - exported_data_hsv - .def_readwrite("h", &DataHSV::h) - .def_readwrite("s", &DataHSV::s) - .def_readwrite("v", &DataHSV::v) - .def_readwrite("a", &DataHSV::a) - .def("to_rgb", &DataHSV::to_rgb, DATARGB_DATAHSV_TO_RGB_CONST) - .def("to_hex_str", &DataHSV::to_hex_str, STRING_DATAHSV_TO_HEX_STR_CONST) - ; - - py::class_ exported_color(m, "Color", COLOR_MAIN); exported_color .def_readwrite("data", &Color::data, - VARIANT_STRINGDATARGBDATAHSV_COLOR_DATA) + ARRAY_FLOAT4_COLOR_DATA) + + .def_readwrite("interpol_mode", &Color::interpol_mode, + INTERPOLMODE_COLOR_INTERPOL_MODE) .def(py::init<>(),COLOR_COLOR) .def(py::init(), COLOR_COLOR_FLOAT_FLOAT_FLOAT_FLOAT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "alpha"_a=1., "interpol_mode"_a=InterpolMode::RGB) + "x1"_a, "x2"_a, "x3"_a, "alpha"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init(), + COLOR_COLOR_FLOAT_FLOAT_FLOAT_INTERPOLMODE, + "x1"_a, "x2"_a, "x3"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init&,InterpolMode>(), + COLOR_COLOR_CONST_ARRAY_FLOAT3_REF_INTERPOLMODE, + "xyz"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init&,InterpolMode>(), + COLOR_COLOR_CONST_ARRAY_FLOAT4_REF_INTERPOLMODE, + "xyza"_a, "interpol_mode"_a=InterpolMode::RGB) .def(py::init(), COLOR_COLOR_INT_INT_INT_INT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "alpha"_a=255, "interpol_mode"_a=InterpolMode::RGB) + "x1"_a, "x2"_a, "x3"_a, "alpha"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init(), + COLOR_COLOR_INT_INT_INT_INTERPOLMODE, + "x1"_a, "x2"_a, "x3"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init&,InterpolMode>(), + COLOR_COLOR_CONST_ARRAY_INT3_REF_INTERPOLMODE, + "xyz"_a, "interpol_mode"_a=InterpolMode::RGB) + + .def(py::init&,InterpolMode>(), + COLOR_COLOR_CONST_ARRAY_INT4_REF_INTERPOLMODE, + "xyza"_a, "interpol_mode"_a=InterpolMode::RGB) .def(py::init(), COLOR_COLOR_CONST_STRING_REF, "hex_str"_a) + // Conversions + + .def("toRGB", &Color::toRGB, + COLOR_COLOR_TORGB_CONST) + + .def("toHSV", &Color::toHSV, + COLOR_COLOR_TOHSV_CONST) + // Properties .def("hex_str", &Color::hex_str, STRING_COLOR_HEX_STR_CONST) - .def("r", &Color::r, - FLOAT_COLOR_R_CONST) + .def("rgb", &Color::rgb, + ARRAY_INT3_COLOR_RGB_CONST) - .def("g", &Color::g, - FLOAT_COLOR_G_CONST) + .def("rgba", &Color::rgba, + ARRAY_INT3_COLOR_RGB_CONST) - .def("b", &Color::b, - FLOAT_COLOR_B_CONST) + .def("hsv", &Color::hsv, + ARRAY_INT3_COLOR_RGB_CONST) - .def("alpha", &Color::alpha, - FLOAT_COLOR_ALPHA_CONST) + .def("hsva", &Color::hsva, + ARRAY_INT3_COLOR_RGB_CONST) // Predefined colors diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 789cbdc7..9da1d086 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -85,8 +85,8 @@ void Figure2D_IPE::begin_path(const StyleProperties& s, bool tip=false) "; } @@ -543,9 +543,13 @@ void Figure2D_IPE::print_header_page() \n \ \n"; - for(const auto& [k,c] : _colors) - _f << " \n"; + for(auto& [k,c] : _colors) + { + if (c.interpol_mode == InterpolMode::HSV) + c = c.toRGB(); + _f << " \n"; + } _f << " \n \ \n \ diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 00892b65..7590234f 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -12,139 +12,194 @@ using namespace std; using namespace codac2; -std::string DataRGB::to_hex_str() const -{ - stringstream ss; - ss << "#" << hex << setfill('0') << setw(2) << (int)(r*255) << setw(2) << (int)(g*255) << setw(2) << (int)(b*255) << setw(2) << (int)(a*255); - return ss.str(); -} - -DataRGB DataHSV::to_rgb() const -{ - float r = 1., g = 1., b = 1.; - - int i = static_cast(h * 6); - float f = (h * 6) - i; - i = i % 6; - - float p = v * (1 - s); - float q = v * (1 - f * s); - float t = v * (1 - (1 - f) * s); - - switch (i) { - case 0: r = v; g = t; b = p; break; - case 1: r = q; g = v; b = p; break; - case 2: r = p; g = v; b = t; break; - case 3: r = p; g = q; b = v; break; - case 4: r = t; g = p; b = v; break; - case 5: r = v; g = p; b = q; break; - } - - return DataRGB{r, g, b, a}; -} - -std::string DataHSV::to_hex_str() const -{ - return to_rgb().to_hex_str(); -} - Color::Color() - : data("#FFFFFFFF") -{} +{ } Color::Color(float x1, float x2, float x3, float alpha,InterpolMode interpol_mode) + :data({x1,x2,x3,alpha}), interpol_mode(interpol_mode) { assert(x1 >= 0. && x1 <= 1. && x2 >= 0. && x2 <= 1. && x3 >= 0. && x3 <= 1. && alpha >= 0. && alpha <= 1.); - if(interpol_mode == InterpolMode::RGB) - data = DataRGB{x1, x2, x3, alpha}; - else - data = DataHSV{x1, x2, x3, alpha}; } +Color::Color(double x1, double x2, double x3, double alpha, InterpolMode interpol_mode) + : Color((float)x1, (float)x2, (float)x3, (float)alpha, interpol_mode) +{ } + +Color::Color(float x1, float x2, float x3, InterpolMode interpol_mode) + : Color(x1, x2, x3, (float) 1., interpol_mode) +{ } + +Color::Color(double x1, double x2, double x3, InterpolMode interpol_mode) + : Color((float)x1, (float)x2, (float) x3, (float) 1., interpol_mode) +{ } + +Color::Color(const std::array& xyz, InterpolMode interpol_mode) + : Color(xyz[0], xyz[1], xyz[2],(float) 1., interpol_mode) +{ } + +Color::Color(const std::array& xyza, InterpolMode interpol_mode) + : Color(xyza[0], xyza[1], xyza[2], xyza[3], interpol_mode) +{ } + Color::Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode) +: Color(interpol_mode == InterpolMode::RGB ? (float) (x1/255.) : (float) (x1/360.), + interpol_mode == InterpolMode::RGB ? (float) (x2/255.) : (float) (x2/100.), + interpol_mode == InterpolMode::RGB ? (float) (x3/255.) : (float) (x3/100.), + interpol_mode == InterpolMode::RGB ? (float) (alpha/255.) : (float) (alpha/100.), + interpol_mode) { - assert(x1 >= 0 && x1 <= 255 && x2 >= 0 && x2 <= 255 && x3 >= 0 && x3 <= 255 && alpha >= 0 && alpha <= 255); if (interpol_mode == InterpolMode::RGB) - data = DataRGB{(float)x1/255., (float)x2/255., (float)x3/255., (float)alpha/255.}; + { + assert(x1 >= 0 && x1 <= 255 && x2 >= 0 && x2 <= 255 && x3 >= 0 && x3 <= 255 && alpha >= 0 && alpha <= 255); + } else - data = DataHSV{(float)x1/360., (float)x2/100., (float)x3/100., (float)alpha/100.}; + { + assert(x1 >= 0 && x1 <= 360 && x2 >= 0 && x2 <= 100 && x3 >= 0 && x3 <= 100 && alpha >= 0 && alpha <= 100); + } + } +Color::Color(int x1, int x2, int x3, InterpolMode interpol_mode) + : Color(x1, x2, x3,interpol_mode == InterpolMode::RGB ? 255 : 100, interpol_mode) +{ } + +Color::Color(const std::array& xyz, InterpolMode interpol_mode) + : Color(xyz[0], xyz[1], xyz[2], interpol_mode == InterpolMode::RGB ? 255 : 100, interpol_mode) +{ } + +Color::Color(const std::array& xyza, InterpolMode interpol_mode) + : Color(xyza[0], xyza[1], xyza[2], xyza[3], interpol_mode) +{ } + Color::Color(const std::string& hex_str) - : data(hex_str) { assert(hex_str.size() == 7 || hex_str.size() == 9); assert(hex_str[0] == '#'); -} -std::string Color::hex_str() const -{ - switch(data.index()) + interpol_mode = InterpolMode::RGB; + + int red,green,blue,a; + std::istringstream(hex_str.substr(1,2)) >> std::hex >> red; + std::istringstream(hex_str.substr(3,2)) >> std::hex >> green; + std::istringstream(hex_str.substr(5,2)) >> std::hex >> blue; + data[0] = (float) (red/255.); + data[1] = (float) (green/255.); + data[2] = (float) (blue/255.); + + // Alpha (transparency) component may be appended to the #hexa notation. + // Value is '1' (max opacity) by default. + if(hex_str.size() == 9) { - case 0: return std::get<0>(data); - case 1: return std::get<1>(data).to_hex_str(); - case 2: return std::get<2>(data).to_hex_str(); + std::istringstream(hex_str.substr(7,2)) >> std::hex >> a; + data[3] = (float) (a/255.); } - return ""; } -float Color::r() const +Color Color::toRGB() const { - switch(data.index()) + if (interpol_mode==InterpolMode::RGB) + return *this; + else { - case 0: - int r; - std::istringstream(std::get<0>(data).substr(1,2)) >> std::hex >> r; - return (float) r/255.; - case 1: return std::get<1>(data).r; - case 2: return std::get<2>(data).to_rgb().r; + float r = 1., g = 1., b = 1.; + + int i = static_cast(data[0] * 6); + float f = (data[0] * 6) - i; + i = i % 6; + + float p = data[2] * (1 - data[1]); + float q = data[2] * (1 - f * data[1]); + float t = data[2] * (1 - (1 - f) * data[1]); + + switch (i) { + case 0: r = data[2]; g = t; b = p; break; + case 1: r = q; g = data[2]; b = p; break; + case 2: r = p; g = data[2]; b = t; break; + case 3: r = p; g = q; b = data[2]; break; + case 4: r = t; g = p; b = data[2]; break; + case 5: r = data[2]; g = p; b = q; break; + } + + return Color(r, g, b, data[3],InterpolMode::RGB); } - return 0.; } -float Color::g() const +Color Color::toHSV() const { - switch(data.index()) + if (interpol_mode==InterpolMode::HSV) + return *this; + else { - case 0: - int g; - std::istringstream(std::get<0>(data).substr(3,2)) >> std::hex >> g; - return (float) g/255.; - case 1: return std::get<1>(data).g; - case 2: return std::get<2>(data).to_rgb().g; + float c_max = std::max({data[0], data[1], data[2]}); + float c_min = std::min({data[0], data[1], data[2]}); + float delta = c_max - c_min; + + float h = 0.0; + if (delta != 0) { + if (c_max == data[0]) { + h = fmod((data[1] - data[2]) / delta, 6.0); + } else if (c_max == data[1]) { + h = (data[2] - data[0]) / delta + 2.0; + } else if (c_max == data[2]) { + h = (data[0] - data[1]) / delta + 4.0; + } + h /= 6.0; + if (h < 0) { + h += 1.0; + } + } + + float s = (c_max == 0) ? 0 : (delta / c_max); + + float v = c_max; + + return Color(h, s, v, data[3],InterpolMode::HSV); } - return 0.; } -float Color::b() const +std::string Color::hex_str() const { - switch(data.index()) - { - case 0: - int b; - std::istringstream(std::get<0>(data).substr(5,2)) >> std::hex >> b; - return (float) b/255.; - case 1: return std::get<1>(data).b; - case 2: return std::get<2>(data).to_rgb().b; - } - return 0.; + if (interpol_mode == InterpolMode::RGB) + { + std::stringstream s; + s << std::hex << std::setfill('0'); + s << std::setw(2) << (int)(data[0]*255) << std::setw(2) << (int)(data[1]*255) << std::setw(2) << (int)(data[2]*255); + if(data[3] != 1.) + s << std::setw(2) << (int)(data[3]*255); + return "#"+s.str(); + } + else + return toRGB().hex_str(); } -float Color::alpha() const +std::array Color::rgb() const { - switch(data.index()) - { - case 0: - float alpha; - if (std::get<0>(data).size() == 7) - return 1.; - else - { - std::istringstream(std::get<0>(data).substr(7,2)) >> std::hex >> alpha; - return alpha/255.; - } - case 1: return std::get<1>(data).a; - case 2: return std::get<2>(data).a; - } - return 0.; + if (interpol_mode == InterpolMode::RGB) + return { (int)(data[0]*255), (int)(data[1]*255), (int)(data[2]*255) }; + else + return toRGB().rgb(); +} + +std::array Color::rgba() const +{ + if (interpol_mode == InterpolMode::RGB) + return { (int)(data[0]*255), (int)(data[1]*255), (int)(data[2]*255), (int)(data[3]*255) }; + else + return toRGB().rgba(); +} + +std::array Color::hsv() const +{ + if (interpol_mode == InterpolMode::HSV) + return { (int)(data[0]*360), (int)(data[1]*100), (int)(data[2]*100) }; + else + return toHSV().hsv(); +} + +std::array Color::hsva() const +{ + if (interpol_mode == InterpolMode::HSV) + return { (int)(data[0]*360), (int)(data[1]*100), (int)(data[2]*100), (int)(data[3]*100) }; + else + return toHSV().hsva(); } \ No newline at end of file diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index 7eb4f7e1..fbdd7d41 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -11,9 +11,10 @@ #include #include -#include +#include #include"codac2_assert.h" + namespace codac2 { enum class InterpolMode @@ -21,41 +22,41 @@ namespace codac2 RGB = 0x01, HSV = 0x02 }; - /** - * \struct DataRGB - * \brief Represents an RGB value - */ - struct DataRGB { - float r, g, b, a; - std::string to_hex_str() const; - }; - /** - * \struct DataHSV - * \brief Represents an HSV value - */ - struct DataHSV { - float h, s, v, a; - DataRGB to_rgb() const; - std::string to_hex_str() const; - }; - /** - * \struct Color - * \brief Represents an html color - */ + struct Color { - std::variant< std::string, DataRGB, DataHSV > data; + std::array data = {0.,0.,0.,1.0}; // RGB or HSV values + alpha, between 0 and 1 + InterpolMode interpol_mode = InterpolMode::RGB;//RGB or HSV + + // Constructors explicit Color(); - explicit Color(float x1, float x2, float x3, float alpha = 1.,InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(int x1, int x2, int x3, int alpha = 255,InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(float x1, float x2, float x3, float alpha, InterpolMode interpol_mode = InterpolMode::RGB); // RGBA constructor + explicit Color(double x1, double x2, double x3, double alpha, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(float x1, float x2, float x3, InterpolMode interpol_mode = InterpolMode::RGB); // RGB constructor + explicit Color(double x1, double x2, double x3, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(const std::array& xyz, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(const std::array& xyza, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(int x1, int x2, int x3, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(const std::array& xyz, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(const std::array& xyza, InterpolMode interpol_mode = InterpolMode::RGB); explicit Color(const std::string& hex_str); + //Conversions + + Color toRGB() const; + Color toHSV() const; + + // Properties + std::string hex_str() const; - float r() const; - float g() const; - float b() const; - float alpha() const; + std::array rgb() const; + std::array rgba() const; + std::array hsv() const; + std::array hsva() const; + + // Predefined colors static Color none() { return Color(255, 255, 255, 0 ); }; static Color black(float alpha = 1) { return Color(0, 0, 0, (int)(alpha*255)); }; diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 2b729b9d..bbc7ea4f 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -26,7 +26,7 @@ Color ColorMap::color(float r) const { assert (colormap.size() >= 2); if(std::isnan(r)) // undefined ratio - return Color((float)0.5, 0.5, 0.5); + return Color(0.5, 0.5, 0.5); assert(Interval(0.,1.).contains(r)); Interval map_domain = Interval(colormap.begin()->first,prev(colormap.end())->first); @@ -36,15 +36,15 @@ Color ColorMap::color(float r) const { typename map::const_iterator it_ub; it_ub = colormap.lower_bound(real_index); - Color color_lb = prev(it_ub)->second; - Color color_ub = it_ub->second; + Color color_lb = prev(it_ub)->second.toRGB(); + Color color_ub = it_ub->second.toRGB(); float local_ratio = (real_index - prev(it_ub)->first) / (it_ub->first - prev(it_ub)->first); - return Color((float)(color_lb.r() + (color_ub.r() - color_lb.r()) * local_ratio), - (float)(color_lb.g() + (color_ub.g() - color_lb.g()) * local_ratio), - (float)(color_lb.b() + (color_ub.b() - color_lb.b()) * local_ratio), - (float)(color_lb.alpha() + (color_ub.alpha() - color_lb.alpha()) * local_ratio)); + return Color((float)(color_lb.data[0] + (color_ub.data[0] - color_lb.data[0]) * local_ratio), + (float)(color_lb.data[1] + (color_ub.data[1] - color_lb.data[1]) * local_ratio), + (float)(color_lb.data[2] + (color_ub.data[2] - color_lb.data[2]) * local_ratio), + (float)(color_lb.data[3] + (color_ub.data[3] - color_lb.data[3]) * local_ratio)); } diff --git a/src/graphics/styles/codac2_StyleProperties.cpp b/src/graphics/styles/codac2_StyleProperties.cpp index 38e15389..d6b42b8b 100644 --- a/src/graphics/styles/codac2_StyleProperties.cpp +++ b/src/graphics/styles/codac2_StyleProperties.cpp @@ -20,9 +20,13 @@ StyleProperties::StyleProperties(const Color& stroke_color_) { } StyleProperties::StyleProperties(std::initializer_list colors) - : stroke_color(*colors.begin()), fill_color(*std::prev(colors.end())) + : stroke_color(*colors.begin()) { assert(colors.size() <= 2); + if (colors.size() == 1) + fill_color = Color::none(); + else + fill_color = *std::prev(colors.end()); } StyleProperties StyleProperties::inside() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0ac83aa7..1b6c4607 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -78,6 +78,8 @@ list(APPEND SRC_TESTS # listing files without extension core/tools/codac2_tests_Approx + graphics/styles/codac2_tests_Color + ) diff --git a/tests/graphics/styles/codac2_tests_Color.cpp b/tests/graphics/styles/codac2_tests_Color.cpp new file mode 100644 index 00000000..9b356716 --- /dev/null +++ b/tests/graphics/styles/codac2_tests_Color.cpp @@ -0,0 +1,307 @@ +/** + * Codac tests + * ---------------------------------------------------------------------------- + * \date 2024 + * \author Simon Rohou, Maël Godard + * \copyright Copyright 2024 Codac Team + * \license GNU Lesser General Public License (LGPL) + */ + +#include +#include +#include + +using namespace std; +using namespace codac2; + +// Custom Matchers to manage tolerate errors + +// array matcher + +class Array4MatcherWithTolerance : public Catch::Matchers::MatcherBase> { + std::array m_expected; + int m_tolerance; + +public: + Array4MatcherWithTolerance(const std::array& expected, int tolerance) + : m_expected(expected), m_tolerance(tolerance) {} + + bool match(const std::array& actual) const override { + for (size_t i = 0; i < m_expected.size(); ++i) { + if (std::abs(actual[i] - m_expected[i]) > m_tolerance) { + return false; + } + } + return true; + } + + std::string describe() const override { + std::ostringstream oss; + oss << "is close to { "; + for (size_t i = 0; i < m_expected.size(); ++i) { + oss << m_expected[i]; + if (i < m_expected.size() - 1) oss << ", "; + } + oss << " } with tolerance " << m_tolerance; + return oss.str(); + } +}; + +// array matcher + +class Array3MatcherWithTolerance : public Catch::Matchers::MatcherBase> { + std::array m_expected; + int m_tolerance; + +public: + Array3MatcherWithTolerance(const std::array& expected, int tolerance) + : m_expected(expected), m_tolerance(tolerance) {} + + bool match(const std::array& actual) const override { + for (size_t i = 0; i < m_expected.size(); ++i) { + if (std::abs(actual[i] - m_expected[i]) > m_tolerance) { + return false; + } + } + return true; + } + + std::string describe() const override { + std::ostringstream oss; + oss << "is close to { "; + for (size_t i = 0; i < m_expected.size(); ++i) { + oss << m_expected[i]; + if (i < m_expected.size() - 1) oss << ", "; + } + oss << " } with tolerance " << m_tolerance; + return oss.str(); + } +}; + +// HTML color matcher + +class HtmlColorMatcherWithTolerance : public Catch::Matchers::MatcherBase { + std::string m_expected; + int m_tolerance; + + // Helper to convert a hex color to RGB + static std::array hexToRgb(const std::string& hex) { + assert(hex.size() == 7 && hex[0] == '#'); // Ensure format is #RRGGBB + return { + std::stoi(hex.substr(1, 2), nullptr, 16), + std::stoi(hex.substr(3, 2), nullptr, 16), + std::stoi(hex.substr(5, 2), nullptr, 16) + }; + } + +public: + HtmlColorMatcherWithTolerance(const std::string& expected, int tolerance) + : m_expected(expected), m_tolerance(tolerance) { + assert(m_expected.size() == 7 && m_expected[0] == '#'); // Ensure format is #RRGGBB + } + + bool match(const std::string& actual) const override { + if (actual.size() != 7 || actual[0] != '#') { + return false; // Invalid format + } + + auto expectedRgb = hexToRgb(m_expected); + auto actualRgb = hexToRgb(actual); + + for (size_t i = 0; i < 3; ++i) { + if (std::abs(actualRgb[i] - expectedRgb[i]) > m_tolerance) { + return false; + } + } + return true; + } + + std::string describe() const override { + std::ostringstream oss; + oss << "is close to " << m_expected << " with tolerance " << m_tolerance; + return oss.str(); + } +}; + +// RGBA HTML color matcher + +class HtmlColorMatcherWithToleranceRGBA : public Catch::Matchers::MatcherBase { + std::string m_expected; + int m_tolerance; + + // Helper to convert a hex color to RGBA + static std::array hexToRgba(const std::string& hex) { + assert(hex.size() == 9 && hex[0] == '#'); // Ensure format is #RRGGBBAA + return { + std::stoi(hex.substr(1, 2), nullptr, 16), + std::stoi(hex.substr(3, 2), nullptr, 16), + std::stoi(hex.substr(5, 2), nullptr, 16), + std::stoi(hex.substr(7, 2), nullptr, 16) + }; + } + +public: + HtmlColorMatcherWithToleranceRGBA(const std::string& expected, int tolerance) + : m_expected(expected), m_tolerance(tolerance) { + assert(m_expected.size() == 9 && m_expected[0] == '#'); // Ensure format is #RRGGBBAA + } + + bool match(const std::string& actual) const override { + if (actual.size() != 9 || actual[0] != '#') { + return false; // Invalid format + } + + auto expectedRgba = hexToRgba(m_expected); + auto actualRgba = hexToRgba(actual); + + for (size_t i = 0; i < 4; ++i) { + if (std::abs(actualRgba[i] - expectedRgba[i]) > m_tolerance) { + return false; + } + } + return true; + } + + std::string describe() const override { + std::ostringstream oss; + oss << "is close to " << m_expected << " with tolerance " << m_tolerance; + return oss.str(); + } +}; + +inline Array4MatcherWithTolerance IsCloseTo(const std::array& expected, int tolerance = 1) { + return Array4MatcherWithTolerance(expected, tolerance); +} + +inline Array3MatcherWithTolerance IsCloseTo(const std::array& expected, int tolerance = 1) { + return Array3MatcherWithTolerance(expected, tolerance); +} + +inline HtmlColorMatcherWithTolerance IsCloseToHtmlColor(const std::string& expected, int tolerance = 1) { + return HtmlColorMatcherWithTolerance(expected, tolerance); +} + +inline HtmlColorMatcherWithToleranceRGBA IsCloseToHtmlColorRGBA(const std::string& expected, int tolerance = 1) { + return HtmlColorMatcherWithToleranceRGBA(expected, tolerance); +} + + +TEST_CASE("Color") +{ + { + // Red + + std::array d_rgb { 255,0,0 }; + std::array d_rgba { 255,0,0,255 }; + std::array d_hsv { 0,100,100 }; + std::array d_hsva { 0,100,100,100 }; + std::array d_rgb_f { 1.0,0.0,0.0 }; + std::array d_rgba_f { 1.0,0.0,0.0,1.0 }; + std::array d_hsv_f { 0.0,1.0,1.0 }; + std::array d_hsva_f { 0.0,1.0,1.0,1.0 }; + + vector v { + Color(d_rgb, InterpolMode::RGB /* InterpolMode::RGB is default */), + Color(d_rgba, InterpolMode::RGB), + Color(255,0,0, InterpolMode::RGB), + Color(255,0,0,255, InterpolMode::RGB), + Color(d_hsv, InterpolMode::HSV), + Color(d_hsva, InterpolMode::HSV), + Color(0,100,100, InterpolMode::HSV), + Color(0,100,100,100, InterpolMode::HSV), + Color(d_rgb_f, InterpolMode::RGB), + Color(d_rgba_f, InterpolMode::RGB), + Color( 1.0, 0.0, 0.0, InterpolMode::RGB), + Color( 1.0, 0.0, 0.0, 1.0, InterpolMode::RGB), + Color(d_hsv_f, InterpolMode::HSV), + Color(d_hsva_f, InterpolMode::HSV), + Color( 0.0, 1.0, 1.0, InterpolMode::HSV), + Color( 0.0, 1.0, 1.0, 1.0, InterpolMode::HSV), + Color("#FF0000") + }; + + for(const auto& c : v) + { + CHECK_THAT(c.hex_str(), IsCloseToHtmlColor("#ff0000")); + CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 255,0,0})); // return std::array + CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 255,0,0,255})); // return std::array + CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 0,100,100})); // return std::array + CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 0,100,100,100})); // return std::array + } + } + + { + // Pink full opacity + + int a = 255; + std::array d_rgb { 229,128,255 }; + std::array d_rgba { 229,128,255,a }; + std::array d_hsv { 288,50,100 }; + std::array d_hsva { 288,50,100,100}; + std::array d_rgb_f {(float) (229./255.), (float) (128./255.), (float) (255./255.)}; + std::array d_rgba_f {(float) (229./255.), (float) (128./255.), (float) (255./255.), 1.0}; + std::array d_hsv_f {(float) (288./360.), (float) (50./100.), (float) (100./100.)}; + std::array d_hsva_f {(float) (288./360.), (float) (50./100.), (float) (100./100.), 1.0}; + + + vector v { + Color(d_rgb, InterpolMode::RGB /* InterpolMode::RGB is default */), + Color(d_rgba, InterpolMode::RGB), + Color(229,128,255, InterpolMode::RGB), + Color(229,128,255,a, InterpolMode::RGB), + Color(d_hsv, InterpolMode::HSV), + Color(d_hsva, InterpolMode::HSV), + Color(288,50,100, InterpolMode::HSV), + Color(288,50,100,100, InterpolMode::HSV), + Color(d_rgb_f, InterpolMode::RGB), + Color(d_rgba_f, InterpolMode::RGB), + Color( 229./255., 128./255., 255./255., InterpolMode::RGB), + Color( 229./255., 128./255., 255./255., 1.0, InterpolMode::RGB), + Color(d_hsv_f, InterpolMode::HSV), + Color(d_hsva_f, InterpolMode::HSV), + Color( 288./360., 50./100., 100./100., InterpolMode::HSV), + Color( 288./360.,50./100., 100./100., 1.0, InterpolMode::HSV), + Color("#e580ff") + }; + + for(const auto& c : v) + { + CHECK_THAT(c.hex_str(), IsCloseToHtmlColor("#e580ff")); + CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 229,128,255})); // return std::array + CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 229,128,255,a})); // return std::array + CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 288,50,100})); // return std::array + CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 288,50,100,100})); // return std::array + } + } + + { + // Pink 40% opacity + + int a = 0.4*255; + std::array d_rgba { 229,128,255,a }; + std::array d_hsva { 288,50,100,40 }; + std::array d_rgba_f {(float) (229./255.), (float) (128./255.), (float) (255./255.),(float) 0.4}; + std::array d_hsva_f {(float) (288./360.), (float) (50./100.), (float) (100./100.), (float) 0.4}; + + vector v { + Color(d_rgba, InterpolMode::RGB), + Color(229,128,255,a, InterpolMode::RGB), + Color(d_hsva, InterpolMode::HSV), + Color(288,50,100,40, InterpolMode::HSV), + Color(d_rgba_f, InterpolMode::RGB), + Color( 229./255., 128./255., 255./255., 0.4, InterpolMode::RGB), + Color(d_hsva_f, InterpolMode::HSV), + Color( 288./360.,50./100., 100./100., 0.4, InterpolMode::HSV), + Color("#e580ff66") + }; + + for(const auto& c : v) + { + CHECK_THAT(c.hex_str(), IsCloseToHtmlColorRGBA("#e580ff66")); + CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 229,128,255})); // return std::array + CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 229,128,255,a})); // return std::array + CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 288,50,100})); // return std::array + CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 288,50,100,40})); // return std::array + } + } +} \ No newline at end of file diff --git a/tests/graphics/styles/codac2_tests_Color.py b/tests/graphics/styles/codac2_tests_Color.py new file mode 100644 index 00000000..d47baf66 --- /dev/null +++ b/tests/graphics/styles/codac2_tests_Color.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python + +# Codac tests +# ---------------------------------------------------------------------------- +# \date 2024 +# \author Simon Rohou, Maël GODARD +# \copyright Copyright 2024 Codac Team +# \license GNU Lesser General Public License (LGPL) + +import unittest +from codac import * + +class ArrayMatcherWithTolerance: + def __init__(self, expected, tolerance=1): + self.expected = expected + self.tolerance = tolerance + + def match(self, actual): + if len(actual) != len(self.expected): + return False + for i in range(len(self.expected)): + if abs(actual[i] - self.expected[i]).mid() > self.tolerance: + return False + return True + + def describe(self): + return f'is close to {self.expected} with tolerance {self.tolerance}' + + +import re + +class HtmlColorMatcherWithTolerance: + def __init__(self, expected: str, tolerance: int = 1): + assert self._is_valid_color(expected), f"Invalid color format: {expected}" + self.expected = expected + self.tolerance = tolerance + + def _is_valid_color(self, color: str) -> bool: + """Validate the color format as #RRGGBBAA or #RRGGBB.""" + return bool(re.match(r"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$", color)) + + def _hex_to_components(self, hex_color: str): + """Convert a #RRGGBBAA or #RRGGBB color to a tuple of integers.""" + if len(hex_color) == 7: # #RRGGBB + return tuple(int(hex_color[i:i+2], 16) for i in range(1, 7, 2)) + elif len(hex_color) == 9: # #RRGGBBAA + return tuple(int(hex_color[i:i+2], 16) for i in range(1, 9, 2)) + + def match(self, actual: str) -> bool: + """Check if the actual color matches the expected color within the tolerance.""" + if not self._is_valid_color(actual): + return False + + expected_components = self._hex_to_components(self.expected) + actual_components = self._hex_to_components(actual) + + if len(expected_components) != len(actual_components): + return False + + return all(abs(e - a).mid() <= self.tolerance for e, a in zip(expected_components, actual_components)) + + def describe(self) -> str: + """Provide a description of the matcher.""" + return f"is close to {self.expected} with tolerance {self.tolerance}" + + +def is_close_to(expected, tolerance=1): + return ArrayMatcherWithTolerance(expected, tolerance) + +def is_close_to_html_color(expected, tolerance=1): + return HtmlColorMatcherWithTolerance(expected, tolerance) + +class TestColor(unittest.TestCase): + + def test_Color(self): + # Red + + d_rgb = [255, 0, 0] + d_rgba = [255, 0, 0, 255] + d_hsv = [0, 100, 100] + d_hsva = [0, 100, 100, 100] + d_rgb_f= [1.0, 0.0, 0.0] + d_rgba_f= [1.0, 0.0, 0.0, 1.0] + d_hsv_f= [0.0, 1.0, 1.0] + d_hsva_f= [0.0, 1.0, 1.0, 1.0] + + + colors = [ + Color(d_rgb, InterpolMode.RGB), + Color(d_rgba, InterpolMode.RGB), + Color(255, 0, 0, interpol_mode=InterpolMode.RGB), + Color(255, 0, 0, 255, InterpolMode.RGB), + Color(d_hsv, InterpolMode.HSV), + Color(d_hsva, InterpolMode.HSV), + Color(0, 100, 100, interpol_mode=InterpolMode.HSV), + Color(0, 100, 100, 100, InterpolMode.HSV), + Color(d_rgb_f, InterpolMode.RGB), + Color(d_rgba_f, InterpolMode.RGB), + Color(1.0, 0.0, 0.0, interpol_mode=InterpolMode.RGB), + Color(1.0, 0.0, 0.0, 1.0, InterpolMode.RGB), + Color(d_hsv_f, InterpolMode.HSV), + Color(d_hsva_f, InterpolMode.HSV), + Color(0.0, 1.0, 1.0, interpol_mode=InterpolMode.HSV), + Color(0.0, 1.0, 1.0, 1.0, InterpolMode.HSV), + Color("#FF0000") + ] + + for c in colors: + self.assertTrue(is_close_to_html_color("#FF0000").match(c.hex_str())) + self.assertTrue(is_close_to([255, 0, 0]).match(c.rgb())) + self.assertTrue(is_close_to([255, 0, 0, 255]).match(c.rgba())) + self.assertTrue(is_close_to([0, 100, 100]).match(c.hsv())) + self.assertTrue(is_close_to([0, 100, 100, 100]).match(c.hsva())) + + # Pink full opacity + + d_rgb = [229,128,255] + d_rgba = [229,128,255,255] + d_hsv = [288,50,100] + d_hsva = [288,50,100,100] + d_rgb_f = [229.0/255.0, 128.0/255.0, 255.0/255.0] + d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0] + d_hsv_f = [288.0/360.0, 50.0/100.0, 100.0/100.0] + d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0] + + colors = [ + Color(d_rgb, InterpolMode.RGB), + Color(d_rgba, InterpolMode.RGB), + Color(229,128,255, interpol_mode=InterpolMode.RGB), + Color(229,128,255,255, InterpolMode.RGB), + Color(d_hsv, InterpolMode.HSV), + Color(d_hsva, InterpolMode.HSV), + Color(288,50,100, interpol_mode=InterpolMode.HSV), + Color(288,50,100,100, InterpolMode.HSV), + Color(d_rgb_f, InterpolMode.RGB), + Color(d_rgba_f, InterpolMode.RGB), + Color(229.0/255.0, 128.0/255.0, 255.0/255.0, interpol_mode=InterpolMode.RGB), + Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0, InterpolMode.RGB), + Color(d_hsv_f, InterpolMode.HSV), + Color(d_hsva_f, InterpolMode.HSV), + Color(288.0/360.0, 50.0/100.0, 100.0/100.0, interpol_mode=InterpolMode.HSV), + Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0, InterpolMode.HSV), + Color("#E580FF") + ] + + for c in colors: + self.assertTrue(is_close_to_html_color("#E580FF").match(c.hex_str())) + self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) + self.assertTrue(is_close_to([229,128,255,255]).match(c.rgba())) + self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) + self.assertTrue(is_close_to([288,50,100,100]).match(c.hsva())) + + # Pink 40% opacity + + a_rgb=102 + a_hsv=40 + d_rgba = [229,128,255,a_rgb] + d_hsva = [288,50,100,a_hsv] + d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0] + d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0] + + colors = [ + Color(d_rgba, InterpolMode.RGB), + Color(229,128,255,a_rgb, InterpolMode.RGB), + Color(d_hsva, InterpolMode.HSV), + Color(288,50,100,a_hsv, InterpolMode.HSV), + Color(d_rgba_f, InterpolMode.RGB), + Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0, InterpolMode.RGB), + Color(d_hsva_f, InterpolMode.HSV), + Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0, InterpolMode.HSV), + Color("#E580FF66") + ] + for c in colors: + self.assertTrue(is_close_to_html_color("#E580FF66").match(c.hex_str())) + self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) + self.assertTrue(is_close_to([229,128,255,a_rgb]).match(c.rgba())) + self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) + self.assertTrue(is_close_to([288,50,100,a_hsv]).match(c.hsva())) + + + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From 501f91d08f7b5e0c9af7dea7ad7af519b433473f Mon Sep 17 00:00:00 2001 From: godardma Date: Mon, 2 Dec 2024 21:30:20 +0100 Subject: [PATCH 08/15] minor correction --- examples/00_graphics/CMakeCache.txt | 381 --------- .../CMakeFiles/3.22.1/CMakeCCompiler.cmake | 72 -- .../CMakeFiles/3.22.1/CMakeCXXCompiler.cmake | 83 -- .../3.22.1/CMakeDetermineCompilerABI_C.bin | Bin 15968 -> 0 bytes .../3.22.1/CMakeDetermineCompilerABI_CXX.bin | Bin 15992 -> 0 bytes .../CMakeFiles/3.22.1/CMakeSystem.cmake | 15 - .../3.22.1/CompilerIdC/CMakeCCompilerId.c | 803 ------------------ .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 791 ----------------- .../CMakeDirectoryInformation.cmake | 16 - .../00_graphics/CMakeFiles/Makefile.cmake | 121 --- examples/00_graphics/CMakeFiles/Makefile2 | 86 -- .../CMakeFiles/TargetDirectories.txt | 2 - .../00_graphics/CMakeFiles/cmake.check_cache | 1 - .../00_graphics/CMakeFiles/progress.marks | 1 - examples/00_graphics/Makefile | 140 --- examples/00_graphics/cmake_install.cmake | 54 -- 16 files changed, 2566 deletions(-) delete mode 100644 examples/00_graphics/CMakeCache.txt delete mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake delete mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake delete mode 100755 examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin delete mode 100755 examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin delete mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CMakeSystem.cmake delete mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c delete mode 100644 examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp delete mode 100644 examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake delete mode 100644 examples/00_graphics/CMakeFiles/Makefile.cmake delete mode 100644 examples/00_graphics/CMakeFiles/Makefile2 delete mode 100644 examples/00_graphics/CMakeFiles/TargetDirectories.txt delete mode 100644 examples/00_graphics/CMakeFiles/cmake.check_cache delete mode 100644 examples/00_graphics/CMakeFiles/progress.marks delete mode 100644 examples/00_graphics/Makefile delete mode 100644 examples/00_graphics/cmake_install.cmake diff --git a/examples/00_graphics/CMakeCache.txt b/examples/00_graphics/CMakeCache.txt deleted file mode 100644 index e13e7fa5..00000000 --- a/examples/00_graphics/CMakeCache.txt +++ /dev/null @@ -1,381 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /home/neo/codac/examples/00_graphics -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//No help, variable specified on the command line. -BUILD_TESTS:UNINITIALIZED=ON - -//Path to a program. -CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line - -//Path to a program. -CMAKE_AR:FILEPATH=/usr/bin/ar - -//Choose the type of build, options are: None Debug Release RelWithDebInfo -// MinSizeRel ... -CMAKE_BUILD_TYPE:STRING=Release - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 - -//Flags used by the CXX compiler during all build types. -CMAKE_CXX_FLAGS:STRING=-fPIC - -//Flags used by the CXX compiler during DEBUG builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the CXX compiler during MINSIZEREL builds. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the CXX compiler during RELEASE builds. -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the CXX compiler during RELWITHDEBINFO builds. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler -CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 - -//Flags used by the C compiler during all build types. -CMAKE_C_FLAGS:STRING=-fPIC - -//Flags used by the C compiler during DEBUG builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the C compiler during MINSIZEREL builds. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the C compiler during RELEASE builds. -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the C compiler during RELWITHDEBINFO builds. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//Path to a program. -CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND - -//Flags used by the linker during all build types. -CMAKE_EXE_LINKER_FLAGS:STRING= - -//Flags used by the linker during DEBUG builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during MINSIZEREL builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during RELEASE builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during RELWITHDEBINFO builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/home/neo/codac/build_install - -//Path to a program. -CMAKE_LINKER:FILEPATH=/usr/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake - -//Flags used by the linker during the creation of modules during -// all build types. -CMAKE_MODULE_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of modules during -// DEBUG builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of modules during -// MINSIZEREL builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of modules during -// RELEASE builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of modules during -// RELWITHDEBINFO builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/usr/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_DESCRIPTION:STATIC= - -//Value Computed by CMake -CMAKE_PROJECT_HOMEPAGE_URL:STATIC= - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=Project - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib - -//Path to a program. -CMAKE_READELF:FILEPATH=/usr/bin/readelf - -//Flags used by the linker during the creation of shared libraries -// during all build types. -CMAKE_SHARED_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of shared libraries -// during DEBUG builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of shared libraries -// during MINSIZEREL builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of shared libraries -// during RELEASE builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of shared libraries -// during RELWITHDEBINFO builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries -// during all build types. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of static libraries -// during DEBUG builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of static libraries -// during MINSIZEREL builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of static libraries -// during RELEASE builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of static libraries -// during RELWITHDEBINFO builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=/usr/bin/strip - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//No help, variable specified on the command line. -FAST_RELEASE:UNINITIALIZED=1 - -//Value Computed by CMake -Project_BINARY_DIR:STATIC=/home/neo/codac/examples/00_graphics - -//Value Computed by CMake -Project_IS_TOP_LEVEL:STATIC=ON - -//Value Computed by CMake -Project_SOURCE_DIR:STATIC=/home/neo/codac/examples - -//No help, variable specified on the command line. -TEST_EXAMPLES:UNINITIALIZED=ON - -//No help, variable specified on the command line. -WITH_PYTHON:UNINITIALIZED=ON - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: CMAKE_ADDR2LINE -CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/home/neo/codac/examples/00_graphics -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=22 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR -CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB -CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_AR -CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB -CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_DLLTOOL -CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of external makefile project generator. -CMAKE_EXTRA_GENERATOR:INTERNAL= -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Generator instance identifier. -CMAKE_GENERATOR_INSTANCE:INTERNAL= -//Name of generator platform. -CMAKE_GENERATOR_PLATFORM:INTERNAL= -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Source directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/home/neo/codac/examples -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//Platform information initialized -CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_READELF -CMAKE_READELF-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/usr/bin/uname -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 - diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake deleted file mode 100644 index 488ad375..00000000 --- a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCCompiler.cmake +++ /dev/null @@ -1,72 +0,0 @@ -set(CMAKE_C_COMPILER "/usr/bin/cc") -set(CMAKE_C_COMPILER_ARG1 "") -set(CMAKE_C_COMPILER_ID "GNU") -set(CMAKE_C_COMPILER_VERSION "11.4.0") -set(CMAKE_C_COMPILER_VERSION_INTERNAL "") -set(CMAKE_C_COMPILER_WRAPPER "") -set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") -set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") -set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") -set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") -set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") -set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") -set(CMAKE_C17_COMPILE_FEATURES "c_std_17") -set(CMAKE_C23_COMPILE_FEATURES "c_std_23") - -set(CMAKE_C_PLATFORM_ID "Linux") -set(CMAKE_C_SIMULATE_ID "") -set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") -set(CMAKE_C_SIMULATE_VERSION "") - - - - -set(CMAKE_AR "/usr/bin/ar") -set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11") -set(CMAKE_RANLIB "/usr/bin/ranlib") -set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") -set(CMAKE_LINKER "/usr/bin/ld") -set(CMAKE_MT "") -set(CMAKE_COMPILER_IS_GNUCC 1) -set(CMAKE_C_COMPILER_LOADED 1) -set(CMAKE_C_COMPILER_WORKS TRUE) -set(CMAKE_C_ABI_COMPILED TRUE) - -set(CMAKE_C_COMPILER_ENV_VAR "CC") - -set(CMAKE_C_COMPILER_ID_RUN 1) -set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) -set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_C_LINKER_PREFERENCE 10) - -# Save compiler ABI information. -set(CMAKE_C_SIZEOF_DATA_PTR "8") -set(CMAKE_C_COMPILER_ABI "ELF") -set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") -set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") - -if(CMAKE_C_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_C_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") -endif() - -if(CMAKE_C_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") -endif() - -set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") -if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) - set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") -endif() - - - - - -set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") -set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") -set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") -set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake b/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake deleted file mode 100644 index 345e9307..00000000 --- a/examples/00_graphics/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake +++ /dev/null @@ -1,83 +0,0 @@ -set(CMAKE_CXX_COMPILER "/usr/bin/c++") -set(CMAKE_CXX_COMPILER_ARG1 "") -set(CMAKE_CXX_COMPILER_ID "GNU") -set(CMAKE_CXX_COMPILER_VERSION "11.4.0") -set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") -set(CMAKE_CXX_COMPILER_WRAPPER "") -set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") -set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") -set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") -set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") -set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") -set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") -set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") -set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") -set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") - -set(CMAKE_CXX_PLATFORM_ID "Linux") -set(CMAKE_CXX_SIMULATE_ID "") -set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") -set(CMAKE_CXX_SIMULATE_VERSION "") - - - - -set(CMAKE_AR "/usr/bin/ar") -set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-11") -set(CMAKE_RANLIB "/usr/bin/ranlib") -set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") -set(CMAKE_LINKER "/usr/bin/ld") -set(CMAKE_MT "") -set(CMAKE_COMPILER_IS_GNUCXX 1) -set(CMAKE_CXX_COMPILER_LOADED 1) -set(CMAKE_CXX_COMPILER_WORKS TRUE) -set(CMAKE_CXX_ABI_COMPILED TRUE) - -set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") - -set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) -set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) - -foreach (lang C OBJC OBJCXX) - if (CMAKE_${lang}_COMPILER_ID_RUN) - foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) - list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) - endforeach() - endif() -endforeach() - -set(CMAKE_CXX_LINKER_PREFERENCE 30) -set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) - -# Save compiler ABI information. -set(CMAKE_CXX_SIZEOF_DATA_PTR "8") -set(CMAKE_CXX_COMPILER_ABI "ELF") -set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") -set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") - -if(CMAKE_CXX_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_CXX_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") -endif() - -if(CMAKE_CXX_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") -endif() - -set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") -if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) - set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") -endif() - - - - - -set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") -set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") -set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") -set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin b/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin deleted file mode 100755 index a8dc0758bdd947d6c1b6426579ede08176cb0ecb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15968 zcmeHOeQX?85r21f5~umNOB;j9=TcHgTD-BH!~~v2U;azv*%me+unz} zw@2*~nn)=qCIp2FQObuD3IZhhM=Kzqpu&})B9JKL4@#gC3WQ2Qq{M}Q45T?`-kZ6s zH|G`=gh1Lk?arIue7v`_Z|~mT&K^wl_eCQS!PFq$El^6t6_Ox@_6}+QONh;45$sor z6=E*PjS^G(gkqpobT&GZHxb?d9Q|6bQHQTkF!Z2^M~EE#W+P*s(l8fv9OyR(RU`-b zlhgro*4O&e&>2XR`x+l4KjwZv%*|A*vY*;AlWUZhwZz#EMf4N8vWL^5hZPLIA-l$LX|Um(+B&dX zK$r?*ltvLfq-2hVx}~H?`{v@ZOAmeYeBa>8JML+Gy5+eG$s6{f4UQXq&;|+P@f2Yh z`$QYe$B{d~5Lsh4-ip|K*cQXqllu9^d*&yf|MvNZ51g@|%P;JDWWnR_IbZ3>yztW5 z`|etC@4?R;c&cU2x4?8(!g1VKM~ml0tApof!9O<(emCH8@kS9(K*LA-p^dmm_&{hL zm3WJ23E-HAn_&x51^}&2oCAO_!7OXa19Ofv4BL&6y#!61w@OrqQzs zl;H=--T;pAHBAA{gbULg8n?`0r(orr2W${wf(@A^&vHF8Z#e~lGS06~VWtPSnOWPl zN1T#pyMx=3xnjW{v@$tcIECS&S%L_~VKY1Cxx%!wmS;gcWGWsABl%*1f}0R;JG8S- z!7P{TEO-=PXJ$$zHpl+z_O`V@-IFvs^bUQK;P!@%ct}y0f!96_zBZl_oS#v7UMQWS zyv%{=*&t4W4zX{1;!`kvqvHE$48-4${Jo@6UZ?4MlksyDuqh$k1mi59yV^cj1O15X!U2t;U6@emWNQ?^ccW@s^0QNV6oK#?Lm54O1(nL?JuP#&%EE5 z{H<~LcT+nCQ|*=Z9~sBC{1^gMn@eDMd03CFen`dx{82!RV{;xx_ReXq8M=NiwxR3! z)pN1chtTjeaj6 zO@8R2FDoD}ofYglq%Z?v2Eq)483;2FW+2Q!n1L_@VFtnsgc%4k@ULe8 zpVPb=r3d=9cln+-?P=S*&u>4F-rkq#@+M5%E!x>VZo0?ZI*>~D4s;7?C;c-Mo^2Lg zc%-$bKRr0upE6Sez3J`&u#kEyO#+G5mK0e zFau!*!VH8N2s037Ak09RfiMGM2L3lPz;$(8N5?gC@}>udxR8fQb#{wL{u0&Wy@_P5 z*IQ09-})>gnd|oOehG>7f4N#MqWlCE+sT@2kVmP3b$gQV1`y~5#l%mDFCgARyjEXH zGS~1`s7{Z{!Nm~@%;Tt#J=V-3alBPZtc~{{RW)A7lXSgG@?8`Uo(#+5;XJ~vsgyfO z|2L9(TonF4$GATH-;BuhlUtL?E^Y1ZOu68dwf1&>qu$oqUY26}gB=}u+s1VSzj}w5 zk4EuwHE4zTj)3N4ln{*!ZUSD<9?wS<>T<_uK9af62tN_PHxSPAo9)xki1_Mw`FvrO zbp-DAdA_p!0cc>qe7!J!MB3j}t5;?GE6}Jn{_jZpxJYQqlIPd+gzqPun7B;%Ap)Qp zK+cDx-0A8>D{2<^OJNx)IC4PO~_-6sHSC9QT;PvXy zzfQPF_<}>TBID1*Q2Hsw7n;)1*OvITjB|ax`cr_{t1~}O_QAYeBKu&S`DMVVOVu&$ z7sKCq{9Qgnv1`cn+Vvt7e#5_Qre}=^07_nYcvv42*NV+eFK-TExp@go%8TYmu9&fM zX4WgZCDSU8i=kqEEN6RmR&T3sfi>=qX}PWie+m{ncR~!iR^B$V<$QhuTzrxVmfj50 z$~m5wvu9}GXra@-o!#5yzm6u9 z!{Y#P?4_bPY8A3jRd4p*JFzhT_x0^c z4Vr`9J@8+qkcR0(7A`yucte zAF$n$Q!LC7OwhS@&O!&F<5Us)SWfNqks>radmQ%ibn0$Vz6YV(qcp=tv*6E?@>f$$ zd2kzoTX|;)hJ&wB=m#^S;X6)I@O?L4ACX$xavS+uV8b;G z`_J}X7uq86`bJ4YbV9@LAAG+H{}1;Qe}6HCzngx4{@rG-u_5uG|N8*{E3AQd{JidC z-cNqK?hB6J0zIzz*dKmm6%ilBofdc0q_g`B_>dK>n z2M2`nABp|=JboE4G+}>UKUUVGwGaupzqVt4=F_0^`_~-Wln?jA5!jFAtI$A<`{(sp zocx3KbU5rT8UR3y%xgIN-&R9ZgZ=%yHurqC2@3dC8W>*3cyG?*;qO1Z-{P_R+{FdF cQ36^Q2+sW~Ev}vG`!B&C7NCUzhkz*l2~FWervLx| diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin b/examples/00_graphics/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin deleted file mode 100755 index cfa527b53452d63fe64b6a8e2d060ddc5e29a3a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15992 zcmeHOYit}>6~4Q666fh{noyIZ%}^TT5InIR$2dlA){nJk!LK9^1VWh1ddK#VeYmr; z#15f}lorK=pim(~k&r@p6bXJb5+VXo*ea-q@=)_5B&dG^p(u!ix;&RLJg z>z1d4&>U;`-1FV@-FxTUJL@|$XO6{syThT7V5txf3$&sU7l~3u%R8w6Dk@sUO8CBC zY!HjVu9TQtA9WSfx^guiWZUxI(%>{juhF zVodPULhY9IP5mu24-tw#YYMN}nz9njOcgFYzO9xoBL zu}}2Dc%0nz#gJlF)*`kPJ}4cr%Qru~wDafRx&Fk_OXkngD_YMk|HgZ+7a9{U-Mae7 zz72NHPgyIp2*N7S) zj>rEXeEhNt0HsVjhXB6^qpP?Kj5P{Id9_$o`n`LbM1?p8IwET3jq`r;-+Yhj_)+o~ zx;{K%=p$CfNLfcrFkt}=>p91;9X)MW8G$ygpJt)Qhx+uSX`7=~&N1zwzRpxOV-6XK z6!6TX;TS+i<fCh?dbKv=>5w&{bW3oNKp9DlZ zz32&4J7%1<(Di$<3|%iRUaQ`C933x`27gQXZ%?4wd{>*A)}H(QPVKpw3N7@!cImFO z1{&Bz4OA7cjZ|-haWNmqd%O*+MSja(?L=D`i`vx7&I;{R+hQL?DPj5P={9K?H&b z1Q7@#5Jcb~j{rX3c|D2ucMr7Y;E7gtL{E-8_Wt^o1783B_&|4})tS^yJ8LHQ+wl&) zr#}|&>Teg)Px2F!j;UvDc;vOeH$F7f8`ER`UGesQ@R0RJ!rBjc2uKL6uXqL?DPj5P={9K?MFcBEb20oPWo;b@HMI zhPZ-u=vJX3>6zlJqcd6-A>0=KG<{ zQ2jF36yGJioOBK8wWL{b?q7lO`zRe;3{t~9jsg)lXO`Q0fN=KvYtbDq#7RPT$yTU6 zcrq-HhvNvBrqZsY`oECPi4s zzS%zxg^(wom*)%fe?xG$fY&SgAB6(;%jXN@C#C+Uw;2MH%7YGA-25fR4;fGhzi3&m}d^j|Fo-$ITaRc@Tyz&|Xi1)t~azC*Ti zpWyYuc(=siXngB$0C3E-KBKUws}t0YKkqvu@iz%RUzzn7;9&u0yKjC!0eHFm^rr#$ zbt#+riNxpUm0twBTps!hgo`MT#MM`1J99C#egk;9yz<+!o%wm|F9KdJ-~2W5_s3^3 z+@3>!f4=#0z?J#K5t{&iunaEt4BJkFnuSbpxZ9>X#;5=w=j2C5)L}83jIKLreHhcx zbC`pk)kjm=gptydPS(!pMt(vJXVc>;(=n53eR&Vefwy$Swhg!`m~re$F=88OQ%~m8 z=}Dk?EFCI_2YMTtt;|SP_uPv_w9!Rp?=b2K zYZO!BEh8iAcSx3}K4m#h%JjIjNDqh#46b{3d!M{JsY9MU9ta*|E~}3jnIvZCcfG&A zy)WJgD7>Jd$21~nUAqB-M1H)niPWCnfsXcGeW1I0Pi#mZYVUx1oGRCA0L-dGa&Y`J`Q1-c9_L*qu;8iwKE>liA$T_IFh z`e|6v<<72u8pC}PobvD+=ZgP5INmo=we;mO>bJrN_cqL5=zTBrMdAI7YYEW|1ux(K z-WT2{_X^&R_X_?$_44`uIcvr13}rw6eSrNL_C`E@-Vd_Yh|l{$|M(54$Gsr)dB4bd z5Q7VXW5go!d7ozihFcKk^Zt`H?>E6k3N^>3cmztg_hUZq_gM4%@%Y(~^`pSYy(HVb zpJZK6J^9Da12_!@j4AVZf6KZ+j@-Zh_|HN;9uwD>{?F3?Ti(}GGxO%}3qHO=Jl4K{ z+y3UoQ$Bt@5m>(w|LZ<}lnAVoz6tZUcizY6eGhBC?g2L`{`GqSQ0#)^FBIt}SbvI4 zR$R@tyDyyO^L~jnzyHYo{{DXo72f^})B)?yFp)IRKf_m`fO|;3F5&$wzbEPUXPfnP z;8uJ1ynmjl0}zD$Tx-^5{1vFcwa5LJ_K~W~DB!_?;QB{l9?#=f0Yew&^Zv206}^Rs z%J11P=ChuGDlfl8sCPNs54XTPw(mj#G47xDZ4u)8{poO+E-C;(jND5&^S6``x4?X_ zF0DO}Z>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__ibmxl__) && defined(__clang__) -# define COMPILER_ID "XLClang" -# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) -# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) -# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) - - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 -# define COMPILER_ID "XL" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__NVCOMPILER) -# define COMPILER_ID "NVHPC" -# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) -# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) -# if defined(__NVCOMPILER_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__CLANG_FUJITSU) -# define COMPILER_ID "FujitsuClang" -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# define COMPILER_VERSION_INTERNAL_STR __clang_version__ - - -#elif defined(__FUJITSU) -# define COMPILER_ID "Fujitsu" -# if defined(__FCC_version__) -# define COMPILER_VERSION __FCC_version__ -# elif defined(__FCC_major__) -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# endif -# if defined(__fcc_version) -# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) -# elif defined(__FCC_VERSION) -# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) -# endif - - -#elif defined(__ghs__) -# define COMPILER_ID "GHS" -/* __GHS_VERSION_NUMBER = VVVVRP */ -# ifdef __GHS_VERSION_NUMBER -# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) -# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) -# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) -# endif - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__BCC__) -# define COMPILER_ID "Bruce" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__ARMCC_VERSION) && !defined(__clang__) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) -# define COMPILER_ID "ARMClang" - # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) -# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" -#if defined(__VISUALDSPVERSION__) - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" -# if defined(__VER__) && defined(__ICCARM__) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) -# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) -# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) -# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) -# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# endif - -#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) -# define COMPILER_ID "SDCC" -# if defined(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) -# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) -# else - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__MSYS__) -# define PLATFORM_ID "MSYS" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# elif defined(__VXWORKS__) -# define PLATFORM_ID "VxWorks" - -# else /* unknown platform */ -# define PLATFORM_ID -# endif - -#elif defined(__INTEGRITY) -# if defined(INT_178B) -# define PLATFORM_ID "Integrity178" - -# else /* regular Integrity */ -# define PLATFORM_ID "Integrity" -# endif - -#else /* unknown platform */ -# define PLATFORM_ID - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_ARM64EC) -# define ARCHITECTURE_ID "ARM64EC" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM64) -# define ARCHITECTURE_ID "ARM64" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# if defined(__ICCARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__ICCRX__) -# define ARCHITECTURE_ID "RX" - -# elif defined(__ICCRH850__) -# define ARCHITECTURE_ID "RH850" - -# elif defined(__ICCRL78__) -# define ARCHITECTURE_ID "RL78" - -# elif defined(__ICCRISCV__) -# define ARCHITECTURE_ID "RISCV" - -# elif defined(__ICCAVR__) -# define ARCHITECTURE_ID "AVR" - -# elif defined(__ICC430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__ICCV850__) -# define ARCHITECTURE_ID "V850" - -# elif defined(__ICC8051__) -# define ARCHITECTURE_ID "8051" - -# elif defined(__ICCSTM8__) -# define ARCHITECTURE_ID "STM8" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__ghs__) -# if defined(__PPC64__) -# define ARCHITECTURE_ID "PPC64" - -# elif defined(__ppc__) -# define ARCHITECTURE_ID "PPC" - -# elif defined(__ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__x86_64__) -# define ARCHITECTURE_ID "x64" - -# elif defined(__i386__) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__TI_COMPILER_VERSION__) -# if defined(__TI_ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__MSP430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__TMS320C28XX__) -# define ARCHITECTURE_ID "TMS320C28x" - -# elif defined(__TMS320C6X__) || defined(_TMS320C6X) -# define ARCHITECTURE_ID "TMS320C6x" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number. */ -#ifdef COMPILER_VERSION -char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; - -/* Construct a string literal encoding the version number components. */ -#elif defined(COMPILER_VERSION_MAJOR) -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the internal version number. */ -#ifdef COMPILER_VERSION_INTERNAL -char const info_version_internal[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', - 'i','n','t','e','r','n','a','l','[', - COMPILER_VERSION_INTERNAL,']','\0'}; -#elif defined(COMPILER_VERSION_INTERNAL_STR) -char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -#if !defined(__STDC__) && !defined(__clang__) -# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) -# define C_VERSION "90" -# else -# define C_VERSION -# endif -#elif __STDC_VERSION__ > 201710L -# define C_VERSION "23" -#elif __STDC_VERSION__ >= 201710L -# define C_VERSION "17" -#elif __STDC_VERSION__ >= 201000L -# define C_VERSION "11" -#elif __STDC_VERSION__ >= 199901L -# define C_VERSION "99" -#else -# define C_VERSION "90" -#endif -const char* info_language_standard_default = - "INFO" ":" "standard_default[" C_VERSION "]"; - -const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ -#if (defined(__clang__) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__)) && \ - !defined(__STRICT_ANSI__) && !defined(_MSC_VER) - "ON" -#else - "OFF" -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -#ifdef ID_VOID_MAIN -void main() {} -#else -# if defined(__CLASSIC_C__) -int main(argc, argv) int argc; char *argv[]; -# else -int main(int argc, char* argv[]) -# endif -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; - require += info_arch[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef COMPILER_VERSION_INTERNAL - require += info_version_internal[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) - require += info_cray[argc]; -#endif - require += info_language_standard_default[argc]; - require += info_language_extensions_default[argc]; - (void)argv; - return require; -} -#endif diff --git a/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp deleted file mode 100644 index 25c62a8c..00000000 --- a/examples/00_graphics/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp +++ /dev/null @@ -1,791 +0,0 @@ -/* This source file must have a .cpp extension so that all C++ compilers - recognize the extension without flags. Borland does not know .cxx for - example. */ -#ifndef __cplusplus -# error "A C compiler has been selected for C++." -#endif - -#if !defined(__has_include) -/* If the compiler does not have __has_include, pretend the answer is - always no. */ -# define __has_include(x) 0 -#endif - - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__COMO__) -# define COMPILER_ID "Comeau" - /* __COMO_VERSION__ = VRR */ -# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) - -#elif defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# if defined(__GNUC__) -# define SIMULATE_ID "GNU" -# endif - /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, - except that a few beta releases use the old format with V=2021. */ -# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) - /* The third version component from --version is an update index, - but no macro is provided for it. */ -# define COMPILER_VERSION_PATCH DEC(0) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -# elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) -# define COMPILER_ID "IntelLLVM" -#if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -#endif -#if defined(__GNUC__) -# define SIMULATE_ID "GNU" -#endif -/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and - * later. Look for 6 digit vs. 8 digit version number to decide encoding. - * VVVV is no smaller than the current year when a version is released. - */ -#if __INTEL_LLVM_COMPILER < 1000000L -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) -#else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) -#endif -#if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -#endif -#if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -#elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -#endif -#if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -#endif -#if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -#endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_CC) -# define COMPILER_ID "SunPro" -# if __SUNPRO_CC >= 0x5100 - /* __SUNPRO_CC = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# endif - -#elif defined(__HP_aCC) -# define COMPILER_ID "HP" - /* __HP_aCC = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) - -#elif defined(__DECCXX) -# define COMPILER_ID "Compaq" - /* __DECCXX_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) - -#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__ibmxl__) && defined(__clang__) -# define COMPILER_ID "XLClang" -# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) -# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) -# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) - - -#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 -# define COMPILER_ID "XL" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__NVCOMPILER) -# define COMPILER_ID "NVHPC" -# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) -# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) -# if defined(__NVCOMPILER_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__CLANG_FUJITSU) -# define COMPILER_ID "FujitsuClang" -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# define COMPILER_VERSION_INTERNAL_STR __clang_version__ - - -#elif defined(__FUJITSU) -# define COMPILER_ID "Fujitsu" -# if defined(__FCC_version__) -# define COMPILER_VERSION __FCC_version__ -# elif defined(__FCC_major__) -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# endif -# if defined(__fcc_version) -# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) -# elif defined(__FCC_VERSION) -# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) -# endif - - -#elif defined(__ghs__) -# define COMPILER_ID "GHS" -/* __GHS_VERSION_NUMBER = VVVVRP */ -# ifdef __GHS_VERSION_NUMBER -# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) -# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) -# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) -# endif - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__ARMCC_VERSION) && !defined(__clang__) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) -# define COMPILER_ID "ARMClang" - # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) -# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__GNUC__) || defined(__GNUG__) -# define COMPILER_ID "GNU" -# if defined(__GNUC__) -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# else -# define COMPILER_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" -#if defined(__VISUALDSPVERSION__) - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" -# if defined(__VER__) && defined(__ICCARM__) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) -# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) -# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) -# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) -# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__MSYS__) -# define PLATFORM_ID "MSYS" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# elif defined(__VXWORKS__) -# define PLATFORM_ID "VxWorks" - -# else /* unknown platform */ -# define PLATFORM_ID -# endif - -#elif defined(__INTEGRITY) -# if defined(INT_178B) -# define PLATFORM_ID "Integrity178" - -# else /* regular Integrity */ -# define PLATFORM_ID "Integrity" -# endif - -#else /* unknown platform */ -# define PLATFORM_ID - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_ARM64EC) -# define ARCHITECTURE_ID "ARM64EC" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM64) -# define ARCHITECTURE_ID "ARM64" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# if defined(__ICCARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__ICCRX__) -# define ARCHITECTURE_ID "RX" - -# elif defined(__ICCRH850__) -# define ARCHITECTURE_ID "RH850" - -# elif defined(__ICCRL78__) -# define ARCHITECTURE_ID "RL78" - -# elif defined(__ICCRISCV__) -# define ARCHITECTURE_ID "RISCV" - -# elif defined(__ICCAVR__) -# define ARCHITECTURE_ID "AVR" - -# elif defined(__ICC430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__ICCV850__) -# define ARCHITECTURE_ID "V850" - -# elif defined(__ICC8051__) -# define ARCHITECTURE_ID "8051" - -# elif defined(__ICCSTM8__) -# define ARCHITECTURE_ID "STM8" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__ghs__) -# if defined(__PPC64__) -# define ARCHITECTURE_ID "PPC64" - -# elif defined(__ppc__) -# define ARCHITECTURE_ID "PPC" - -# elif defined(__ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__x86_64__) -# define ARCHITECTURE_ID "x64" - -# elif defined(__i386__) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__TI_COMPILER_VERSION__) -# if defined(__TI_ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__MSP430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__TMS320C28XX__) -# define ARCHITECTURE_ID "TMS320C28x" - -# elif defined(__TMS320C6X__) || defined(_TMS320C6X) -# define ARCHITECTURE_ID "TMS320C6x" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number. */ -#ifdef COMPILER_VERSION -char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; - -/* Construct a string literal encoding the version number components. */ -#elif defined(COMPILER_VERSION_MAJOR) -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the internal version number. */ -#ifdef COMPILER_VERSION_INTERNAL -char const info_version_internal[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', - 'i','n','t','e','r','n','a','l','[', - COMPILER_VERSION_INTERNAL,']','\0'}; -#elif defined(COMPILER_VERSION_INTERNAL_STR) -char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L -# if defined(__INTEL_CXX11_MODE__) -# if defined(__cpp_aggregate_nsdmi) -# define CXX_STD 201402L -# else -# define CXX_STD 201103L -# endif -# else -# define CXX_STD 199711L -# endif -#elif defined(_MSC_VER) && defined(_MSVC_LANG) -# define CXX_STD _MSVC_LANG -#else -# define CXX_STD __cplusplus -#endif - -const char* info_language_standard_default = "INFO" ":" "standard_default[" -#if CXX_STD > 202002L - "23" -#elif CXX_STD > 201703L - "20" -#elif CXX_STD >= 201703L - "17" -#elif CXX_STD >= 201402L - "14" -#elif CXX_STD >= 201103L - "11" -#else - "98" -#endif -"]"; - -const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ -#if (defined(__clang__) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__)) && \ - !defined(__STRICT_ANSI__) && !defined(_MSC_VER) - "ON" -#else - "OFF" -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -int main(int argc, char* argv[]) -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef COMPILER_VERSION_INTERNAL - require += info_version_internal[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) - require += info_cray[argc]; -#endif - require += info_language_standard_default[argc]; - require += info_language_extensions_default[argc]; - (void)argv; - return require; -} diff --git a/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake b/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake deleted file mode 100644 index c92a10b9..00000000 --- a/examples/00_graphics/CMakeFiles/CMakeDirectoryInformation.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.22 - -# Relative path conversion top directories. -set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/neo/codac/examples") -set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/neo/codac/examples/00_graphics") - -# Force unix paths in dependencies. -set(CMAKE_FORCE_UNIX_PATHS 1) - - -# The C and CXX include file regular expressions for this directory. -set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") -set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") -set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) -set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/examples/00_graphics/CMakeFiles/Makefile.cmake b/examples/00_graphics/CMakeFiles/Makefile.cmake deleted file mode 100644 index fbd61b2d..00000000 --- a/examples/00_graphics/CMakeFiles/Makefile.cmake +++ /dev/null @@ -1,121 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.22 - -# The generator used is: -set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") - -# The top level Makefile was generated from the following files: -set(CMAKE_MAKEFILE_DEPENDS - "CMakeCache.txt" - "CMakeFiles/3.22.1/CMakeCCompiler.cmake" - "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" - "CMakeFiles/3.22.1/CMakeSystem.cmake" - "../CMakeLists.txt" - "/usr/share/cmake-3.22/Modules/CMakeCCompiler.cmake.in" - "/usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c" - "/usr/share/cmake-3.22/Modules/CMakeCInformation.cmake" - "/usr/share/cmake-3.22/Modules/CMakeCXXCompiler.cmake.in" - "/usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp" - "/usr/share/cmake-3.22/Modules/CMakeCXXInformation.cmake" - "/usr/share/cmake-3.22/Modules/CMakeCommonLanguageInclude.cmake" - "/usr/share/cmake-3.22/Modules/CMakeCompilerIdDetection.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCCompiler.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCompileFeatures.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineCompilerId.cmake" - "/usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake" - "/usr/share/cmake-3.22/Modules/CMakeFindBinUtils.cmake" - "/usr/share/cmake-3.22/Modules/CMakeGenericSystem.cmake" - "/usr/share/cmake-3.22/Modules/CMakeInitializeConfigs.cmake" - "/usr/share/cmake-3.22/Modules/CMakeLanguageInformation.cmake" - "/usr/share/cmake-3.22/Modules/CMakeParseImplicitIncludeInfo.cmake" - "/usr/share/cmake-3.22/Modules/CMakeParseImplicitLinkInfo.cmake" - "/usr/share/cmake-3.22/Modules/CMakeParseLibraryArchitecture.cmake" - "/usr/share/cmake-3.22/Modules/CMakeSystem.cmake.in" - "/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInformation.cmake" - "/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInitialize.cmake" - "/usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake" - "/usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake" - "/usr/share/cmake-3.22/Modules/CMakeTestCompilerCommon.cmake" - "/usr/share/cmake-3.22/Modules/CMakeUnixFindMake.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/ADSP-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/ARMCC-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/ARMClang-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/AppleClang-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Borland-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/CMakeCommonCompilerMacros.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Clang-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Cray-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GHS-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU-C.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU-CXX.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU-FindBinUtils.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/GNU.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/HP-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/IAR-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Intel-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/MSVC-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/NVHPC-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/PGI-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/PathScale-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/SCO-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/TI-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/Watcom-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/XL-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/XLClang-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/zOS-C-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" - "/usr/share/cmake-3.22/Modules/Internal/FeatureTesting.cmake" - "/usr/share/cmake-3.22/Modules/Platform/Linux-Determine-CXX.cmake" - "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-C.cmake" - "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-CXX.cmake" - "/usr/share/cmake-3.22/Modules/Platform/Linux-GNU.cmake" - "/usr/share/cmake-3.22/Modules/Platform/Linux.cmake" - "/usr/share/cmake-3.22/Modules/Platform/UnixPaths.cmake" - ) - -# The corresponding makefile is: -set(CMAKE_MAKEFILE_OUTPUTS - "Makefile" - "CMakeFiles/cmake.check_cache" - ) - -# Byproducts of CMake generate step: -set(CMAKE_MAKEFILE_PRODUCTS - "CMakeFiles/3.22.1/CMakeSystem.cmake" - "CMakeFiles/3.22.1/CMakeCCompiler.cmake" - "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" - "CMakeFiles/3.22.1/CMakeCCompiler.cmake" - "CMakeFiles/3.22.1/CMakeCXXCompiler.cmake" - "CMakeFiles/CMakeDirectoryInformation.cmake" - ) - -# Dependency information for all targets: -set(CMAKE_DEPEND_INFO_FILES - ) diff --git a/examples/00_graphics/CMakeFiles/Makefile2 b/examples/00_graphics/CMakeFiles/Makefile2 deleted file mode 100644 index 51210666..00000000 --- a/examples/00_graphics/CMakeFiles/Makefile2 +++ /dev/null @@ -1,86 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.22 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/neo/codac/examples - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/neo/codac/examples/00_graphics - -#============================================================================= -# Directory level rules for the build root directory - -# The main recursive "all" target. -all: -.PHONY : all - -# The main recursive "preinstall" target. -preinstall: -.PHONY : preinstall - -# The main recursive "clean" target. -clean: -.PHONY : clean - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/examples/00_graphics/CMakeFiles/TargetDirectories.txt b/examples/00_graphics/CMakeFiles/TargetDirectories.txt deleted file mode 100644 index 68996981..00000000 --- a/examples/00_graphics/CMakeFiles/TargetDirectories.txt +++ /dev/null @@ -1,2 +0,0 @@ -/home/neo/codac/examples/00_graphics/CMakeFiles/edit_cache.dir -/home/neo/codac/examples/00_graphics/CMakeFiles/rebuild_cache.dir diff --git a/examples/00_graphics/CMakeFiles/cmake.check_cache b/examples/00_graphics/CMakeFiles/cmake.check_cache deleted file mode 100644 index 3dccd731..00000000 --- a/examples/00_graphics/CMakeFiles/cmake.check_cache +++ /dev/null @@ -1 +0,0 @@ -# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/examples/00_graphics/CMakeFiles/progress.marks b/examples/00_graphics/CMakeFiles/progress.marks deleted file mode 100644 index 573541ac..00000000 --- a/examples/00_graphics/CMakeFiles/progress.marks +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/examples/00_graphics/Makefile b/examples/00_graphics/Makefile deleted file mode 100644 index 093c9a05..00000000 --- a/examples/00_graphics/Makefile +++ /dev/null @@ -1,140 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.22 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/neo/codac/examples - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/neo/codac/examples/00_graphics - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." - /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/neo/codac/examples/00_graphics/CMakeFiles /home/neo/codac/examples/00_graphics//CMakeFiles/progress.marks - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/neo/codac/examples/00_graphics/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... rebuild_cache" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/examples/00_graphics/cmake_install.cmake b/examples/00_graphics/cmake_install.cmake deleted file mode 100644 index 92777670..00000000 --- a/examples/00_graphics/cmake_install.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Install script for directory: /home/neo/codac/examples - -# Set the install prefix -if(NOT DEFINED CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "/home/neo/codac/build_install") -endif() -string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - -# Set the install configuration name. -if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) - if(BUILD_TYPE) - string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" - CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") - else() - set(CMAKE_INSTALL_CONFIG_NAME "Release") - endif() - message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") -endif() - -# Set the component getting installed. -if(NOT CMAKE_INSTALL_COMPONENT) - if(COMPONENT) - message(STATUS "Install component: \"${COMPONENT}\"") - set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") - else() - set(CMAKE_INSTALL_COMPONENT) - endif() -endif() - -# Install shared libraries without execute permission? -if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) - set(CMAKE_INSTALL_SO_NO_EXE "1") -endif() - -# Is this installation the result of a crosscompile? -if(NOT DEFINED CMAKE_CROSSCOMPILING) - set(CMAKE_CROSSCOMPILING "FALSE") -endif() - -# Set default install directory permissions. -if(NOT DEFINED CMAKE_OBJDUMP) - set(CMAKE_OBJDUMP "/usr/bin/objdump") -endif() - -if(CMAKE_INSTALL_COMPONENT) - set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") -else() - set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") -endif() - -string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT - "${CMAKE_INSTALL_MANIFEST_FILES}") -file(WRITE "/home/neo/codac/examples/00_graphics/${CMAKE_INSTALL_MANIFEST}" - "${CMAKE_INSTALL_MANIFEST_CONTENT}") From eeb8295f7aaf2461080d22a5c639e2a2ccccca20 Mon Sep 17 00:00:00 2001 From: godardma Date: Mon, 2 Dec 2024 21:31:43 +0100 Subject: [PATCH 09/15] minor correction --- examples/00_graphics/graphic_examples.py | 2 +- tests/graphics/styles/codac2_tests_Color.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index 4d8549bb..539bc6ee 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -46,7 +46,7 @@ fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)]) fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)]) fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) -fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color(0.305555556,0.9,0.78,interpol_mode=InterpolMode.HSV),Color(0.305555556,0.9,0.78,0.2,InterpolMode.HSV)]) +fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color(0.30,0.9,0.78,interpol_mode=InterpolMode.HSV),Color(0.30,0.9,0.78,0.2,InterpolMode.HSV)]) fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) fig3.set_axes(axis(0,[-1,21]), axis(1,[-5.5,0.5])) diff --git a/tests/graphics/styles/codac2_tests_Color.py b/tests/graphics/styles/codac2_tests_Color.py index d47baf66..fb52703a 100644 --- a/tests/graphics/styles/codac2_tests_Color.py +++ b/tests/graphics/styles/codac2_tests_Color.py @@ -3,7 +3,7 @@ # Codac tests # ---------------------------------------------------------------------------- # \date 2024 -# \author Simon Rohou, Maël GODARD +# \author Simon Rohou, Maël Godard # \copyright Copyright 2024 Codac Team # \license GNU Lesser General Public License (LGPL) From f12cd831223240641e74bce14e9c6bed7a0c3dc9 Mon Sep 17 00:00:00 2001 From: godardma Date: Tue, 3 Dec 2024 17:12:34 +0100 Subject: [PATCH 10/15] [graphics] modified Color and Colormap representations --- examples/00_graphics/graphic_examples.py | 14 +- .../src/graphics/styles/codac2_py_Color.cpp | 81 +++----- .../graphics/styles/codac2_py_ColorMap.cpp | 31 +-- src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 52 +++-- src/graphics/styles/codac2_Color.cpp | 196 +++++++----------- src/graphics/styles/codac2_Color.h | 86 ++++---- src/graphics/styles/codac2_ColorMap.cpp | 129 ++---------- src/graphics/styles/codac2_ColorMap.h | 95 ++++++++- 8 files changed, 301 insertions(+), 383 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index 539bc6ee..c7015a1d 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -23,7 +23,7 @@ fig1.set_window_properties([50,50],[500,500]) # position, window size fig1.set_axes(axis(0,[-10,10]), axis(1,[-10,10])) # (axis_id,[range_of_values_on_this_axis]) fig1.draw_box([[-1,1],[-1,1]],[Color.green(),Color.red(0.2)]) # drawing a green box with red opacity values inside -fig1.draw_circle([1,1],0.5,Color(255,155,5)) # drawing a circle at (1,1) of radius 0.5 with a custom RGB color +fig1.draw_circle([1,1],0.5,Color([255,155,5])) # drawing a circle at (1,1) of radius 0.5 with a custom RGB color fig1.draw_ring([1,1],[4,6],Color.red()) # drawing a ring at (1,1) of radius [4,6] with a predefined red color fig2 = Figure2D("My figure 2", GraphicOutput.VIBES | GraphicOutput.IPE) @@ -46,17 +46,17 @@ fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)]) fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)]) fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) -fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color(0.30,0.9,0.78,interpol_mode=InterpolMode.HSV),Color(0.30,0.9,0.78,0.2,InterpolMode.HSV)]) +fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color([108,90,78],Model.HSV),Color([108,90,78,20],Model.HSV)]) fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) fig3.set_axes(axis(0,[-1,21]), axis(1,[-5.5,0.5])) fig3.set_window_properties([800,250],[500,500]) -cmap_haxby=ColorMap.HAXBY -cmap_default=ColorMap.DEFAULT -cmap_blue_tube=ColorMap.BLUE_TUBE -cmap_red_tube=ColorMap.RED_TUBE -cmap_rainbow=ColorMap.RAINBOW +cmap_haxby=ColorMap.haxby() +cmap_default=ColorMap.basic() +cmap_blue_tube=ColorMap.blue_tube() +cmap_red_tube=ColorMap.red_tube() +cmap_rainbow=ColorMap.rainbow() for i in range (20): ratio=i/20 diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index 2ff64ecc..1660c94a 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -22,82 +22,57 @@ using namespace pybind11::literals; void export_Color(py::module& m) { - py::enum_(m, "InterpolMode") - .value("RGB", InterpolMode::RGB) - .value("HSV", InterpolMode::HSV) + + py::enum_(m, "Model") + .value("RGB", Color::Model::RGB) + .value("HSV", Color::Model::HSV) ; py::class_ exported_color(m, "Color", COLOR_MAIN); exported_color - - .def_readwrite("data", &Color::data, - ARRAY_FLOAT4_COLOR_DATA) - - .def_readwrite("interpol_mode", &Color::interpol_mode, - INTERPOLMODE_COLOR_INTERPOL_MODE) + + .def_readwrite("m", &Color::m, + MODEL_COLOR_M) .def(py::init<>(),COLOR_COLOR) - .def(py::init(), - COLOR_COLOR_FLOAT_FLOAT_FLOAT_FLOAT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "alpha"_a, "interpol_mode"_a=InterpolMode::RGB) - - .def(py::init(), - COLOR_COLOR_FLOAT_FLOAT_FLOAT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "interpol_mode"_a=InterpolMode::RGB) - - .def(py::init&,InterpolMode>(), - COLOR_COLOR_CONST_ARRAY_FLOAT3_REF_INTERPOLMODE, - "xyz"_a, "interpol_mode"_a=InterpolMode::RGB) - - .def(py::init&,InterpolMode>(), - COLOR_COLOR_CONST_ARRAY_FLOAT4_REF_INTERPOLMODE, - "xyza"_a, "interpol_mode"_a=InterpolMode::RGB) - - .def(py::init(), - COLOR_COLOR_INT_INT_INT_INT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "alpha"_a, "interpol_mode"_a=InterpolMode::RGB) - - .def(py::init(), - COLOR_COLOR_INT_INT_INT_INTERPOLMODE, - "x1"_a, "x2"_a, "x3"_a, "interpol_mode"_a=InterpolMode::RGB) + .def(py::init&,Color::Model>(), + COLOR_COLOR_CONST_ARRAY_FLOAT3_REF_MODEL, + "xyz"_a, "m_"_a=Color::Model::RGB) - .def(py::init&,InterpolMode>(), - COLOR_COLOR_CONST_ARRAY_INT3_REF_INTERPOLMODE, - "xyz"_a, "interpol_mode"_a=InterpolMode::RGB) + .def(py::init&,Color::Model>(), + COLOR_COLOR_CONST_ARRAY_FLOAT4_REF_MODEL, + "xyza"_a, "m_"_a=Color::Model::RGB) - .def(py::init&,InterpolMode>(), - COLOR_COLOR_CONST_ARRAY_INT4_REF_INTERPOLMODE, - "xyza"_a, "interpol_mode"_a=InterpolMode::RGB) + .def(py::init&,Color::Model>(), + COLOR_COLOR_CONST_INITIALIZER_LIST_FLOAT_MODEL, + "xyza"_a, "m_"_a=Color::Model::RGB) .def(py::init(), COLOR_COLOR_CONST_STRING_REF, "hex_str"_a) - // Conversions - - .def("toRGB", &Color::toRGB, - COLOR_COLOR_TORGB_CONST) - .def("toHSV", &Color::toHSV, - COLOR_COLOR_TOHSV_CONST) - - // Properties + // Html color .def("hex_str", &Color::hex_str, STRING_COLOR_HEX_STR_CONST) - .def("rgb", &Color::rgb, - ARRAY_INT3_COLOR_RGB_CONST) + // Conversions - .def("rgba", &Color::rgba, - ARRAY_INT3_COLOR_RGB_CONST) + .def("rgb", &Color::rgb, + COLOR_COLOR_RGB_CONST) .def("hsv", &Color::hsv, - ARRAY_INT3_COLOR_RGB_CONST) + COLOR_COLOR_HSV_CONST) + + // Overload flux operator - .def("hsva", &Color::hsva, - ARRAY_INT3_COLOR_RGB_CONST) + .def("__str__", [](const Color& c) { + std::ostringstream oss; + oss << c; + return oss.str(); + }) // Predefined colors diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 11b66b9d..2c7c28b2 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -23,35 +23,26 @@ void export_ColorMap(py::module& m) py::class_ exported_colormap(m, "ColorMap", COLORMAP_MAIN); exported_colormap - .def_readwrite("colormap", &ColorMap::colormap) - - .def(py::init<>(), - COLORMAP_COLORMAP) - - .def("add_color_point", &ColorMap::add_color_point, - VOID_COLORMAP_ADD_COLOR_POINT_COLOR_FLOAT, - "color"_a, "index"_a) - .def("color", &ColorMap::color, COLOR_COLORMAP_COLOR_FLOAT_CONST, "r"_a) // Predifined color maps - .def_readonly_static("HAXBY", &ColorMap::HAXBY, - CONST_COLORMAP_COLORMAP_HAXBY) - - .def_readonly_static("DEFAULT", &ColorMap::DEFAULT, - CONST_COLORMAP_COLORMAP_DEFAULT) + .def_static("haxby", &ColorMap::haxby, + STATIC_COLORMAP_COLORMAP_HAXBY) + + .def_static("basic", &ColorMap::basic, + STATIC_COLORMAP_COLORMAP_BASIC) - .def_readonly_static("BLUE_TUBE", &ColorMap::BLUE_TUBE, - CONST_COLORMAP_COLORMAP_BLUE_TUBE) + .def_static("blue_tube", &ColorMap::blue_tube, + STATIC_COLORMAP_COLORMAP_BLUE_TUBE) - .def_readonly_static("RED_TUBE", &ColorMap::RED_TUBE, - CONST_COLORMAP_COLORMAP_RED_TUBE) + .def_static("red_tube", &ColorMap::red_tube, + STATIC_COLORMAP_COLORMAP_RED_TUBE) - .def_readonly_static("RAINBOW", &ColorMap::RAINBOW, - CONST_COLORMAP_COLORMAP_RAINBOW) + .def_static("rainbow", &ColorMap::rainbow, + STATIC_COLORMAP_COLORMAP_RAINBOW) ; } \ No newline at end of file diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 9da1d086..9981b3e5 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -75,18 +75,28 @@ void Figure2D_IPE::center_viewbox([[maybe_unused]] const Vector& c, [[maybe_unus assert(r.min_coeff() > 0.); } +std::string ipe_str(const Color& c) +{ + return " codac_color_" + c.hex_str().substr(1); +} + +int ipe_opacity(const Color& c) +{ + return (int)(10.*round(10.*(c.m==Color::RGB ? (c[3]/255.):(c[3]/100.)))); +} + void Figure2D_IPE::begin_path(const StyleProperties& s, bool tip=false) { // substr is needed to remove the "#" at the beginning of hex_str (deprecated by IPE) - _colors.emplace(s.stroke_color.hex_str().substr(1), s.stroke_color); - _colors.emplace(s.fill_color.hex_str().substr(1), s.fill_color); + _colors.emplace(ipe_str(s.stroke_color), s.stroke_color); + _colors.emplace(ipe_str(s.fill_color), s.fill_color); _f_temp_content << "\n \ "; } @@ -545,10 +555,10 @@ void Figure2D_IPE::print_header_page() for(auto& [k,c] : _colors) { - if (c.interpol_mode == InterpolMode::HSV) - c = c.toRGB(); + if (c.m == Color::HSV) + c = c.rgb(); _f << " \n"; + << "value=\"" << (float) (c[0]/255.) << " " <<(float) (c[1]/255.) << " " <<(float) (c[2]/255.) << "\" /> \n"; } _f << " \n \ diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 7590234f..b121e943 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -13,62 +13,38 @@ using namespace std; using namespace codac2; Color::Color() -{ } - -Color::Color(float x1, float x2, float x3, float alpha,InterpolMode interpol_mode) - :data({x1,x2,x3,alpha}), interpol_mode(interpol_mode) + : m(RGB) { - assert(x1 >= 0. && x1 <= 1. && x2 >= 0. && x2 <= 1. && x3 >= 0. && x3 <= 1. && alpha >= 0. && alpha <= 1.); + (*this)[0] = 0.; + (*this)[1] = 0.; + (*this)[2] = 0.; + (*this)[3] = 0.; } -Color::Color(double x1, double x2, double x3, double alpha, InterpolMode interpol_mode) - : Color((float)x1, (float)x2, (float)x3, (float)alpha, interpol_mode) -{ } - -Color::Color(float x1, float x2, float x3, InterpolMode interpol_mode) - : Color(x1, x2, x3, (float) 1., interpol_mode) -{ } - -Color::Color(double x1, double x2, double x3, InterpolMode interpol_mode) - : Color((float)x1, (float)x2, (float) x3, (float) 1., interpol_mode) -{ } - -Color::Color(const std::array& xyz, InterpolMode interpol_mode) - : Color(xyz[0], xyz[1], xyz[2],(float) 1., interpol_mode) -{ } - -Color::Color(const std::array& xyza, InterpolMode interpol_mode) - : Color(xyza[0], xyza[1], xyza[2], xyza[3], interpol_mode) -{ } - -Color::Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode) -: Color(interpol_mode == InterpolMode::RGB ? (float) (x1/255.) : (float) (x1/360.), - interpol_mode == InterpolMode::RGB ? (float) (x2/255.) : (float) (x2/100.), - interpol_mode == InterpolMode::RGB ? (float) (x3/255.) : (float) (x3/100.), - interpol_mode == InterpolMode::RGB ? (float) (alpha/255.) : (float) (alpha/100.), - interpol_mode) +Color::Color(const std::array& xyz, Model m_) + : m(m_) { - if (interpol_mode == InterpolMode::RGB) - { - assert(x1 >= 0 && x1 <= 255 && x2 >= 0 && x2 <= 255 && x3 >= 0 && x3 <= 255 && alpha >= 0 && alpha <= 255); - } - else - { - assert(x1 >= 0 && x1 <= 360 && x2 >= 0 && x2 <= 100 && x3 >= 0 && x3 <= 100 && alpha >= 0 && alpha <= 100); - } - + (*this)[0] = xyz[0]; + (*this)[1] = xyz[1]; + (*this)[2] = xyz[2]; + (*this)[3] = (m == RGB ? 255. : 100.); } -Color::Color(int x1, int x2, int x3, InterpolMode interpol_mode) - : Color(x1, x2, x3,interpol_mode == InterpolMode::RGB ? 255 : 100, interpol_mode) -{ } - -Color::Color(const std::array& xyz, InterpolMode interpol_mode) - : Color(xyz[0], xyz[1], xyz[2], interpol_mode == InterpolMode::RGB ? 255 : 100, interpol_mode) -{ } +Color::Color(const std::array& xyza, Model m_) + : m(m_) +{ + if (m_==RGB) + assert(xyza[0] >= 0. && xyza[0] <= 255. && xyza[1]>=0. && xyza[1] <= 255. && xyza[2]>=0. && xyza[2] <= 255. && xyza[3]>=0. && xyza[3] <= 255.); + else if (m_==HSV) + assert(xyza[0] >= 0. && xyza[0] <= 360. && xyza[1]>=0. && xyza[1] <= 100. && xyza[2]>=0. && xyza[2] <= 100. && xyza[3]>=0. && xyza[3] <= 100.); + (*this)[0] = xyza[0]; + (*this)[1] = xyza[1]; + (*this)[2] = xyza[2]; + (*this)[3] = xyza[3]; +} -Color::Color(const std::array& xyza, InterpolMode interpol_mode) - : Color(xyza[0], xyza[1], xyza[2], xyza[3], interpol_mode) +Color::Color(const std::initializer_list xyza, Model m_) + : Color(xyza.size() == 3 ? Color(to_array<3>(xyza), m_) : Color(to_array<4>(xyza), m_)) { } Color::Color(const std::string& hex_str) @@ -76,72 +52,84 @@ Color::Color(const std::string& hex_str) assert(hex_str.size() == 7 || hex_str.size() == 9); assert(hex_str[0] == '#'); - interpol_mode = InterpolMode::RGB; + m = RGB; int red,green,blue,a; std::istringstream(hex_str.substr(1,2)) >> std::hex >> red; std::istringstream(hex_str.substr(3,2)) >> std::hex >> green; std::istringstream(hex_str.substr(5,2)) >> std::hex >> blue; - data[0] = (float) (red/255.); - data[1] = (float) (green/255.); - data[2] = (float) (blue/255.); + (*this)[0] = (float) (red); + (*this)[1] = (float) (green); + (*this)[2] = (float) (blue); // Alpha (transparency) component may be appended to the #hexa notation. - // Value is '1' (max opacity) by default. + // Value is '255.' (max opacity) by default. if(hex_str.size() == 9) { std::istringstream(hex_str.substr(7,2)) >> std::hex >> a; - data[3] = (float) (a/255.); + (*this)[3] = (float) (a); } + else + (*this)[3] = 255.; } -Color Color::toRGB() const +Color Color::rgb() const { - if (interpol_mode==InterpolMode::RGB) + if (m==RGB) return *this; else { - float r = 1., g = 1., b = 1.; + float r = 0., g = 0., b = 0.; + + // Normalisation des valeurs + float h = (*this)[0] / 360.; // Hue normalisée (0 à 1) + float s = (*this)[1] / 100.; // Saturation normalisée (0 à 1) + float v = (*this)[2] / 100.; // Value normalisée (0 à 1) - int i = static_cast(data[0] * 6); - float f = (data[0] * 6) - i; + int i = static_cast(h * 6); + float f = (h * 6) - i; i = i % 6; - float p = data[2] * (1 - data[1]); - float q = data[2] * (1 - f * data[1]); - float t = data[2] * (1 - (1 - f) * data[1]); + float p = v * (1 - s); + float q = v * (1 - f * s); + float t = v * (1 - (1 - f) * s); switch (i) { - case 0: r = data[2]; g = t; b = p; break; - case 1: r = q; g = data[2]; b = p; break; - case 2: r = p; g = data[2]; b = t; break; - case 3: r = p; g = q; b = data[2]; break; - case 4: r = t; g = p; b = data[2]; break; - case 5: r = data[2]; g = p; b = q; break; + case 0: r = v; g = t; b = p; break; + case 1: r = q; g = v; b = p; break; + case 2: r = p; g = v; b = t; break; + case 3: r = p; g = q; b = v; break; + case 4: r = t; g = p; b = v; break; + case 5: r = v; g = p; b = q; break; } - return Color(r, g, b, data[3],InterpolMode::RGB); + // Conversion vers l'échelle [0, 255] + r *= 255.; + g *= 255.; + b *= 255.; + + return Color({r, g, b,(float) ((*this)[3]*2.55)},RGB); } } -Color Color::toHSV() const +Color Color::hsv() const { - if (interpol_mode==InterpolMode::HSV) + if (m==HSV) return *this; else { - float c_max = std::max({data[0], data[1], data[2]}); - float c_min = std::min({data[0], data[1], data[2]}); + float c_max = std::max({(*this)[0], (*this)[1], (*this)[2]}); + float c_min = std::min({(*this)[0], (*this)[1], (*this)[2]}); float delta = c_max - c_min; float h = 0.0; if (delta != 0) { - if (c_max == data[0]) { - h = fmod((data[1] - data[2]) / delta, 6.0); - } else if (c_max == data[1]) { - h = (data[2] - data[0]) / delta + 2.0; - } else if (c_max == data[2]) { - h = (data[0] - data[1]) / delta + 4.0; + if (c_max == (*this)[0]) { + h = fmod(((*this)[1] - (*this)[2]) / delta, 6.0); + } else if (c_max == (*this)[1]) { + h = ((*this)[2] - (*this)[0]) / delta + 2.0; + } else if (c_max == (*this)[2]) { + h = ((*this)[0] - (*this)[1]) / delta + 4.0; } h /= 6.0; if (h < 0) { @@ -153,53 +141,25 @@ Color Color::toHSV() const float v = c_max; - return Color(h, s, v, data[3],InterpolMode::HSV); + h*=360.; + s*=100.; + v*=100.; + + return Color({h, s, v,(float) ((*this)[3]/2.55)},HSV); } } std::string Color::hex_str() const { - if (interpol_mode == InterpolMode::RGB) + if (m == RGB) { std::stringstream s; s << std::hex << std::setfill('0'); - s << std::setw(2) << (int)(data[0]*255) << std::setw(2) << (int)(data[1]*255) << std::setw(2) << (int)(data[2]*255); - if(data[3] != 1.) - s << std::setw(2) << (int)(data[3]*255); + s << std::setw(2) << (int)((*this)[0]) << std::setw(2) << (int)((*this)[1]) << std::setw(2) << (int)((*this)[2]); + if((*this)[3] != 1.) + s << std::setw(2) << (int)((*this)[3]); return "#"+s.str(); } else - return toRGB().hex_str(); -} - -std::array Color::rgb() const -{ - if (interpol_mode == InterpolMode::RGB) - return { (int)(data[0]*255), (int)(data[1]*255), (int)(data[2]*255) }; - else - return toRGB().rgb(); -} - -std::array Color::rgba() const -{ - if (interpol_mode == InterpolMode::RGB) - return { (int)(data[0]*255), (int)(data[1]*255), (int)(data[2]*255), (int)(data[3]*255) }; - else - return toRGB().rgba(); -} - -std::array Color::hsv() const -{ - if (interpol_mode == InterpolMode::HSV) - return { (int)(data[0]*360), (int)(data[1]*100), (int)(data[2]*100) }; - else - return toHSV().hsv(); -} - -std::array Color::hsva() const -{ - if (interpol_mode == InterpolMode::HSV) - return { (int)(data[0]*360), (int)(data[1]*100), (int)(data[2]*100), (int)(data[3]*100) }; - else - return toHSV().hsva(); + return rgb().hex_str(); } \ No newline at end of file diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index fbdd7d41..cc67ce30 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -17,57 +17,67 @@ namespace codac2 { - enum class InterpolMode - { - RGB = 0x01, - HSV = 0x02 - }; - struct Color + + struct Color : public std::array { - std::array data = {0.,0.,0.,1.0}; // RGB or HSV values + alpha, between 0 and 1 - InterpolMode interpol_mode = InterpolMode::RGB;//RGB or HSV + enum Model + { + RGB = 0x01, + HSV = 0x02 + }; + + Model m = RGB; //RGB or HSV // Constructors explicit Color(); - explicit Color(float x1, float x2, float x3, float alpha, InterpolMode interpol_mode = InterpolMode::RGB); // RGBA constructor - explicit Color(double x1, double x2, double x3, double alpha, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(float x1, float x2, float x3, InterpolMode interpol_mode = InterpolMode::RGB); // RGB constructor - explicit Color(double x1, double x2, double x3, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(const std::array& xyz, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(const std::array& xyza, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(int x1, int x2, int x3, int alpha,InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(int x1, int x2, int x3, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(const std::array& xyz, InterpolMode interpol_mode = InterpolMode::RGB); - explicit Color(const std::array& xyza, InterpolMode interpol_mode = InterpolMode::RGB); + explicit Color(const std::array& xyz, Model m_ = RGB); + explicit Color(const std::array& xyza, Model m_ = RGB); + explicit Color(const std::initializer_list xyza, Model m_ = RGB); explicit Color(const std::string& hex_str); - //Conversions + // Html color + + std::string hex_str() const; - Color toRGB() const; - Color toHSV() const; + // Conversions - // Properties + Color rgb() const; + Color hsv() const; + + // Overload flux operator + + friend std::ostream& operator<<(std::ostream& os, const Color& c) + { + if (c.m == RGB) + os << "RGB Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; + else if (c.m == HSV) + os << "HSV Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; + return os; + } - std::string hex_str() const; - std::array rgb() const; - std::array rgba() const; - std::array hsv() const; - std::array hsva() const; // Predefined colors - static Color none() { return Color(255, 255, 255, 0 ); }; - static Color black(float alpha = 1) { return Color(0, 0, 0, (int)(alpha*255)); }; - static Color white(float alpha = 1) { return Color(255, 255, 255, (int)(alpha*255)); }; - static Color green(float alpha = 1) { return Color(144, 242, 0, (int)(alpha*255)); }; - static Color blue(float alpha = 1) { return Color(0, 98, 198, (int)(alpha*255)); }; - static Color cyan(float alpha = 1) { return Color(75, 207, 250, (int)(alpha*255)); }; - static Color yellow(float alpha = 1) { return Color(255, 211, 42, (int)(alpha*255)); }; - static Color red(float alpha = 1) { return Color(209, 59, 0, (int)(alpha*255)); }; - static Color dark_gray(float alpha = 1) { return Color(112, 112, 112, (int)(alpha*255)); }; - static Color purple(float alpha = 1) { return Color(154, 0, 170, (int)(alpha*255)); }; - static Color dark_green(float alpha = 1) { return Color(94, 158, 0, (int)(alpha*255)); }; + static Color none() { return Color({255., 255., 255., 0.}); }; + static Color black(float alpha = 1.) { return Color({0., 0., 0., (float) (alpha*255.)}); }; + static Color white(float alpha = 1.) { return Color({255., 255., 255., (float) (alpha*255.)}); }; + static Color green(float alpha = 1.) { return Color({144., 242., 0., (float) (alpha*255.)}); }; + static Color blue(float alpha = 1.) { return Color({0., 98., 198., (float) (alpha*255.)}); }; + static Color cyan(float alpha = 1.) { return Color({75., 207., 250., (float) (alpha*255.)}); }; + static Color yellow(float alpha = 1.) { return Color({255., 211., 42., (float) (alpha*255.)}); }; + static Color red(float alpha = 1.) { return Color({209., 59., 0., (float) (alpha*255.)}); }; + static Color dark_gray(float alpha = 1.) { return Color({112., 112., 112., (float) (alpha*255.)}); }; + static Color purple(float alpha = 1.) { return Color({154., 0., 170., (float) (alpha*255.)}); }; + static Color dark_green(float alpha = 1.) { return Color({94., 158., 0., (float) (alpha*255.)}); }; }; + + template + static std::array to_array(const std::initializer_list& list) { + assert(list.size() == N); + std::array arr; + std::copy(list.begin(), list.end(), arr.begin()); + return arr; + } } \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index bbc7ea4f..7971462a 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -13,135 +13,32 @@ using namespace std; using namespace codac2; -ColorMap::ColorMap() - : colormap() -{} - -void ColorMap::add_color_point(Color color, float index) -{ - colormap[index] = color; -} - Color ColorMap::color(float r) const { - assert (colormap.size() >= 2); + assert (this->size() >= 2); if(std::isnan(r)) // undefined ratio - return Color(0.5, 0.5, 0.5); + return Color({0.5, 0.5, 0.5}); assert(Interval(0.,1.).contains(r)); - Interval map_domain = Interval(colormap.begin()->first,prev(colormap.end())->first); + Interval map_domain = Interval(this->begin()->first,prev(this->end())->first); float real_index = map_domain.lb() + r*map_domain.diam(); - if(colormap.find(real_index) == colormap.end()) // color interpolation + if(this->find(real_index) == this->end()) // color interpolation { typename map::const_iterator it_ub; - it_ub = colormap.lower_bound(real_index); - Color color_lb = prev(it_ub)->second.toRGB(); - Color color_ub = it_ub->second.toRGB(); + it_ub = this->lower_bound(real_index); + Color color_lb = prev(it_ub)->second; + Color color_ub = it_ub->second; float local_ratio = (real_index - prev(it_ub)->first) / (it_ub->first - prev(it_ub)->first); - return Color((float)(color_lb.data[0] + (color_ub.data[0] - color_lb.data[0]) * local_ratio), - (float)(color_lb.data[1] + (color_ub.data[1] - color_lb.data[1]) * local_ratio), - (float)(color_lb.data[2] + (color_ub.data[2] - color_lb.data[2]) * local_ratio), - (float)(color_lb.data[3] + (color_ub.data[3] - color_lb.data[3]) * local_ratio)); + return Color({(color_lb[0] + (color_ub[0] - color_lb[0]) * local_ratio), + (color_lb[1] + (color_ub[1] - color_lb[1]) * local_ratio), + (color_lb[2] + (color_ub[2] - color_lb[2]) * local_ratio), + (color_lb[3] + (color_ub[3] - color_lb[3]) * local_ratio)},color_lb.m); } else // color key - return colormap.at(real_index); -} - -ColorMap make_haxby() - { - ColorMap map; - map.add_color_point(Color(39,90,211), 0); - map.add_color_point(Color(40,123,245), 1); - map.add_color_point(Color(45,155,253), 2); - map.add_color_point(Color(73,209,255), 3); - map.add_color_point(Color(100,230,254), 4); - map.add_color_point(Color(118,235,226), 5); - map.add_color_point(Color(135,236,187), 6); - map.add_color_point(Color(194,252,165), 7); - map.add_color_point(Color(217,251,151), 8); - map.add_color_point(Color(233,241,131), 9); - map.add_color_point(Color(252,201,96), 10); - map.add_color_point(Color(255,184,84), 11); - map.add_color_point(Color(255,170,75), 12); - map.add_color_point(Color(255,167,83), 13); - map.add_color_point(Color(255,200,158), 14); - map.add_color_point(Color(255,233,217), 15); - return map; - } - -const ColorMap ColorMap::HAXBY = make_haxby(); - -ColorMap make_default() - { - ColorMap map; - map.add_color_point(Color(10,0,121), 0); - map.add_color_point(Color(40,0,150), 1); - map.add_color_point(Color(20,5,175), 2); - map.add_color_point(Color(0,10,200), 3); - map.add_color_point(Color(0,25,212), 4); - map.add_color_point(Color(0,40,224), 5); - map.add_color_point(Color(26,102,240), 6); - map.add_color_point(Color(13,129,248), 7); - map.add_color_point(Color(25,175,255), 8); - map.add_color_point(Color(50,190,255), 9); - map.add_color_point(Color(68,202,255), 10); - map.add_color_point(Color(97,225,240), 11); - map.add_color_point(Color(106,235,225), 12); - map.add_color_point(Color(124,235,200), 13); - map.add_color_point(Color(138,236,174), 14); - map.add_color_point(Color(172,245,168), 15); - map.add_color_point(Color(205,255,162), 16); - map.add_color_point(Color(223,245,141), 17); - map.add_color_point(Color(240,236,121), 18); - map.add_color_point(Color(247,215,104), 19); - map.add_color_point(Color(255,189,87), 20); - map.add_color_point(Color(255,160,69), 21); - map.add_color_point(Color(244,117,75), 22); - map.add_color_point(Color(238,80,78), 23); - map.add_color_point(Color(255,90,90), 24); - map.add_color_point(Color(255,124,124), 25); - map.add_color_point(Color(255,158,158), 26); - map.add_color_point(Color(245,179,174), 27); - map.add_color_point(Color(255,196,196), 28); - map.add_color_point(Color(255,215,215), 29); - map.add_color_point(Color(255,235,235), 31); - map.add_color_point(Color(255,254,253), 32); - return map; - } - - const ColorMap ColorMap::DEFAULT = make_default(); - -ColorMap make_blue_tube() -{ - ColorMap map; - map.add_color_point(Color(76,110,127), 0.); - map.add_color_point(Color(136,197,228), 1.); - return map; -} - -const ColorMap ColorMap::BLUE_TUBE = make_blue_tube(); - -ColorMap make_red_tube() -{ - ColorMap map; - map.add_color_point(Color(169,55,0), 0.); - map.add_color_point(Color(241,140,54), 1.); - return map; -} - -const ColorMap ColorMap::RED_TUBE = make_red_tube(); - -ColorMap make_rainbow() - { - ColorMap map; - for(int h = 300 ; h > 0 ; h-=10) - map.add_color_point(Color(h,100,100,100,InterpolMode::HSV), (300.-h)/300.); - return map; - } - - const ColorMap ColorMap::RAINBOW = make_rainbow(); \ No newline at end of file + return this->at(real_index); +} \ No newline at end of file diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 36d44cd6..4ca78953 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -21,21 +21,96 @@ namespace codac2 * \struct ColorMap * \brief Represents a set of RGB values */ - struct ColorMap + struct ColorMap : public std::map { - ColorMap(); + Color color (float r) const; - std::map colormap; //!< map of colors + static ColorMap haxby() + { + return ColorMap({{0,Color({39.,90.,211.})}, + {1,Color({40.,123.,245.})}, + {2,Color({45.,155.,253.})}, + {3,Color({73.,209.,255.})}, + {4,Color({100.,230.,254.})}, + {5,Color({118.,235.,226.})}, + {6,Color({135.,236.,187.})}, + {7,Color({194.,252.,165.})}, + {8,Color({217.,251.,151.})}, + {9,Color({233.,241.,131.})}, + {10,Color({252.,201.,96.})}, + {11,Color({255.,184.,84.})}, + {12,Color({255.,170.,75.})}, + {13,Color({255.,167.,83.})}, + {14,Color({255.,200.,158.})}, + {15,Color({255.,233.,217.})} + }); - void add_color_point(Color color, float index); + + } - Color color (float r) const; + static ColorMap basic() // Can't use default as name + { + return ColorMap({{0,Color({10.,0.,121.})}, + {1,Color({40.,0.,150.})}, + {2,Color({20.,5.,175.})}, + {3,Color({0.,10.,200.})}, + {4,Color({0.,25.,212.})}, + {5,Color({0.,40.,224.})}, + {6,Color({26.,102.,240.})}, + {7,Color({13.,129.,248.})}, + {8,Color({25.,175.,255.})}, + {9,Color({50.,190.,255.})}, + {10,Color({68.,202.,255.})}, + {11,Color({97.,225.,240.})}, + {12,Color({106.,235.,225.})}, + {13,Color({124.,235.,200.})}, + {14,Color({138.,236.,174.})}, + {15,Color({172.,245.,168.})}, + {16,Color({205.,255.,162.})}, + {17,Color({223.,245.,141.})}, + {18,Color({240.,236.,121.})}, + {19,Color({247.,215.,104.})}, + {20,Color({255.,189.,87.})}, + {21,Color({255.,160.,69.})}, + {22,Color({244.,117.,75.})}, + {23,Color({238.,80.,78.})}, + {24,Color({255.,90.,90.})}, + {25,Color({255.,124.,124.})}, + {26,Color({255.,158.,158.})}, + {27,Color({245.,179.,174.})}, + {28,Color({255.,196.,196.})}, + {29,Color({255.,215.,215.})}, + {31,Color({255.,235.,235.})}, + {32,Color({255.,254.,253.})} + }); + } + + static ColorMap blue_tube() + { + return ColorMap({{0,Color({76.,110.,127.})}, + {1,Color({136.,197.,228.})} + }); + } + + static ColorMap red_tube() + { + return ColorMap({{0,Color({169.,55.,0.})}, + {1,Color({241.,140.,54.})} + }); + } + + static ColorMap rainbow() + { + ColorMap cmap; + int i = 0; + for(int h = 300 ; h > 0 ; h-=10) + { + cmap[i]=Color({(float)h,100.,100.},Color::HSV); + i++; + } + return cmap; + } - static const ColorMap HAXBY; //!< predefined HAXBY color map (mainly used for DEM) - static const ColorMap DEFAULT; //!< a predefined default color map - static const ColorMap BLUE_TUBE; //!< a predefined color map for tubes - static const ColorMap RED_TUBE; //!< a predefined color map for tubes - static const ColorMap RAINBOW; //!< a predefined color map }; } \ No newline at end of file From c0755720578ad4eff50c69c24f3c34c81380eb64 Mon Sep 17 00:00:00 2001 From: godardma Date: Tue, 3 Dec 2024 18:28:54 +0100 Subject: [PATCH 11/15] [graphics] C++ tests passed --- .../src/graphics/styles/codac2_py_Color.cpp | 5 +- .../graphics/styles/codac2_py_ColorMap.cpp | 7 + src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 5 +- src/graphics/styles/codac2_Color.cpp | 24 +- src/graphics/styles/codac2_Color.h | 7 +- src/graphics/styles/codac2_ColorMap.cpp | 18 + src/graphics/styles/codac2_ColorMap.h | 123 ++++--- tests/graphics/styles/codac2_tests_Color.cpp | 346 ++++-------------- tests/graphics/styles/codac2_tests_Color.py | 220 ++++------- 9 files changed, 249 insertions(+), 506 deletions(-) diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index 1660c94a..5eec09de 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -53,11 +53,14 @@ void export_Color(py::module& m) "hex_str"_a) - // Html color + // Other formats .def("hex_str", &Color::hex_str, STRING_COLOR_HEX_STR_CONST) + .def("vec", &Color::vec, + VECTOR_COLOR_VEC_CONST) + // Conversions .def("rgb", &Color::rgb, diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 2c7c28b2..83e720f4 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -23,6 +23,13 @@ void export_ColorMap(py::module& m) py::class_ exported_colormap(m, "ColorMap", COLORMAP_MAIN); exported_colormap + .def_readwrite("m", &ColorMap::m, + COLOR_MODEL_COLORMAP_M) + + .def(py::init(), + COLORMAP_COLORMAP_COLOR_MODEL, + "m"_a=Color::Model::RGB) + .def("color", &ColorMap::color, COLOR_COLORMAP_COLOR_FLOAT_CONST, "r"_a) diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 9981b3e5..04a0157a 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -555,10 +555,9 @@ void Figure2D_IPE::print_header_page() for(auto& [k,c] : _colors) { - if (c.m == Color::HSV) - c = c.rgb(); + Color c_rgb = c.rgb(); _f << " \n"; + << "value=\"" << (float) (c_rgb[0]/255.) << " " <<(float) (c_rgb[1]/255.) << " " <<(float) (c_rgb[2]/255.) << "\" /> \n"; } _f << " \n \ diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index b121e943..8e147cdd 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -118,18 +118,21 @@ Color Color::hsv() const return *this; else { - float c_max = std::max({(*this)[0], (*this)[1], (*this)[2]}); - float c_min = std::min({(*this)[0], (*this)[1], (*this)[2]}); + float r = (*this)[0]/255.; + float g = (*this)[1]/255.; + float b = (*this)[2]/255.; + float c_max = std::max({r, g, b}); + float c_min = std::min({r, g, b}); float delta = c_max - c_min; float h = 0.0; if (delta != 0) { - if (c_max == (*this)[0]) { - h = fmod(((*this)[1] - (*this)[2]) / delta, 6.0); - } else if (c_max == (*this)[1]) { - h = ((*this)[2] - (*this)[0]) / delta + 2.0; - } else if (c_max == (*this)[2]) { - h = ((*this)[0] - (*this)[1]) / delta + 4.0; + if (c_max == r) { + h = fmod((g - b) / delta, 6.0); + } else if (c_max == g) { + h = (b - r) / delta + 2.0; + } else if (c_max == b) { + h = (r - g) / delta + 4.0; } h /= 6.0; if (h < 0) { @@ -162,4 +165,9 @@ std::string Color::hex_str() const } else return rgb().hex_str(); +} + +codac2::Vector Color::vec() const +{ + return codac2::Vector({(*this)[0], (*this)[1], (*this)[2], (*this)[3]}); } \ No newline at end of file diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index cc67ce30..eabe751d 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -12,8 +12,9 @@ #include #include #include -#include"codac2_assert.h" +#include"codac2_assert.h" +#include"codac2_Vector.h" namespace codac2 { @@ -37,10 +38,12 @@ namespace codac2 explicit Color(const std::initializer_list xyza, Model m_ = RGB); explicit Color(const std::string& hex_str); - // Html color + // other formats std::string hex_str() const; + codac2::Vector vec() const; + // Conversions Color rgb() const; diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 7971462a..656a6e10 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -12,6 +12,9 @@ using namespace std; using namespace codac2; +ColorMap::ColorMap(Color::Model m_) : + m(m_) +{ } Color ColorMap::color(float r) const { @@ -30,6 +33,21 @@ Color ColorMap::color(float r) const Color color_lb = prev(it_ub)->second; Color color_ub = it_ub->second; + // Interpolation according to the ColorMap model + + if (m == Color::RGB) + { + color_lb = color_lb.rgb(); + color_ub = color_ub.rgb(); + } + + else if (m == Color::HSV) + { + color_lb = color_lb.hsv(); + color_ub = color_ub.hsv(); + } + + float local_ratio = (real_index - prev(it_ub)->first) / (it_ub->first - prev(it_ub)->first); return Color({(color_lb[0] + (color_ub[0] - color_lb[0]) * local_ratio), diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 4ca78953..0205a4da 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -23,86 +23,91 @@ namespace codac2 */ struct ColorMap : public std::map { + Color::Model m; //RGB or HSV + + explicit ColorMap(Color::Model m_ = Color::RGB); Color color (float r) const; static ColorMap haxby() { - return ColorMap({{0,Color({39.,90.,211.})}, - {1,Color({40.,123.,245.})}, - {2,Color({45.,155.,253.})}, - {3,Color({73.,209.,255.})}, - {4,Color({100.,230.,254.})}, - {5,Color({118.,235.,226.})}, - {6,Color({135.,236.,187.})}, - {7,Color({194.,252.,165.})}, - {8,Color({217.,251.,151.})}, - {9,Color({233.,241.,131.})}, - {10,Color({252.,201.,96.})}, - {11,Color({255.,184.,84.})}, - {12,Color({255.,170.,75.})}, - {13,Color({255.,167.,83.})}, - {14,Color({255.,200.,158.})}, - {15,Color({255.,233.,217.})} - }); - - + ColorMap cmap( Color::RGB ); + cmap[0]=Color({39.,90.,211.}); + cmap[1]=Color({40.,123.,245.}); + cmap[2]=Color({45.,155.,253.}); + cmap[3]=Color({73.,209.,255.}); + cmap[4]=Color({100.,230.,254.}); + cmap[5]=Color({118.,235.,226.}); + cmap[6]=Color({135.,236.,187.}); + cmap[7]=Color({194.,252.,165.}); + cmap[8]=Color({217.,251.,151.}); + cmap[9]=Color({233.,241.,131.}); + cmap[10]=Color({252.,201.,96.}); + cmap[11]=Color({255.,184.,84.}); + cmap[12]=Color({255.,170.,75.}); + cmap[13]=Color({255.,167.,83.}); + cmap[14]=Color({255.,200.,158.}); + cmap[15]=Color({255.,233.,217.}); + return cmap; } static ColorMap basic() // Can't use default as name { - return ColorMap({{0,Color({10.,0.,121.})}, - {1,Color({40.,0.,150.})}, - {2,Color({20.,5.,175.})}, - {3,Color({0.,10.,200.})}, - {4,Color({0.,25.,212.})}, - {5,Color({0.,40.,224.})}, - {6,Color({26.,102.,240.})}, - {7,Color({13.,129.,248.})}, - {8,Color({25.,175.,255.})}, - {9,Color({50.,190.,255.})}, - {10,Color({68.,202.,255.})}, - {11,Color({97.,225.,240.})}, - {12,Color({106.,235.,225.})}, - {13,Color({124.,235.,200.})}, - {14,Color({138.,236.,174.})}, - {15,Color({172.,245.,168.})}, - {16,Color({205.,255.,162.})}, - {17,Color({223.,245.,141.})}, - {18,Color({240.,236.,121.})}, - {19,Color({247.,215.,104.})}, - {20,Color({255.,189.,87.})}, - {21,Color({255.,160.,69.})}, - {22,Color({244.,117.,75.})}, - {23,Color({238.,80.,78.})}, - {24,Color({255.,90.,90.})}, - {25,Color({255.,124.,124.})}, - {26,Color({255.,158.,158.})}, - {27,Color({245.,179.,174.})}, - {28,Color({255.,196.,196.})}, - {29,Color({255.,215.,215.})}, - {31,Color({255.,235.,235.})}, - {32,Color({255.,254.,253.})} - }); + ColorMap cmap( Color::RGB ); + cmap[0]=Color({10.,0.,121.}); + cmap[1]=Color({40.,0.,150.}); + cmap[2]=Color({20.,5.,175.}); + cmap[3]=Color({0.,10.,200.}); + cmap[4]=Color({0.,25.,212.}); + cmap[5]=Color({0.,40.,224.}); + cmap[6]=Color({26.,102.,240.}); + cmap[7]=Color({13.,129.,248.}); + cmap[8]=Color({25.,175.,255.}); + cmap[9]=Color({50.,190.,255.}); + cmap[10]=Color({68.,202.,255.}); + cmap[11]=Color({97.,225.,240.}); + cmap[12]=Color({106.,235.,225.}); + cmap[13]=Color({124.,235.,200.}); + cmap[14]=Color({138.,236.,174.}); + cmap[15]=Color({172.,245.,168.}); + cmap[16]=Color({205.,255.,162.}); + cmap[17]=Color({223.,245.,141.}); + cmap[18]=Color({240.,236.,121.}); + cmap[19]=Color({247.,215.,104.}); + cmap[20]=Color({255.,189.,87.}); + cmap[21]=Color({255.,160.,69.}); + cmap[22]=Color({244.,117.,75.}); + cmap[23]=Color({238.,80.,78.}); + cmap[24]=Color({255.,90.,90.}); + cmap[25]=Color({255.,124.,124.}); + cmap[26]=Color({255.,158.,158.}); + cmap[27]=Color({245.,179.,174.}); + cmap[28]=Color({255.,196.,196.}); + cmap[29]=Color({255.,215.,215.}); + cmap[30]=Color({255.,235.,235.}); + cmap[31]=Color({255.,254.,253.}); + return cmap; } static ColorMap blue_tube() { - return ColorMap({{0,Color({76.,110.,127.})}, - {1,Color({136.,197.,228.})} - }); + ColorMap cmap( Color::RGB ); + cmap[0]=Color({76.,110.,127.}); + cmap[1]=Color({136.,197.,228.}); + return cmap; } static ColorMap red_tube() { - return ColorMap({{0,Color({169.,55.,0.})}, - {1,Color({241.,140.,54.})} - }); + ColorMap cmap( Color::RGB ); + cmap[0]=Color({169.,55.,0.}); + cmap[1]=Color({241.,140.,54.}); + return cmap; } static ColorMap rainbow() { - ColorMap cmap; + ColorMap cmap( Color::HSV ); int i = 0; for(int h = 300 ; h > 0 ; h-=10) { diff --git a/tests/graphics/styles/codac2_tests_Color.cpp b/tests/graphics/styles/codac2_tests_Color.cpp index 9b356716..a9d0d20c 100644 --- a/tests/graphics/styles/codac2_tests_Color.cpp +++ b/tests/graphics/styles/codac2_tests_Color.cpp @@ -1,4 +1,4 @@ -/** +/** * Codac tests * ---------------------------------------------------------------------------- * \date 2024 @@ -8,300 +8,80 @@ */ #include -#include #include +#include using namespace std; using namespace codac2; -// Custom Matchers to manage tolerate errors - -// array matcher - -class Array4MatcherWithTolerance : public Catch::Matchers::MatcherBase> { - std::array m_expected; - int m_tolerance; - -public: - Array4MatcherWithTolerance(const std::array& expected, int tolerance) - : m_expected(expected), m_tolerance(tolerance) {} - - bool match(const std::array& actual) const override { - for (size_t i = 0; i < m_expected.size(); ++i) { - if (std::abs(actual[i] - m_expected[i]) > m_tolerance) { - return false; - } - } - return true; - } - - std::string describe() const override { - std::ostringstream oss; - oss << "is close to { "; - for (size_t i = 0; i < m_expected.size(); ++i) { - oss << m_expected[i]; - if (i < m_expected.size() - 1) oss << ", "; - } - oss << " } with tolerance " << m_tolerance; - return oss.str(); - } -}; - -// array matcher - -class Array3MatcherWithTolerance : public Catch::Matchers::MatcherBase> { - std::array m_expected; - int m_tolerance; - -public: - Array3MatcherWithTolerance(const std::array& expected, int tolerance) - : m_expected(expected), m_tolerance(tolerance) {} - - bool match(const std::array& actual) const override { - for (size_t i = 0; i < m_expected.size(); ++i) { - if (std::abs(actual[i] - m_expected[i]) > m_tolerance) { - return false; - } - } - return true; - } - - std::string describe() const override { - std::ostringstream oss; - oss << "is close to { "; - for (size_t i = 0; i < m_expected.size(); ++i) { - oss << m_expected[i]; - if (i < m_expected.size() - 1) oss << ", "; - } - oss << " } with tolerance " << m_tolerance; - return oss.str(); - } -}; - -// HTML color matcher - -class HtmlColorMatcherWithTolerance : public Catch::Matchers::MatcherBase { - std::string m_expected; - int m_tolerance; - - // Helper to convert a hex color to RGB - static std::array hexToRgb(const std::string& hex) { - assert(hex.size() == 7 && hex[0] == '#'); // Ensure format is #RRGGBB - return { - std::stoi(hex.substr(1, 2), nullptr, 16), - std::stoi(hex.substr(3, 2), nullptr, 16), - std::stoi(hex.substr(5, 2), nullptr, 16) - }; - } - -public: - HtmlColorMatcherWithTolerance(const std::string& expected, int tolerance) - : m_expected(expected), m_tolerance(tolerance) { - assert(m_expected.size() == 7 && m_expected[0] == '#'); // Ensure format is #RRGGBB - } - - bool match(const std::string& actual) const override { - if (actual.size() != 7 || actual[0] != '#') { - return false; // Invalid format - } - - auto expectedRgb = hexToRgb(m_expected); - auto actualRgb = hexToRgb(actual); - - for (size_t i = 0; i < 3; ++i) { - if (std::abs(actualRgb[i] - expectedRgb[i]) > m_tolerance) { - return false; - } - } - return true; - } - - std::string describe() const override { - std::ostringstream oss; - oss << "is close to " << m_expected << " with tolerance " << m_tolerance; - return oss.str(); - } -}; - -// RGBA HTML color matcher - -class HtmlColorMatcherWithToleranceRGBA : public Catch::Matchers::MatcherBase { - std::string m_expected; - int m_tolerance; - - // Helper to convert a hex color to RGBA - static std::array hexToRgba(const std::string& hex) { - assert(hex.size() == 9 && hex[0] == '#'); // Ensure format is #RRGGBBAA - return { - std::stoi(hex.substr(1, 2), nullptr, 16), - std::stoi(hex.substr(3, 2), nullptr, 16), - std::stoi(hex.substr(5, 2), nullptr, 16), - std::stoi(hex.substr(7, 2), nullptr, 16) - }; - } - -public: - HtmlColorMatcherWithToleranceRGBA(const std::string& expected, int tolerance) - : m_expected(expected), m_tolerance(tolerance) { - assert(m_expected.size() == 9 && m_expected[0] == '#'); // Ensure format is #RRGGBBAA - } - - bool match(const std::string& actual) const override { - if (actual.size() != 9 || actual[0] != '#') { - return false; // Invalid format - } - - auto expectedRgba = hexToRgba(m_expected); - auto actualRgba = hexToRgba(actual); - - for (size_t i = 0; i < 4; ++i) { - if (std::abs(actualRgba[i] - expectedRgba[i]) > m_tolerance) { - return false; - } - } - return true; - } - - std::string describe() const override { - std::ostringstream oss; - oss << "is close to " << m_expected << " with tolerance " << m_tolerance; - return oss.str(); - } -}; - -inline Array4MatcherWithTolerance IsCloseTo(const std::array& expected, int tolerance = 1) { - return Array4MatcherWithTolerance(expected, tolerance); -} - -inline Array3MatcherWithTolerance IsCloseTo(const std::array& expected, int tolerance = 1) { - return Array3MatcherWithTolerance(expected, tolerance); -} - -inline HtmlColorMatcherWithTolerance IsCloseToHtmlColor(const std::string& expected, int tolerance = 1) { - return HtmlColorMatcherWithTolerance(expected, tolerance); -} - -inline HtmlColorMatcherWithToleranceRGBA IsCloseToHtmlColorRGBA(const std::string& expected, int tolerance = 1) { - return HtmlColorMatcherWithToleranceRGBA(expected, tolerance); -} - - TEST_CASE("Color") { - { - // Red - - std::array d_rgb { 255,0,0 }; - std::array d_rgba { 255,0,0,255 }; - std::array d_hsv { 0,100,100 }; - std::array d_hsva { 0,100,100,100 }; - std::array d_rgb_f { 1.0,0.0,0.0 }; - std::array d_rgba_f { 1.0,0.0,0.0,1.0 }; - std::array d_hsv_f { 0.0,1.0,1.0 }; - std::array d_hsva_f { 0.0,1.0,1.0,1.0 }; - - vector v { - Color(d_rgb, InterpolMode::RGB /* InterpolMode::RGB is default */), - Color(d_rgba, InterpolMode::RGB), - Color(255,0,0, InterpolMode::RGB), - Color(255,0,0,255, InterpolMode::RGB), - Color(d_hsv, InterpolMode::HSV), - Color(d_hsva, InterpolMode::HSV), - Color(0,100,100, InterpolMode::HSV), - Color(0,100,100,100, InterpolMode::HSV), - Color(d_rgb_f, InterpolMode::RGB), - Color(d_rgba_f, InterpolMode::RGB), - Color( 1.0, 0.0, 0.0, InterpolMode::RGB), - Color( 1.0, 0.0, 0.0, 1.0, InterpolMode::RGB), - Color(d_hsv_f, InterpolMode::HSV), - Color(d_hsva_f, InterpolMode::HSV), - Color( 0.0, 1.0, 1.0, InterpolMode::HSV), - Color( 0.0, 1.0, 1.0, 1.0, InterpolMode::HSV), - Color("#FF0000") - }; - - for(const auto& c : v) { - CHECK_THAT(c.hex_str(), IsCloseToHtmlColor("#ff0000")); - CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 255,0,0})); // return std::array - CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 255,0,0,255})); // return std::array - CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 0,100,100})); // return std::array - CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 0,100,100,100})); // return std::array + // Red + + std::array d_rgb{255., 0., 0.}; + std::array d_rgba{255., 0., 0., 255.}; + std::array d_hsv{0., 100., 100.}; + std::array d_hsva{0., 100., 100., 100.}; + + vector v{ + Color(d_rgb, Color::RGB), + Color(d_rgba, Color::RGB), + Color(d_hsv, Color::HSV), + Color(d_hsva, Color::HSV), + Color("#FF0000")}; + + for (const auto &c : v) + { + CHECK(Approx(c.rgb().vec(),1.) == Color({255., 0., 0.}).vec()); + CHECK(Approx(c.rgb().vec(),1.) == Color({255., 0., 0., 255.}).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100.}, Color::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100., 100.}, Color::HSV).vec()); + } } - } - - { - // Pink full opacity - - int a = 255; - std::array d_rgb { 229,128,255 }; - std::array d_rgba { 229,128,255,a }; - std::array d_hsv { 288,50,100 }; - std::array d_hsva { 288,50,100,100}; - std::array d_rgb_f {(float) (229./255.), (float) (128./255.), (float) (255./255.)}; - std::array d_rgba_f {(float) (229./255.), (float) (128./255.), (float) (255./255.), 1.0}; - std::array d_hsv_f {(float) (288./360.), (float) (50./100.), (float) (100./100.)}; - std::array d_hsva_f {(float) (288./360.), (float) (50./100.), (float) (100./100.), 1.0}; - - vector v { - Color(d_rgb, InterpolMode::RGB /* InterpolMode::RGB is default */), - Color(d_rgba, InterpolMode::RGB), - Color(229,128,255, InterpolMode::RGB), - Color(229,128,255,a, InterpolMode::RGB), - Color(d_hsv, InterpolMode::HSV), - Color(d_hsva, InterpolMode::HSV), - Color(288,50,100, InterpolMode::HSV), - Color(288,50,100,100, InterpolMode::HSV), - Color(d_rgb_f, InterpolMode::RGB), - Color(d_rgba_f, InterpolMode::RGB), - Color( 229./255., 128./255., 255./255., InterpolMode::RGB), - Color( 229./255., 128./255., 255./255., 1.0, InterpolMode::RGB), - Color(d_hsv_f, InterpolMode::HSV), - Color(d_hsva_f, InterpolMode::HSV), - Color( 288./360., 50./100., 100./100., InterpolMode::HSV), - Color( 288./360.,50./100., 100./100., 1.0, InterpolMode::HSV), - Color("#e580ff") - }; - - for(const auto& c : v) { - CHECK_THAT(c.hex_str(), IsCloseToHtmlColor("#e580ff")); - CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 229,128,255})); // return std::array - CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 229,128,255,a})); // return std::array - CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 288,50,100})); // return std::array - CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 288,50,100,100})); // return std::array + // Pink full opacity + + float a = 255.; + std::array d_rgb{229., 128., 255.}; + std::array d_rgba{229., 128., 255., a}; + std::array d_hsv{288., 50., 100.}; + std::array d_hsva{288., 50., 100., 100.}; + + vector v{ + Color(d_rgb, Color::RGB), + Color(d_rgba, Color::RGB), + Color(d_hsv, Color::HSV), + Color(d_hsva, Color::HSV), + Color("#e580ff")}; + + for (const auto &c : v) + { + CHECK(Approx(c.rgb().vec(),1.) == Color({229., 128., 255.}).vec()); + CHECK(Approx(c.rgb().vec(),1.) == Color({229., 128., 255., a}).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100.}, Color::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100., 100.}, Color::HSV).vec()); + } } - } - - { - // Pink 40% opacity - - int a = 0.4*255; - std::array d_rgba { 229,128,255,a }; - std::array d_hsva { 288,50,100,40 }; - std::array d_rgba_f {(float) (229./255.), (float) (128./255.), (float) (255./255.),(float) 0.4}; - std::array d_hsva_f {(float) (288./360.), (float) (50./100.), (float) (100./100.), (float) 0.4}; - vector v { - Color(d_rgba, InterpolMode::RGB), - Color(229,128,255,a, InterpolMode::RGB), - Color(d_hsva, InterpolMode::HSV), - Color(288,50,100,40, InterpolMode::HSV), - Color(d_rgba_f, InterpolMode::RGB), - Color( 229./255., 128./255., 255./255., 0.4, InterpolMode::RGB), - Color(d_hsva_f, InterpolMode::HSV), - Color( 288./360.,50./100., 100./100., 0.4, InterpolMode::HSV), - Color("#e580ff66") - }; + { + // Pink 40% opacity + + float a = 0.4*255.; + std::array d_rgba { 229.,128.,255.,a }; + std::array d_hsva { 288.,50.,100.,40. }; + + vector v { + Color(d_rgba, Color::RGB), + Color(d_hsva, Color::HSV), + Color("#e580ff66") + }; - for(const auto& c : v) - { - CHECK_THAT(c.hex_str(), IsCloseToHtmlColorRGBA("#e580ff66")); - CHECK_THAT(c.rgb(), IsCloseTo(std::array{ 229,128,255})); // return std::array - CHECK_THAT(c.rgba(), IsCloseTo(std::array{ 229,128,255,a})); // return std::array - CHECK_THAT(c.hsv(), IsCloseTo(std::array{ 288,50,100})); // return std::array - CHECK_THAT(c.hsva(), IsCloseTo(std::array{ 288,50,100,40})); // return std::array - } - } + for(const auto& c : v) + { + CHECK(Approx(c.rgb().vec(),1.) == Color({229.,128.,255.,a}).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288.,50.,100.,40.},Color::HSV).vec()); + } + } } \ No newline at end of file diff --git a/tests/graphics/styles/codac2_tests_Color.py b/tests/graphics/styles/codac2_tests_Color.py index fb52703a..21041f96 100644 --- a/tests/graphics/styles/codac2_tests_Color.py +++ b/tests/graphics/styles/codac2_tests_Color.py @@ -10,65 +10,6 @@ import unittest from codac import * -class ArrayMatcherWithTolerance: - def __init__(self, expected, tolerance=1): - self.expected = expected - self.tolerance = tolerance - - def match(self, actual): - if len(actual) != len(self.expected): - return False - for i in range(len(self.expected)): - if abs(actual[i] - self.expected[i]).mid() > self.tolerance: - return False - return True - - def describe(self): - return f'is close to {self.expected} with tolerance {self.tolerance}' - - -import re - -class HtmlColorMatcherWithTolerance: - def __init__(self, expected: str, tolerance: int = 1): - assert self._is_valid_color(expected), f"Invalid color format: {expected}" - self.expected = expected - self.tolerance = tolerance - - def _is_valid_color(self, color: str) -> bool: - """Validate the color format as #RRGGBBAA or #RRGGBB.""" - return bool(re.match(r"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$", color)) - - def _hex_to_components(self, hex_color: str): - """Convert a #RRGGBBAA or #RRGGBB color to a tuple of integers.""" - if len(hex_color) == 7: # #RRGGBB - return tuple(int(hex_color[i:i+2], 16) for i in range(1, 7, 2)) - elif len(hex_color) == 9: # #RRGGBBAA - return tuple(int(hex_color[i:i+2], 16) for i in range(1, 9, 2)) - - def match(self, actual: str) -> bool: - """Check if the actual color matches the expected color within the tolerance.""" - if not self._is_valid_color(actual): - return False - - expected_components = self._hex_to_components(self.expected) - actual_components = self._hex_to_components(actual) - - if len(expected_components) != len(actual_components): - return False - - return all(abs(e - a).mid() <= self.tolerance for e, a in zip(expected_components, actual_components)) - - def describe(self) -> str: - """Provide a description of the matcher.""" - return f"is close to {self.expected} with tolerance {self.tolerance}" - - -def is_close_to(expected, tolerance=1): - return ArrayMatcherWithTolerance(expected, tolerance) - -def is_close_to_html_color(expected, tolerance=1): - return HtmlColorMatcherWithTolerance(expected, tolerance) class TestColor(unittest.TestCase): @@ -79,104 +20,83 @@ def test_Color(self): d_rgba = [255, 0, 0, 255] d_hsv = [0, 100, 100] d_hsva = [0, 100, 100, 100] - d_rgb_f= [1.0, 0.0, 0.0] - d_rgba_f= [1.0, 0.0, 0.0, 1.0] - d_hsv_f= [0.0, 1.0, 1.0] - d_hsva_f= [0.0, 1.0, 1.0, 1.0] colors = [ - Color(d_rgb, InterpolMode.RGB), - Color(d_rgba, InterpolMode.RGB), - Color(255, 0, 0, interpol_mode=InterpolMode.RGB), - Color(255, 0, 0, 255, InterpolMode.RGB), - Color(d_hsv, InterpolMode.HSV), - Color(d_hsva, InterpolMode.HSV), - Color(0, 100, 100, interpol_mode=InterpolMode.HSV), - Color(0, 100, 100, 100, InterpolMode.HSV), - Color(d_rgb_f, InterpolMode.RGB), - Color(d_rgba_f, InterpolMode.RGB), - Color(1.0, 0.0, 0.0, interpol_mode=InterpolMode.RGB), - Color(1.0, 0.0, 0.0, 1.0, InterpolMode.RGB), - Color(d_hsv_f, InterpolMode.HSV), - Color(d_hsva_f, InterpolMode.HSV), - Color(0.0, 1.0, 1.0, interpol_mode=InterpolMode.HSV), - Color(0.0, 1.0, 1.0, 1.0, InterpolMode.HSV), + Color(d_rgb, Model.RGB), + Color(d_rgba, Model.RGB), + Color(d_hsv, Model.HSV), + Color(d_hsva, Model.HSV), Color("#FF0000") ] for c in colors: - self.assertTrue(is_close_to_html_color("#FF0000").match(c.hex_str())) - self.assertTrue(is_close_to([255, 0, 0]).match(c.rgb())) - self.assertTrue(is_close_to([255, 0, 0, 255]).match(c.rgba())) - self.assertTrue(is_close_to([0, 100, 100]).match(c.hsv())) - self.assertTrue(is_close_to([0, 100, 100, 100]).match(c.hsva())) - - # Pink full opacity - - d_rgb = [229,128,255] - d_rgba = [229,128,255,255] - d_hsv = [288,50,100] - d_hsva = [288,50,100,100] - d_rgb_f = [229.0/255.0, 128.0/255.0, 255.0/255.0] - d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0] - d_hsv_f = [288.0/360.0, 50.0/100.0, 100.0/100.0] - d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0] - - colors = [ - Color(d_rgb, InterpolMode.RGB), - Color(d_rgba, InterpolMode.RGB), - Color(229,128,255, interpol_mode=InterpolMode.RGB), - Color(229,128,255,255, InterpolMode.RGB), - Color(d_hsv, InterpolMode.HSV), - Color(d_hsva, InterpolMode.HSV), - Color(288,50,100, interpol_mode=InterpolMode.HSV), - Color(288,50,100,100, InterpolMode.HSV), - Color(d_rgb_f, InterpolMode.RGB), - Color(d_rgba_f, InterpolMode.RGB), - Color(229.0/255.0, 128.0/255.0, 255.0/255.0, interpol_mode=InterpolMode.RGB), - Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0, InterpolMode.RGB), - Color(d_hsv_f, InterpolMode.HSV), - Color(d_hsva_f, InterpolMode.HSV), - Color(288.0/360.0, 50.0/100.0, 100.0/100.0, interpol_mode=InterpolMode.HSV), - Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0, InterpolMode.HSV), - Color("#E580FF") - ] - - for c in colors: - self.assertTrue(is_close_to_html_color("#E580FF").match(c.hex_str())) - self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) - self.assertTrue(is_close_to([229,128,255,255]).match(c.rgba())) - self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) - self.assertTrue(is_close_to([288,50,100,100]).match(c.hsva())) - - # Pink 40% opacity - - a_rgb=102 - a_hsv=40 - d_rgba = [229,128,255,a_rgb] - d_hsva = [288,50,100,a_hsv] - d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0] - d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0] - - colors = [ - Color(d_rgba, InterpolMode.RGB), - Color(229,128,255,a_rgb, InterpolMode.RGB), - Color(d_hsva, InterpolMode.HSV), - Color(288,50,100,a_hsv, InterpolMode.HSV), - Color(d_rgba_f, InterpolMode.RGB), - Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0, InterpolMode.RGB), - Color(d_hsva_f, InterpolMode.HSV), - Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0, InterpolMode.HSV), - Color("#E580FF66") - ] - for c in colors: - self.assertTrue(is_close_to_html_color("#E580FF66").match(c.hex_str())) - self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) - self.assertTrue(is_close_to([229,128,255,a_rgb]).match(c.rgba())) - self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) - self.assertTrue(is_close_to([288,50,100,a_hsv]).match(c.hsva())) - + self.assertTrue(Color([255, 0, 0]).rgb().vec().match(Approx(c.rgb().vec(), 1.0))) + + # # Pink full opacity + + # d_rgb = [229,128,255] + # d_rgba = [229,128,255,255] + # d_hsv = [288,50,100] + # d_hsva = [288,50,100,100] + # d_rgb_f = [229.0/255.0, 128.0/255.0, 255.0/255.0] + # d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0] + # d_hsv_f = [288.0/360.0, 50.0/100.0, 100.0/100.0] + # d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0] + + # colors = [ + # Color(d_rgb, Model.RGB), + # Color(d_rgba, Model.RGB), + # Color(229,128,255, interpol_mode=Model.RGB), + # Color(229,128,255,255, Model.RGB), + # Color(d_hsv, Model.HSV), + # Color(d_hsva, Model.HSV), + # Color(288,50,100, interpol_mode=Model.HSV), + # Color(288,50,100,100, Model.HSV), + # Color(d_rgb_f, Model.RGB), + # Color(d_rgba_f, Model.RGB), + # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, interpol_mode=Model.RGB), + # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0, Model.RGB), + # Color(d_hsv_f, Model.HSV), + # Color(d_hsva_f, Model.HSV), + # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, interpol_mode=Model.HSV), + # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0, Model.HSV), + # Color("#E580FF") + # ] + + # for c in colors: + # self.assertTrue(is_close_to_html_color("#E580FF").match(c.hex_str())) + # self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) + # self.assertTrue(is_close_to([229,128,255,255]).match(c.rgba())) + # self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) + # self.assertTrue(is_close_to([288,50,100,100]).match(c.hsva())) + + # # Pink 40% opacity + + # a_rgb=102 + # a_hsv=40 + # d_rgba = [229,128,255,a_rgb] + # d_hsva = [288,50,100,a_hsv] + # d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0] + # d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0] + + # colors = [ + # Color(d_rgba, Model.RGB), + # Color(229,128,255,a_rgb, Model.RGB), + # Color(d_hsva, Model.HSV), + # Color(288,50,100,a_hsv, Model.HSV), + # Color(d_rgba_f, Model.RGB), + # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0, Model.RGB), + # Color(d_hsva_f, Model.HSV), + # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0, Model.HSV), + # Color("#E580FF66") + # ] + # for c in colors: + # self.assertTrue(is_close_to_html_color("#E580FF66").match(c.hex_str())) + # self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) + # self.assertTrue(is_close_to([229,128,255,a_rgb]).match(c.rgba())) + # self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) + # self.assertTrue(is_close_to([288,50,100,a_hsv]).match(c.hsva())) From 6e3bbfd544430454b771ea57feeaa27c72a193c5 Mon Sep 17 00:00:00 2001 From: godardma Date: Tue, 3 Dec 2024 18:49:09 +0100 Subject: [PATCH 12/15] [graphics] all tests passed --- .../src/graphics/styles/codac2_py_Color.cpp | 18 +-- .../graphics/styles/codac2_py_ColorMap.cpp | 8 +- src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 2 +- src/graphics/styles/codac2_Color.cpp | 20 ++-- src/graphics/styles/codac2_Color.h | 22 ++-- src/graphics/styles/codac2_ColorMap.cpp | 6 +- src/graphics/styles/codac2_ColorMap.h | 16 +-- tests/graphics/styles/codac2_tests_Color.cpp | 30 ++--- tests/graphics/styles/codac2_tests_Color.py | 107 +++++++----------- 9 files changed, 102 insertions(+), 127 deletions(-) diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index 5eec09de..cdd321c2 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -23,9 +23,9 @@ using namespace pybind11::literals; void export_Color(py::module& m) { - py::enum_(m, "Model") - .value("RGB", Color::Model::RGB) - .value("HSV", Color::Model::HSV) + py::enum_(m, "Model") + .value("RGB", Model::RGB) + .value("HSV", Model::HSV) ; py::class_ exported_color(m, "Color", COLOR_MAIN); @@ -36,17 +36,17 @@ void export_Color(py::module& m) .def(py::init<>(),COLOR_COLOR) - .def(py::init&,Color::Model>(), + .def(py::init&,Model>(), COLOR_COLOR_CONST_ARRAY_FLOAT3_REF_MODEL, - "xyz"_a, "m_"_a=Color::Model::RGB) + "xyz"_a, "m_"_a=Model::RGB) - .def(py::init&,Color::Model>(), + .def(py::init&,Model>(), COLOR_COLOR_CONST_ARRAY_FLOAT4_REF_MODEL, - "xyza"_a, "m_"_a=Color::Model::RGB) + "xyza"_a, "m_"_a=Model::RGB) - .def(py::init&,Color::Model>(), + .def(py::init&,Model>(), COLOR_COLOR_CONST_INITIALIZER_LIST_FLOAT_MODEL, - "xyza"_a, "m_"_a=Color::Model::RGB) + "xyza"_a, "m_"_a=Model::RGB) .def(py::init(), COLOR_COLOR_CONST_STRING_REF, diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 83e720f4..3ba8d5fc 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -24,11 +24,11 @@ void export_ColorMap(py::module& m) exported_colormap .def_readwrite("m", &ColorMap::m, - COLOR_MODEL_COLORMAP_M) + MODEL_COLORMAP_M) - .def(py::init(), - COLORMAP_COLORMAP_COLOR_MODEL, - "m"_a=Color::Model::RGB) + .def(py::init(), + COLORMAP_COLORMAP_MODEL, + "m"_a=Model::RGB) .def("color", &ColorMap::color, COLOR_COLORMAP_COLOR_FLOAT_CONST, diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 04a0157a..41005b72 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -82,7 +82,7 @@ std::string ipe_str(const Color& c) int ipe_opacity(const Color& c) { - return (int)(10.*round(10.*(c.m==Color::RGB ? (c[3]/255.):(c[3]/100.)))); + return (int)(10.*round(10.*(c.m==Model::RGB ? (c[3]/255.):(c[3]/100.)))); } void Figure2D_IPE::begin_path(const StyleProperties& s, bool tip=false) diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 8e147cdd..9d344af1 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -13,7 +13,7 @@ using namespace std; using namespace codac2; Color::Color() - : m(RGB) + : m(Model::RGB) { (*this)[0] = 0.; (*this)[1] = 0.; @@ -27,15 +27,15 @@ Color::Color(const std::array& xyz, Model m_) (*this)[0] = xyz[0]; (*this)[1] = xyz[1]; (*this)[2] = xyz[2]; - (*this)[3] = (m == RGB ? 255. : 100.); + (*this)[3] = (m == Model::RGB ? 255. : 100.); } Color::Color(const std::array& xyza, Model m_) : m(m_) { - if (m_==RGB) + if (m_==Model::RGB) assert(xyza[0] >= 0. && xyza[0] <= 255. && xyza[1]>=0. && xyza[1] <= 255. && xyza[2]>=0. && xyza[2] <= 255. && xyza[3]>=0. && xyza[3] <= 255.); - else if (m_==HSV) + else if (m_==Model::HSV) assert(xyza[0] >= 0. && xyza[0] <= 360. && xyza[1]>=0. && xyza[1] <= 100. && xyza[2]>=0. && xyza[2] <= 100. && xyza[3]>=0. && xyza[3] <= 100.); (*this)[0] = xyza[0]; (*this)[1] = xyza[1]; @@ -52,7 +52,7 @@ Color::Color(const std::string& hex_str) assert(hex_str.size() == 7 || hex_str.size() == 9); assert(hex_str[0] == '#'); - m = RGB; + m = Model::RGB; int red,green,blue,a; std::istringstream(hex_str.substr(1,2)) >> std::hex >> red; @@ -75,7 +75,7 @@ Color::Color(const std::string& hex_str) Color Color::rgb() const { - if (m==RGB) + if (m==Model::RGB) return *this; else { @@ -108,13 +108,13 @@ Color Color::rgb() const g *= 255.; b *= 255.; - return Color({r, g, b,(float) ((*this)[3]*2.55)},RGB); + return Color({r, g, b,(float) ((*this)[3]*2.55)},Model::RGB); } } Color Color::hsv() const { - if (m==HSV) + if (m==Model::HSV) return *this; else { @@ -148,13 +148,13 @@ Color Color::hsv() const s*=100.; v*=100.; - return Color({h, s, v,(float) ((*this)[3]/2.55)},HSV); + return Color({h, s, v,(float) ((*this)[3]/2.55)},Model::HSV); } } std::string Color::hex_str() const { - if (m == RGB) + if (m == Model::RGB) { std::stringstream s; s << std::hex << std::setfill('0'); diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index eabe751d..d3a3d797 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -19,23 +19,23 @@ namespace codac2 { + enum class Model + { + RGB = 0x01, + HSV = 0x02 + }; struct Color : public std::array { - enum Model - { - RGB = 0x01, - HSV = 0x02 - }; - Model m = RGB; //RGB or HSV + Model m = Model::RGB; //RGB or HSV // Constructors explicit Color(); - explicit Color(const std::array& xyz, Model m_ = RGB); - explicit Color(const std::array& xyza, Model m_ = RGB); - explicit Color(const std::initializer_list xyza, Model m_ = RGB); + explicit Color(const std::array& xyz, Model m_ = Model::RGB); + explicit Color(const std::array& xyza, Model m_ = Model::RGB); + explicit Color(const std::initializer_list xyza, Model m_ = Model::RGB); explicit Color(const std::string& hex_str); // other formats @@ -53,9 +53,9 @@ namespace codac2 friend std::ostream& operator<<(std::ostream& os, const Color& c) { - if (c.m == RGB) + if (c.m == Model::RGB) os << "RGB Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; - else if (c.m == HSV) + else if (c.m == Model::HSV) os << "HSV Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; return os; } diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 656a6e10..f63b63f0 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -12,7 +12,7 @@ using namespace std; using namespace codac2; -ColorMap::ColorMap(Color::Model m_) : +ColorMap::ColorMap(Model m_) : m(m_) { } @@ -35,13 +35,13 @@ Color ColorMap::color(float r) const // Interpolation according to the ColorMap model - if (m == Color::RGB) + if (m == Model::RGB) { color_lb = color_lb.rgb(); color_ub = color_ub.rgb(); } - else if (m == Color::HSV) + else if (m == Model::HSV) { color_lb = color_lb.hsv(); color_ub = color_ub.hsv(); diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 0205a4da..55c0d290 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -23,15 +23,15 @@ namespace codac2 */ struct ColorMap : public std::map { - Color::Model m; //RGB or HSV + Model m; //RGB or HSV - explicit ColorMap(Color::Model m_ = Color::RGB); + explicit ColorMap(Model m_ = Model::RGB); Color color (float r) const; static ColorMap haxby() { - ColorMap cmap( Color::RGB ); + ColorMap cmap( Model::RGB ); cmap[0]=Color({39.,90.,211.}); cmap[1]=Color({40.,123.,245.}); cmap[2]=Color({45.,155.,253.}); @@ -53,7 +53,7 @@ namespace codac2 static ColorMap basic() // Can't use default as name { - ColorMap cmap( Color::RGB ); + ColorMap cmap( Model::RGB ); cmap[0]=Color({10.,0.,121.}); cmap[1]=Color({40.,0.,150.}); cmap[2]=Color({20.,5.,175.}); @@ -91,7 +91,7 @@ namespace codac2 static ColorMap blue_tube() { - ColorMap cmap( Color::RGB ); + ColorMap cmap( Model::RGB ); cmap[0]=Color({76.,110.,127.}); cmap[1]=Color({136.,197.,228.}); return cmap; @@ -99,7 +99,7 @@ namespace codac2 static ColorMap red_tube() { - ColorMap cmap( Color::RGB ); + ColorMap cmap( Model::RGB ); cmap[0]=Color({169.,55.,0.}); cmap[1]=Color({241.,140.,54.}); return cmap; @@ -107,11 +107,11 @@ namespace codac2 static ColorMap rainbow() { - ColorMap cmap( Color::HSV ); + ColorMap cmap( Model::HSV ); int i = 0; for(int h = 300 ; h > 0 ; h-=10) { - cmap[i]=Color({(float)h,100.,100.},Color::HSV); + cmap[i]=Color({(float)h,100.,100.},Model::HSV); i++; } return cmap; diff --git a/tests/graphics/styles/codac2_tests_Color.cpp b/tests/graphics/styles/codac2_tests_Color.cpp index a9d0d20c..8ae4e0dd 100644 --- a/tests/graphics/styles/codac2_tests_Color.cpp +++ b/tests/graphics/styles/codac2_tests_Color.cpp @@ -25,18 +25,18 @@ TEST_CASE("Color") std::array d_hsva{0., 100., 100., 100.}; vector v{ - Color(d_rgb, Color::RGB), - Color(d_rgba, Color::RGB), - Color(d_hsv, Color::HSV), - Color(d_hsva, Color::HSV), + Color(d_rgb, Model::RGB), + Color(d_rgba, Model::RGB), + Color(d_hsv, Model::HSV), + Color(d_hsva, Model::HSV), Color("#FF0000")}; for (const auto &c : v) { CHECK(Approx(c.rgb().vec(),1.) == Color({255., 0., 0.}).vec()); CHECK(Approx(c.rgb().vec(),1.) == Color({255., 0., 0., 255.}).vec()); - CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100.}, Color::HSV).vec()); - CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100., 100.}, Color::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100.}, Model::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({0., 100., 100., 100.}, Model::HSV).vec()); } } @@ -50,18 +50,18 @@ TEST_CASE("Color") std::array d_hsva{288., 50., 100., 100.}; vector v{ - Color(d_rgb, Color::RGB), - Color(d_rgba, Color::RGB), - Color(d_hsv, Color::HSV), - Color(d_hsva, Color::HSV), + Color(d_rgb, Model::RGB), + Color(d_rgba, Model::RGB), + Color(d_hsv, Model::HSV), + Color(d_hsva, Model::HSV), Color("#e580ff")}; for (const auto &c : v) { CHECK(Approx(c.rgb().vec(),1.) == Color({229., 128., 255.}).vec()); CHECK(Approx(c.rgb().vec(),1.) == Color({229., 128., 255., a}).vec()); - CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100.}, Color::HSV).vec()); - CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100., 100.}, Color::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100.}, Model::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288., 50., 100., 100.}, Model::HSV).vec()); } } @@ -73,15 +73,15 @@ TEST_CASE("Color") std::array d_hsva { 288.,50.,100.,40. }; vector v { - Color(d_rgba, Color::RGB), - Color(d_hsva, Color::HSV), + Color(d_rgba, Model::RGB), + Color(d_hsva, Model::HSV), Color("#e580ff66") }; for(const auto& c : v) { CHECK(Approx(c.rgb().vec(),1.) == Color({229.,128.,255.,a}).vec()); - CHECK(Approx(c.hsv().vec(),1.) == Color({288.,50.,100.,40.},Color::HSV).vec()); + CHECK(Approx(c.hsv().vec(),1.) == Color({288.,50.,100.,40.},Model::HSV).vec()); } } } \ No newline at end of file diff --git a/tests/graphics/styles/codac2_tests_Color.py b/tests/graphics/styles/codac2_tests_Color.py index 21041f96..bd9e4c8e 100644 --- a/tests/graphics/styles/codac2_tests_Color.py +++ b/tests/graphics/styles/codac2_tests_Color.py @@ -31,73 +31,48 @@ def test_Color(self): ] for c in colors: - self.assertTrue(Color([255, 0, 0]).rgb().vec().match(Approx(c.rgb().vec(), 1.0))) - - # # Pink full opacity - - # d_rgb = [229,128,255] - # d_rgba = [229,128,255,255] - # d_hsv = [288,50,100] - # d_hsva = [288,50,100,100] - # d_rgb_f = [229.0/255.0, 128.0/255.0, 255.0/255.0] - # d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0] - # d_hsv_f = [288.0/360.0, 50.0/100.0, 100.0/100.0] - # d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0] - - # colors = [ - # Color(d_rgb, Model.RGB), - # Color(d_rgba, Model.RGB), - # Color(229,128,255, interpol_mode=Model.RGB), - # Color(229,128,255,255, Model.RGB), - # Color(d_hsv, Model.HSV), - # Color(d_hsva, Model.HSV), - # Color(288,50,100, interpol_mode=Model.HSV), - # Color(288,50,100,100, Model.HSV), - # Color(d_rgb_f, Model.RGB), - # Color(d_rgba_f, Model.RGB), - # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, interpol_mode=Model.RGB), - # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 1.0, Model.RGB), - # Color(d_hsv_f, Model.HSV), - # Color(d_hsva_f, Model.HSV), - # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, interpol_mode=Model.HSV), - # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 1.0, Model.HSV), - # Color("#E580FF") - # ] - - # for c in colors: - # self.assertTrue(is_close_to_html_color("#E580FF").match(c.hex_str())) - # self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) - # self.assertTrue(is_close_to([229,128,255,255]).match(c.rgba())) - # self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) - # self.assertTrue(is_close_to([288,50,100,100]).match(c.hsva())) - - # # Pink 40% opacity - - # a_rgb=102 - # a_hsv=40 - # d_rgba = [229,128,255,a_rgb] - # d_hsva = [288,50,100,a_hsv] - # d_rgba_f = [229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0] - # d_hsva_f = [288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0] - - # colors = [ - # Color(d_rgba, Model.RGB), - # Color(229,128,255,a_rgb, Model.RGB), - # Color(d_hsva, Model.HSV), - # Color(288,50,100,a_hsv, Model.HSV), - # Color(d_rgba_f, Model.RGB), - # Color(229.0/255.0, 128.0/255.0, 255.0/255.0, 102.0/255.0, Model.RGB), - # Color(d_hsva_f, Model.HSV), - # Color(288.0/360.0, 50.0/100.0, 100.0/100.0, 40.0/100.0, Model.HSV), - # Color("#E580FF66") - # ] - # for c in colors: - # self.assertTrue(is_close_to_html_color("#E580FF66").match(c.hex_str())) - # self.assertTrue(is_close_to([229,128,255]).match(c.rgb())) - # self.assertTrue(is_close_to([229,128,255,a_rgb]).match(c.rgba())) - # self.assertTrue(is_close_to([288,50,100]).match(c.hsv())) - # self.assertTrue(is_close_to([288,50,100,a_hsv]).match(c.hsva())) + self.assertTrue(Approx(c.rgb().vec(), 1.0)==Color([255, 0, 0]).rgb().vec()) + self.assertTrue(Approx(c.rgb().vec(), 1.0)==Color([255, 0, 0, 255]).rgb().vec()) + self.assertTrue(Approx(c.hsv().vec(), 1.0)==Color([0, 100, 100],Model.HSV).hsv().vec()) + self.assertTrue(Approx(c.hsv().vec(), 1.0)==Color([0, 100, 100, 100],Model.HSV).hsv().vec()) + # Pink full opacity + + d_rgb = [229,128,255] + d_rgba = [229,128,255,255] + d_hsv = [288,50,100] + d_hsva = [288,50,100,100] + + colors = [ + Color(d_rgb, Model.RGB), + Color(d_rgba, Model.RGB), + Color(d_hsv, Model.HSV), + Color(d_hsva, Model.HSV), + Color("#E580FF") + ] + + for c in colors: + self.assertTrue(Approx(c.rgb().vec(), 1.0)==Color([229,128,255]).rgb().vec()) + self.assertTrue(Approx(c.rgb().vec(), 1.0)==Color([229,128,255,255]).rgb().vec()) + self.assertTrue(Approx(c.hsv().vec(), 1.0)==Color([288,50,100],Model.HSV).hsv().vec()) + self.assertTrue(Approx(c.hsv().vec(), 1.0)==Color([288,50,100,100],Model.HSV).hsv().vec()) + + # Pink 40% opacity + + a_rgb=102 + a_hsv=40 + d_rgba = [229,128,255,a_rgb] + d_hsva = [288,50,100,a_hsv] + + + colors = [ + Color(d_rgba, Model.RGB), + Color(d_hsva, Model.HSV), + Color("#E580FF66") + ] + for c in colors: + self.assertTrue(Approx(c.rgb().vec(), 1.0)==Color([229,128,255,a_rgb]).rgb().vec()) + self.assertTrue(Approx(c.hsv().vec(), 1.0)==Color([288,50,100,a_hsv],Model.HSV).hsv().vec()) if __name__ == '__main__': From 59a86f1a32f8be4480309d61554d1e1e53efe27b Mon Sep 17 00:00:00 2001 From: godardma Date: Wed, 4 Dec 2024 14:16:44 +0100 Subject: [PATCH 13/15] [graphics] minor update (thanks to Simon's advice) --- examples/00_graphics/graphic_examples.py | 7 +++++ .../src/graphics/styles/codac2_py_Color.cpp | 12 ++++---- src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp | 2 +- src/graphics/styles/codac2_Color.cpp | 30 +++++-------------- src/graphics/styles/codac2_Color.h | 14 ++++----- src/graphics/styles/codac2_ColorMap.cpp | 2 +- 6 files changed, 28 insertions(+), 39 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index c7015a1d..be878046 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -44,9 +44,16 @@ fig2.draw_polygone([[2,4.5],[4,4.5],[4.2,3.5],[3.5,3]], [Color.none(),Color.green(0.5)]) fig2.draw_polyline([[-0.8,0],[0,1.5]], 0.2, [Color.red(),Color.black(0.3)]) fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)]) + +# Colors +# predefined colors without and with opacity fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)]) +# HTML color without and with opacity fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) +# HSV color without and with opacity fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color([108,90,78],Model.HSV),Color([108,90,78,20],Model.HSV)]) +# RGB auto cast from list +fig2.draw_box([[2.,2.3],[2.6,2.9]],[[255,0,255],[255,0,255,100]]) fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) fig3.set_axes(axis(0,[-1,21]), axis(1,[-5.5,0.5])) diff --git a/python/src/graphics/styles/codac2_py_Color.cpp b/python/src/graphics/styles/codac2_py_Color.cpp index cdd321c2..d960b3ac 100644 --- a/python/src/graphics/styles/codac2_py_Color.cpp +++ b/python/src/graphics/styles/codac2_py_Color.cpp @@ -31,9 +31,6 @@ void export_Color(py::module& m) py::class_ exported_color(m, "Color", COLOR_MAIN); exported_color - .def_readwrite("m", &Color::m, - MODEL_COLOR_M) - .def(py::init<>(),COLOR_COLOR) .def(py::init&,Model>(), @@ -44,14 +41,13 @@ void export_Color(py::module& m) COLOR_COLOR_CONST_ARRAY_FLOAT4_REF_MODEL, "xyza"_a, "m_"_a=Model::RGB) - .def(py::init&,Model>(), - COLOR_COLOR_CONST_INITIALIZER_LIST_FLOAT_MODEL, - "xyza"_a, "m_"_a=Model::RGB) - .def(py::init(), COLOR_COLOR_CONST_STRING_REF, "hex_str"_a) + .def("model", &Color::model, + CONST_MODEL_REF_COLOR_MODEL_CONST) + // Other formats @@ -114,4 +110,6 @@ void export_Color(py::module& m) STATIC_COLOR_COLOR_DARK_GRAY_FLOAT, "alpha"_a=1.) ; + + py::implicitly_convertible(); } \ No newline at end of file diff --git a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp index 41005b72..64aa7143 100644 --- a/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp +++ b/src/graphics/3rd/ipe/codac2_Figure2D_IPE.cpp @@ -82,7 +82,7 @@ std::string ipe_str(const Color& c) int ipe_opacity(const Color& c) { - return (int)(10.*round(10.*(c.m==Model::RGB ? (c[3]/255.):(c[3]/100.)))); + return (int)(10.*round(10.*(c.model()==Model::RGB ? (c[3]/255.):(c[3]/100.)))); } void Figure2D_IPE::begin_path(const StyleProperties& s, bool tip=false) diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 9d344af1..adb7b720 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -13,47 +13,31 @@ using namespace std; using namespace codac2; Color::Color() - : m(Model::RGB) -{ - (*this)[0] = 0.; - (*this)[1] = 0.; - (*this)[2] = 0.; - (*this)[3] = 0.; -} + : Color({0.,0.,0.,0.}) +{ } Color::Color(const std::array& xyz, Model m_) - : m(m_) -{ - (*this)[0] = xyz[0]; - (*this)[1] = xyz[1]; - (*this)[2] = xyz[2]; - (*this)[3] = (m == Model::RGB ? 255. : 100.); -} + : Color({xyz[0],xyz[1],xyz[2],(m_ == Model::RGB ? (float) 255. : (float) 100.)}, m_) +{ } Color::Color(const std::array& xyza, Model m_) - : m(m_) + : std::array(xyza), m(m_) { if (m_==Model::RGB) assert(xyza[0] >= 0. && xyza[0] <= 255. && xyza[1]>=0. && xyza[1] <= 255. && xyza[2]>=0. && xyza[2] <= 255. && xyza[3]>=0. && xyza[3] <= 255.); else if (m_==Model::HSV) assert(xyza[0] >= 0. && xyza[0] <= 360. && xyza[1]>=0. && xyza[1] <= 100. && xyza[2]>=0. && xyza[2] <= 100. && xyza[3]>=0. && xyza[3] <= 100.); - (*this)[0] = xyza[0]; - (*this)[1] = xyza[1]; - (*this)[2] = xyza[2]; - (*this)[3] = xyza[3]; } Color::Color(const std::initializer_list xyza, Model m_) : Color(xyza.size() == 3 ? Color(to_array<3>(xyza), m_) : Color(to_array<4>(xyza), m_)) { } -Color::Color(const std::string& hex_str) +Color::Color(const std::string& hex_str) : m(Model::RGB) { assert(hex_str.size() == 7 || hex_str.size() == 9); assert(hex_str[0] == '#'); - m = Model::RGB; - int red,green,blue,a; std::istringstream(hex_str.substr(1,2)) >> std::hex >> red; std::istringstream(hex_str.substr(3,2)) >> std::hex >> green; @@ -148,7 +132,7 @@ Color Color::hsv() const s*=100.; v*=100.; - return Color({h, s, v,(float) ((*this)[3]/2.55)},Model::HSV); + return Color({h, s, v,std::min(100.,((*this)[3]/2.55))},Model::HSV); } } diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index d3a3d797..03e789fb 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -19,16 +19,14 @@ namespace codac2 { - enum class Model - { - RGB = 0x01, - HSV = 0x02 - }; + enum Model { RGB, HSV }; struct Color : public std::array { + protected: + Model m; - Model m = Model::RGB; //RGB or HSV + public: // Constructors @@ -38,6 +36,9 @@ namespace codac2 explicit Color(const std::initializer_list xyza, Model m_ = Model::RGB); explicit Color(const std::string& hex_str); + const Model& model() const { return m; } + + // other formats std::string hex_str() const; @@ -60,7 +61,6 @@ namespace codac2 return os; } - // Predefined colors static Color none() { return Color({255., 255., 255., 0.}); }; diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index f63b63f0..728264b9 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -53,7 +53,7 @@ Color ColorMap::color(float r) const return Color({(color_lb[0] + (color_ub[0] - color_lb[0]) * local_ratio), (color_lb[1] + (color_ub[1] - color_lb[1]) * local_ratio), (color_lb[2] + (color_ub[2] - color_lb[2]) * local_ratio), - (color_lb[3] + (color_ub[3] - color_lb[3]) * local_ratio)},color_lb.m); + (color_lb[3] + (color_ub[3] - color_lb[3]) * local_ratio)},color_lb.model()); } From c0022292c16457df4fd84df7575e5769543b8c5f Mon Sep 17 00:00:00 2001 From: godardma Date: Wed, 4 Dec 2024 14:25:53 +0100 Subject: [PATCH 14/15] [graphics] minor update --- examples/00_graphics/graphic_examples.py | 2 +- src/graphics/styles/codac2_Color.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/00_graphics/graphic_examples.py b/examples/00_graphics/graphic_examples.py index be878046..b4089801 100644 --- a/examples/00_graphics/graphic_examples.py +++ b/examples/00_graphics/graphic_examples.py @@ -52,7 +52,7 @@ fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")]) # HSV color without and with opacity fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color([108,90,78],Model.HSV),Color([108,90,78,20],Model.HSV)]) -# RGB auto cast from list +# RGB color auto cast from list without and with opacity fig2.draw_box([[2.,2.3],[2.6,2.9]],[[255,0,255],[255,0,255,100]]) fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE) diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index adb7b720..55b5860d 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -92,7 +92,7 @@ Color Color::rgb() const g *= 255.; b *= 255.; - return Color({r, g, b,(float) ((*this)[3]*2.55)},Model::RGB); + return Color({r, g, b,std::min(255.,((*this)[3]*2.55))},Model::RGB); } } From 567f03de8022890935cf3700f6dcd2bef72e82b4 Mon Sep 17 00:00:00 2001 From: godardma Date: Wed, 4 Dec 2024 21:34:25 +0100 Subject: [PATCH 15/15] [graphics] protected ColorMap model --- .../graphics/styles/codac2_py_ColorMap.cpp | 6 +- src/graphics/styles/codac2_Color.h | 68 +++---- src/graphics/styles/codac2_ColorMap.h | 173 +++++++++--------- 3 files changed, 126 insertions(+), 121 deletions(-) diff --git a/python/src/graphics/styles/codac2_py_ColorMap.cpp b/python/src/graphics/styles/codac2_py_ColorMap.cpp index 3ba8d5fc..e127777e 100644 --- a/python/src/graphics/styles/codac2_py_ColorMap.cpp +++ b/python/src/graphics/styles/codac2_py_ColorMap.cpp @@ -23,13 +23,13 @@ void export_ColorMap(py::module& m) py::class_ exported_colormap(m, "ColorMap", COLORMAP_MAIN); exported_colormap - .def_readwrite("m", &ColorMap::m, - MODEL_COLORMAP_M) - .def(py::init(), COLORMAP_COLORMAP_MODEL, "m"_a=Model::RGB) + .def("model", &ColorMap::model, + CONST_MODEL_REF_COLORMAP_MODEL_CONST) + .def("color", &ColorMap::color, COLOR_COLORMAP_COLOR_FLOAT_CONST, "r"_a) diff --git a/src/graphics/styles/codac2_Color.h b/src/graphics/styles/codac2_Color.h index 03e789fb..a7ae40c6 100644 --- a/src/graphics/styles/codac2_Color.h +++ b/src/graphics/styles/codac2_Color.h @@ -28,52 +28,52 @@ namespace codac2 public: - // Constructors + // Constructors - explicit Color(); - explicit Color(const std::array& xyz, Model m_ = Model::RGB); - explicit Color(const std::array& xyza, Model m_ = Model::RGB); - explicit Color(const std::initializer_list xyza, Model m_ = Model::RGB); - explicit Color(const std::string& hex_str); + explicit Color(); + explicit Color(const std::array& xyz, Model m_ = Model::RGB); + explicit Color(const std::array& xyza, Model m_ = Model::RGB); + explicit Color(const std::initializer_list xyza, Model m_ = Model::RGB); + explicit Color(const std::string& hex_str); - const Model& model() const { return m; } + const Model& model() const { return m; } - // other formats + // other formats - std::string hex_str() const; + std::string hex_str() const; - codac2::Vector vec() const; + codac2::Vector vec() const; - // Conversions + // Conversions - Color rgb() const; - Color hsv() const; + Color rgb() const; + Color hsv() const; - // Overload flux operator + // Overload flux operator - friend std::ostream& operator<<(std::ostream& os, const Color& c) - { - if (c.m == Model::RGB) - os << "RGB Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; - else if (c.m == Model::HSV) - os << "HSV Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; - return os; - } + friend std::ostream& operator<<(std::ostream& os, const Color& c) + { + if (c.m == Model::RGB) + os << "RGB Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; + else if (c.m == Model::HSV) + os << "HSV Color (" << c[0] << "," << c[1] << "," << c[2] << "," << c[3] << ")"; + return os; + } - // Predefined colors + // Predefined colors - static Color none() { return Color({255., 255., 255., 0.}); }; - static Color black(float alpha = 1.) { return Color({0., 0., 0., (float) (alpha*255.)}); }; - static Color white(float alpha = 1.) { return Color({255., 255., 255., (float) (alpha*255.)}); }; - static Color green(float alpha = 1.) { return Color({144., 242., 0., (float) (alpha*255.)}); }; - static Color blue(float alpha = 1.) { return Color({0., 98., 198., (float) (alpha*255.)}); }; - static Color cyan(float alpha = 1.) { return Color({75., 207., 250., (float) (alpha*255.)}); }; - static Color yellow(float alpha = 1.) { return Color({255., 211., 42., (float) (alpha*255.)}); }; - static Color red(float alpha = 1.) { return Color({209., 59., 0., (float) (alpha*255.)}); }; - static Color dark_gray(float alpha = 1.) { return Color({112., 112., 112., (float) (alpha*255.)}); }; - static Color purple(float alpha = 1.) { return Color({154., 0., 170., (float) (alpha*255.)}); }; - static Color dark_green(float alpha = 1.) { return Color({94., 158., 0., (float) (alpha*255.)}); }; + static Color none() { return Color({255., 255., 255., 0.}); }; + static Color black(float alpha = 1.) { return Color({0., 0., 0., (float) (alpha*255.)}); }; + static Color white(float alpha = 1.) { return Color({255., 255., 255., (float) (alpha*255.)}); }; + static Color green(float alpha = 1.) { return Color({144., 242., 0., (float) (alpha*255.)}); }; + static Color blue(float alpha = 1.) { return Color({0., 98., 198., (float) (alpha*255.)}); }; + static Color cyan(float alpha = 1.) { return Color({75., 207., 250., (float) (alpha*255.)}); }; + static Color yellow(float alpha = 1.) { return Color({255., 211., 42., (float) (alpha*255.)}); }; + static Color red(float alpha = 1.) { return Color({209., 59., 0., (float) (alpha*255.)}); }; + static Color dark_gray(float alpha = 1.) { return Color({112., 112., 112., (float) (alpha*255.)}); }; + static Color purple(float alpha = 1.) { return Color({154., 0., 170., (float) (alpha*255.)}); }; + static Color dark_green(float alpha = 1.) { return Color({94., 158., 0., (float) (alpha*255.)}); }; }; template diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 55c0d290..c8d9e09a 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -23,99 +23,104 @@ namespace codac2 */ struct ColorMap : public std::map { - Model m; //RGB or HSV + protected: + Model m; //RGB or HSV - explicit ColorMap(Model m_ = Model::RGB); + public: + + explicit ColorMap(Model m_ = Model::RGB); - Color color (float r) const; + const Model& model() const { return m; } - static ColorMap haxby() - { - ColorMap cmap( Model::RGB ); - cmap[0]=Color({39.,90.,211.}); - cmap[1]=Color({40.,123.,245.}); - cmap[2]=Color({45.,155.,253.}); - cmap[3]=Color({73.,209.,255.}); - cmap[4]=Color({100.,230.,254.}); - cmap[5]=Color({118.,235.,226.}); - cmap[6]=Color({135.,236.,187.}); - cmap[7]=Color({194.,252.,165.}); - cmap[8]=Color({217.,251.,151.}); - cmap[9]=Color({233.,241.,131.}); - cmap[10]=Color({252.,201.,96.}); - cmap[11]=Color({255.,184.,84.}); - cmap[12]=Color({255.,170.,75.}); - cmap[13]=Color({255.,167.,83.}); - cmap[14]=Color({255.,200.,158.}); - cmap[15]=Color({255.,233.,217.}); - return cmap; - } + Color color (float r) const; - static ColorMap basic() // Can't use default as name - { - ColorMap cmap( Model::RGB ); - cmap[0]=Color({10.,0.,121.}); - cmap[1]=Color({40.,0.,150.}); - cmap[2]=Color({20.,5.,175.}); - cmap[3]=Color({0.,10.,200.}); - cmap[4]=Color({0.,25.,212.}); - cmap[5]=Color({0.,40.,224.}); - cmap[6]=Color({26.,102.,240.}); - cmap[7]=Color({13.,129.,248.}); - cmap[8]=Color({25.,175.,255.}); - cmap[9]=Color({50.,190.,255.}); - cmap[10]=Color({68.,202.,255.}); - cmap[11]=Color({97.,225.,240.}); - cmap[12]=Color({106.,235.,225.}); - cmap[13]=Color({124.,235.,200.}); - cmap[14]=Color({138.,236.,174.}); - cmap[15]=Color({172.,245.,168.}); - cmap[16]=Color({205.,255.,162.}); - cmap[17]=Color({223.,245.,141.}); - cmap[18]=Color({240.,236.,121.}); - cmap[19]=Color({247.,215.,104.}); - cmap[20]=Color({255.,189.,87.}); - cmap[21]=Color({255.,160.,69.}); - cmap[22]=Color({244.,117.,75.}); - cmap[23]=Color({238.,80.,78.}); - cmap[24]=Color({255.,90.,90.}); - cmap[25]=Color({255.,124.,124.}); - cmap[26]=Color({255.,158.,158.}); - cmap[27]=Color({245.,179.,174.}); - cmap[28]=Color({255.,196.,196.}); - cmap[29]=Color({255.,215.,215.}); - cmap[30]=Color({255.,235.,235.}); - cmap[31]=Color({255.,254.,253.}); - return cmap; - } + static ColorMap haxby() + { + ColorMap cmap( Model::RGB ); + cmap[0]=Color({39.,90.,211.}); + cmap[1]=Color({40.,123.,245.}); + cmap[2]=Color({45.,155.,253.}); + cmap[3]=Color({73.,209.,255.}); + cmap[4]=Color({100.,230.,254.}); + cmap[5]=Color({118.,235.,226.}); + cmap[6]=Color({135.,236.,187.}); + cmap[7]=Color({194.,252.,165.}); + cmap[8]=Color({217.,251.,151.}); + cmap[9]=Color({233.,241.,131.}); + cmap[10]=Color({252.,201.,96.}); + cmap[11]=Color({255.,184.,84.}); + cmap[12]=Color({255.,170.,75.}); + cmap[13]=Color({255.,167.,83.}); + cmap[14]=Color({255.,200.,158.}); + cmap[15]=Color({255.,233.,217.}); + return cmap; + } - static ColorMap blue_tube() - { - ColorMap cmap( Model::RGB ); - cmap[0]=Color({76.,110.,127.}); - cmap[1]=Color({136.,197.,228.}); - return cmap; - } + static ColorMap basic() // Can't use default as name + { + ColorMap cmap( Model::RGB ); + cmap[0]=Color({10.,0.,121.}); + cmap[1]=Color({40.,0.,150.}); + cmap[2]=Color({20.,5.,175.}); + cmap[3]=Color({0.,10.,200.}); + cmap[4]=Color({0.,25.,212.}); + cmap[5]=Color({0.,40.,224.}); + cmap[6]=Color({26.,102.,240.}); + cmap[7]=Color({13.,129.,248.}); + cmap[8]=Color({25.,175.,255.}); + cmap[9]=Color({50.,190.,255.}); + cmap[10]=Color({68.,202.,255.}); + cmap[11]=Color({97.,225.,240.}); + cmap[12]=Color({106.,235.,225.}); + cmap[13]=Color({124.,235.,200.}); + cmap[14]=Color({138.,236.,174.}); + cmap[15]=Color({172.,245.,168.}); + cmap[16]=Color({205.,255.,162.}); + cmap[17]=Color({223.,245.,141.}); + cmap[18]=Color({240.,236.,121.}); + cmap[19]=Color({247.,215.,104.}); + cmap[20]=Color({255.,189.,87.}); + cmap[21]=Color({255.,160.,69.}); + cmap[22]=Color({244.,117.,75.}); + cmap[23]=Color({238.,80.,78.}); + cmap[24]=Color({255.,90.,90.}); + cmap[25]=Color({255.,124.,124.}); + cmap[26]=Color({255.,158.,158.}); + cmap[27]=Color({245.,179.,174.}); + cmap[28]=Color({255.,196.,196.}); + cmap[29]=Color({255.,215.,215.}); + cmap[30]=Color({255.,235.,235.}); + cmap[31]=Color({255.,254.,253.}); + return cmap; + } - static ColorMap red_tube() - { - ColorMap cmap( Model::RGB ); - cmap[0]=Color({169.,55.,0.}); - cmap[1]=Color({241.,140.,54.}); - return cmap; - } + static ColorMap blue_tube() + { + ColorMap cmap( Model::RGB ); + cmap[0]=Color({76.,110.,127.}); + cmap[1]=Color({136.,197.,228.}); + return cmap; + } + + static ColorMap red_tube() + { + ColorMap cmap( Model::RGB ); + cmap[0]=Color({169.,55.,0.}); + cmap[1]=Color({241.,140.,54.}); + return cmap; + } - static ColorMap rainbow() - { - ColorMap cmap( Model::HSV ); - int i = 0; - for(int h = 300 ; h > 0 ; h-=10) + static ColorMap rainbow() { - cmap[i]=Color({(float)h,100.,100.},Model::HSV); - i++; + ColorMap cmap( Model::HSV ); + int i = 0; + for(int h = 300 ; h > 0 ; h-=10) + { + cmap[i]=Color({(float)h,100.,100.},Model::HSV); + i++; + } + return cmap; } - return cmap; - } }; } \ No newline at end of file