17 #ifndef PALETTE_H_PREDOEHL_UOFARIZONAVISION
18 #define PALETTE_H_PREDOEHL_UOFARIZONAVISION
41 std::vector< kjb::PixelRGBA > my_pal;
55 Palette(
const std::vector< kjb::PixelRGBA >& some_pal )
62 return my_pal.at( index );
72 void swap(
size_t iii,
size_t jjj )
74 std::swap( my_pal.at( iii ), my_pal.at( jjj ) );
109 weights.
max( &max_index );
110 return my_pal[ max_index ];
int get_length() const
Return the length of the vector.
Definition: m_vector.h:501
size_t size() const
Return the size of the palette (the number of entries)
Definition: c_palette.h:66
#define KJB_THROW(ex)
Definition: l_exception.h:46
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
kjb::PixelRGBA pick_max(const kjb::Vector &weights) const
An unforgiving function that chooses the most popular color.
Definition: c_palette.h:105
kjb::PixelRGBA weighted_sum(const kjb::Vector &) const
compute a new color mixed from old.
Definition: c_palette.cpp:352
Palette(size_t)
Build a palette of the indicated size.
Definition: c_palette.cpp:319
Code for a wrapper class around the C struct Pixel.
Wrapped version of the C struct Pixel, with Alpha (opacity).
Definition: i_pixel.h:57
void swap(kjb::Gsl_Multimin_fdf &m1, kjb::Gsl_Multimin_fdf &m2)
Swap two wrapped multimin objects.
Definition: gsl_multimin.h:693
Value_type max(int *max_index) const
Find maximum element in the vector, both its value and index.
Definition: m_vector.h:1425
Construct some colors, for visualizing grids of numbers.
Definition: c_palette.h:39
void swap(size_t iii, size_t jjj)
Swap two palette entries, indicated by index.
Definition: c_palette.h:72
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
kjb::PixelRGBA(Palette::* PIXOP)(const kjb::Vector &) const
convenience typedef for generating/mixing a color.
Definition: c_palette.h:85
Palette(const std::vector< kjb::PixelRGBA > &some_pal)
Build a palette from a vector of colored Pixels.
Definition: c_palette.h:55
Support for error handling exception classes in libKJB.
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
const kjb::PixelRGBA & operator[](size_t index) const
Return a palette entry, a color, in the form of a Pixel.
Definition: c_palette.h:60