cgv
Loading...
Searching...
No Matches
colored_model.h
1#pragma once
2
3#include <vector>
4#include "color_storage.h"
5
6#include "lib_begin.h"
7
8namespace cgv {
9 namespace media {
11 class CGV_API colored_model
12 {
13 protected:
16 public:
28 virtual ~colored_model();
31
32 bool has_colors() const;
34 void set_color(size_t i, const void* col_ptr);
36 void set_color(size_t i, const rgb& col);
38 void set_color(size_t i, const rgb8& col);
40 void set_color(size_t i, const rgba& col);
42 void set_color(size_t i, const rgba8& col);
44 void put_color(size_t i, void* col_ptr) const;
46 void put_color(size_t i, rgb& col) const;
48 void put_color(size_t i, rgba& col) const;
50 void put_color(size_t i, rgb8& col) const;
52 void put_color(size_t i, rgba8& col) const;
54 size_t get_nr_colors() const;
56 void resize_colors(size_t nr_colors);
58 size_t get_color_size() const;
60 ColorType get_color_storage_type() const;
61
62 const void* get_color_data_ptr() const;
63 const void* get_color_data_vector_ptr() const;
64 void* ref_color_data_ptr();
65 void* ref_color_data_vector_ptr();
66
68
69 void ensure_colors(ColorType _color_type, size_t nr_colors = -1);
71 void destruct_colors();
72 };
73 }
74}
75
76#include <cgv/config/lib_end.h>
interface for color storage of different internal types
colored_model & operator=(const colored_model &cm)
assignment operator
void destruct_colors()
destruct color storage
colored_model()
construct colored model
void set_color(size_t i, const void *col_ptr)
set i-th color to color of type stored in storage
ColorType get_color_storage_type() const
return storage type of colors, if no colors are allocated CT_RGBA8 is returned
size_t get_color_size() const
return the size of one allocated color in byte
bool has_colors() const
check whether colors have been allocated
void ensure_colors(ColorType _color_type, size_t nr_colors=-1)
ensure that colors are allocated and of given storage type
abst_color_storage * color_storage_ptr
pointer to color storage
void put_color(size_t i, void *col_ptr) const
set color of type stored in storage to i-th color
size_t get_nr_colors() const
return number of allocated colors
void resize_colors(size_t nr_colors)
resize the color storage to given number of colors
this header is dependency free
Definition print.h:11
cgv::media::color< cgv::type::uint8_type, cgv::media::RGB, cgv::media::OPACITY > rgba8
declare rgba color type with 8 bit components
Definition color.h:902
cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
declare rgba color type with 32 bit components
Definition color.h:898
cgv::media::color< float, cgv::media::RGB > rgb
declare rgb color type with 32 bit components
Definition color.h:896
cgv::media::color< cgv::type::uint8_type, cgv::media::RGB > rgb8
declare rgb color type with 8 bit components
Definition color.h:900