20 enum class Orientation {
34 Orientation orientation = Orientation::kHorizontal;
35 Alignment label_alignment = Alignment::kEnd;
38 cgv::g2d::irect color_ramp_rect;
41 bool invert_color =
false;
42 bool flip_texture =
false;
47 Alignment title_alignment = Alignment::kStart;
49 unsigned num_ticks = 10;
50 bool nice_ticks =
true;
51 bool auto_precision =
true;
54 bool show_opacity =
true;
57 cgv::g2d::shape2d_style border_style, color_ramp_style, tick_style;
58 cgv::g2d::grid2d_style background_style;
61 cgv::g2d::text2d_style text_style;
62 cgv::g2d::msdf_text_geometry label_geometry;
64 cgv::g2d::generic_2d_renderer tick_renderer;
65 cgv::g2d::generic_render_data_vec2_vec2 tick_geometry;
69 std::shared_ptr<const cgv::media::color_scale> color_scale;
71 void init_styles()
override;
72 void update_layout(
const ivec2& parent_size);
73 void create_texture();
76 void create_gui_impl()
override;
80 std::string
get_type_name()
const override {
return "color_scale_legend"; }
90 void set_color_scale(std::shared_ptr<const cgv::media::color_scale> color_scale);
92 void set_width(
size_t w);
93 void set_height(
size_t h);
95 void set_title(
const std::string& t);
97 Orientation get_orientation()
const {
return layout.orientation; }
98 void set_orientation(Orientation orientation);
100 Alignment get_label_alignment()
const {
return layout.label_alignment; }
101 void set_label_alignment(Alignment alignment);
103 void set_invert_color(
bool flag);
105 unsigned get_num_ticks() {
return num_ticks; }
106 void set_num_ticks(
unsigned n);
108 void set_label_precision(
unsigned p);
109 void set_label_auto_precision(
bool enabled);
110 void set_label_prune_trailing_zeros(
bool enabled);
111 void set_label_integer_mode(
bool enabled);
112 void set_show_opacity(
bool enabled);
base class for all drawables, which is independent of the used rendering API.
the texture class encapsulates all functionality independent of the rendering api.