namespace
#include <include/spice-lib/print.hpp>
print This namespace exports utilities to print some of spice's types to the console.
Contents
- Reference
These are mainly meant for debugging purposes.
Functions
-
template<typename T_color>auto color_escape_string(std::string const& str, T_color const& foreground, T_color const& background) -> std::string
-
template<typename T, size_t Channels>void image(image<T, Channels> const& img, size_t stride = 1, std::ostream& stream = std::cout)
-
template<typename T = float>void histogram(std::vector<std::vector<size_t>> const& histogram, size_t max_amplitude, std::vector<color<T, 3>> const& colors = { color<T, 3>{color<T>::max, 0, 0}, color<T, 3>{0, color<T>::max, 0}, color<T, 3>{0, 0, color<T>::max} }, std::ostream& stream = std::cout)
Function documentation
template<typename T_color>
std::string spice:: print:: color_escape_string(std::string const& str,
T_color const& foreground,
T_color const& background)
Parameters | |
---|---|
str | The string to surround with escape codes |
foreground | The text colour |
background | The background colour |
Insert escape codes for terminals supporting 8 bpc colours into a string.
template<typename T = float>
void spice:: print:: histogram(std::vector<std::vector<size_t>> const& histogram,
size_t max_amplitude,
std::vector<color<T, 3>> const& colors = { color<T, 3>{color<T>::max, 0, 0}, color<T, 3>{0, color<T>::max, 0}, color<T, 3>{0, 0, color<T>::max} },
std::ostream& stream = std::cout)
Parameters | |
---|---|
histogram | The data to print |
max_amplitude | The length of the longest bar in single spaces |
colors | The colour to print each channel in. Note that the colours should be represented as RGB, superfluous colours will be ignored and missing colours will be represented as grey. |
stream | The stream to insert the histogram into |
Prints a histogram to the provided stream.