OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ColorRGB Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Color.hpp>

Collaboration diagram for Slic3r::ColorRGB:

Public Member Functions

 ColorRGB ()=default
 ColorRGB (float r, float g, float b)
 ColorRGB (unsigned char r, unsigned char g, unsigned char b)
 ColorRGB (const ColorRGB &other)=default
ColorRGB & operator= (const ColorRGB &other)
bool operator== (const ColorRGB &other) const
bool operator!= (const ColorRGB &other) const
bool operator< (const ColorRGB &other) const
bool operator> (const ColorRGB &other) const
ColorRGB operator+ (const ColorRGB &other) const
ColorRGB operator* (float value) const
const float *const data () const
float r () const
float g () const
float b () const
void r (float r)
void g (float g)
void b (float b)
void set (unsigned int comp, float value)
unsigned char r_uchar () const
unsigned char g_uchar () const
unsigned char b_uchar () const

Static Public Member Functions

static const ColorRGB BLACK ()
static const ColorRGB BLUE ()
static const ColorRGB BLUEISH ()
static const ColorRGB CYAN ()
static const ColorRGB DARK_GRAY ()
static const ColorRGB DARK_YELLOW ()
static const ColorRGB GRAY ()
static const ColorRGB GREEN ()
static const ColorRGB GREENISH ()
static const ColorRGB LIGHT_GRAY ()
static const ColorRGB MAGENTA ()
static const ColorRGB ORANGE ()
static const ColorRGB RED ()
static const ColorRGB REDISH ()
static const ColorRGB YELLOW ()
static const ColorRGB WHITE ()
static const ColorRGB ORCA ()
static const ColorRGB WARNING ()
static const ColorRGB X ()
static const ColorRGB Y ()
static const ColorRGB Z ()

Private Attributes

std::array< float, 3 > m_data {1.0f, 1.0f, 1.0f}

Detailed Description

Constructor & Destructor Documentation

◆ ColorRGB() [1/4]

Slic3r::ColorRGB::ColorRGB ( )
default

References b(), g(), and r().

Referenced by ColorRGB(), BLACK(), BLUE(), BLUEISH(), CYAN(), DARK_GRAY(), DARK_YELLOW(), GRAY(), GREEN(), GREENISH(), LIGHT_GRAY(), MAGENTA(), operator!=(), operator*(), operator+(), operator<(), operator=(), operator==(), operator>(), ORANGE(), ORCA(), RED(), REDISH(), WARNING(), WHITE(), X(), Y(), YELLOW(), and Z().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ColorRGB() [2/4]

Slic3r::ColorRGB::ColorRGB ( float r,
float g,
float b )
135: m_data({ std::clamp(r, 0.0f, 1.0f), std::clamp(g, 0.0f, 1.0f), std::clamp(b, 0.0f, 1.0f) })
136{
137}
std::array< float, 3 > m_data
Definition Color.hpp:18
float b() const
Definition Color.hpp:40
float g() const
Definition Color.hpp:39
float r() const
Definition Color.hpp:38

References b(), g(), m_data, and r().

Here is the call graph for this function:

◆ ColorRGB() [3/4]

Slic3r::ColorRGB::ColorRGB ( unsigned char r,
unsigned char g,
unsigned char b )
140: m_data({ std::clamp(r * INV_255, 0.0f, 1.0f), std::clamp(g * INV_255, 0.0f, 1.0f), std::clamp(b * INV_255, 0.0f, 1.0f) })
141{
142}
static const float INV_255
Definition Color.cpp:14

References b(), g(), INV_255, m_data, and r().

Here is the call graph for this function:

◆ ColorRGB() [4/4]

Slic3r::ColorRGB::ColorRGB ( const ColorRGB & other)
default

References ColorRGB().

Here is the call graph for this function:

Member Function Documentation

◆ b() [1/2]

float Slic3r::ColorRGB::b ( ) const
inline

◆ b() [2/2]

void Slic3r::ColorRGB::b ( float b)
inline
44{ m_data[2] = std::clamp(b, 0.0f, 1.0f); }

References b(), and m_data.

Here is the call graph for this function:

◆ b_uchar()

unsigned char Slic3r::ColorRGB::b_uchar ( ) const
inline
53{ return static_cast<unsigned char>(m_data[2] * 255.0f); }

References m_data.

Referenced by Slic3r::encode_color(), Slic3r::GUI::ObjectTablePanel::init_filaments_and_colors(), and Slic3r::GUI::BitmapCache::mksolid().

Here is the caller graph for this function:

◆ BLACK()

const ColorRGB Slic3r::ColorRGB::BLACK ( )
inlinestatic
55{ return { 0.0f, 0.0f, 0.0f }; }

References ColorRGB().

Referenced by Slic3r::decode_colors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BLUE()

const ColorRGB Slic3r::ColorRGB::BLUE ( )
inlinestatic
56{ return { 0.0f, 0.0f, 1.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ BLUEISH()

const ColorRGB Slic3r::ColorRGB::BLUEISH ( )
inlinestatic
57{ return { 0.5f, 0.5f, 1.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ CYAN()

const ColorRGB Slic3r::ColorRGB::CYAN ( )
inlinestatic
58{ return { 0.0f, 1.0f, 1.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ DARK_GRAY()

const ColorRGB Slic3r::ColorRGB::DARK_GRAY ( )
inlinestatic
59{ return { 0.25f, 0.25f, 0.25f }; }

References ColorRGB().

Here is the call graph for this function:

◆ DARK_YELLOW()

const ColorRGB Slic3r::ColorRGB::DARK_YELLOW ( )
inlinestatic
60{ return { 0.5f, 0.5f, 0.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ data()

const float *const Slic3r::ColorRGB::data ( ) const
inline
36{ return m_data.data(); }

References m_data.

Referenced by Slic3r::GLShaderProgram::set_uniform().

Here is the caller graph for this function:

◆ g() [1/2]

float Slic3r::ColorRGB::g ( ) const
inline

◆ g() [2/2]

void Slic3r::ColorRGB::g ( float g)
inline
43{ m_data[1] = std::clamp(g, 0.0f, 1.0f); }

References g(), and m_data.

Here is the call graph for this function:

◆ g_uchar()

unsigned char Slic3r::ColorRGB::g_uchar ( ) const
inline
52{ return static_cast<unsigned char>(m_data[1] * 255.0f); }

References m_data.

Referenced by Slic3r::encode_color(), Slic3r::GUI::ObjectTablePanel::init_filaments_and_colors(), and Slic3r::GUI::BitmapCache::mksolid().

Here is the caller graph for this function:

◆ GRAY()

const ColorRGB Slic3r::ColorRGB::GRAY ( )
inlinestatic
61{ return { 0.5f, 0.5f, 0.5f }; }

References ColorRGB().

Here is the call graph for this function:

◆ GREEN()

const ColorRGB Slic3r::ColorRGB::GREEN ( )
inlinestatic
62{ return { 0.0f, 1.0f, 0.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ GREENISH()

const ColorRGB Slic3r::ColorRGB::GREENISH ( )
inlinestatic
63{ return { 0.5f, 1.0f, 0.5f }; }

References ColorRGB().

Here is the call graph for this function:

◆ LIGHT_GRAY()

const ColorRGB Slic3r::ColorRGB::LIGHT_GRAY ( )
inlinestatic
64{ return { 0.75f, 0.75f, 0.75f }; }

References ColorRGB().

Here is the call graph for this function:

◆ MAGENTA()

const ColorRGB Slic3r::ColorRGB::MAGENTA ( )
inlinestatic
65{ return { 1.0f, 0.0f, 1.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ operator!=()

bool Slic3r::ColorRGB::operator!= ( const ColorRGB & other) const
inline
29{ return !operator==(other); }
bool operator==(const ColorRGB &other) const
Definition Color.hpp:28

References ColorRGB(), and operator==().

Here is the call graph for this function:

◆ operator*()

ColorRGB Slic3r::ColorRGB::operator* ( float value) const
178{
179 assert(value >= 0.0f);
180 ColorRGB ret;
181 for (size_t i = 0; i < 3; ++i) {
182 ret.m_data[i] = std::clamp(value * m_data[i], 0.0f, 1.0f);
183 }
184 return ret;
185}
ColorRGB()=default

References ColorRGB(), and m_data.

Here is the call graph for this function:

◆ operator+()

ColorRGB Slic3r::ColorRGB::operator+ ( const ColorRGB & other) const
169{
170 ColorRGB ret;
171 for (size_t i = 0; i < 3; ++i) {
172 ret.m_data[i] = std::clamp(m_data[i] + other.m_data[i], 0.0f, 1.0f);
173 }
174 return ret;
175}

References ColorRGB(), and m_data.

Here is the call graph for this function:

◆ operator<()

bool Slic3r::ColorRGB::operator< ( const ColorRGB & other) const
145{
146 for (size_t i = 0; i < 3; ++i) {
147 if (m_data[i] < other.m_data[i])
148 return true;
149 else if (m_data[i] > other.m_data[i])
150 return false;
151 }
152
153 return false;
154}

References ColorRGB(), and m_data.

Here is the call graph for this function:

◆ operator=()

ColorRGB & Slic3r::ColorRGB::operator= ( const ColorRGB & other)
inline
26{ m_data = other.m_data; return *this; }

References ColorRGB(), and m_data.

Here is the call graph for this function:

◆ operator==()

bool Slic3r::ColorRGB::operator== ( const ColorRGB & other) const
inline
28{ return m_data == other.m_data; }

References ColorRGB(), and m_data.

Referenced by operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator>()

bool Slic3r::ColorRGB::operator> ( const ColorRGB & other) const
157{
158 for (size_t i = 0; i < 3; ++i) {
159 if (m_data[i] > other.m_data[i])
160 return true;
161 else if (m_data[i] < other.m_data[i])
162 return false;
163 }
164
165 return false;
166}

References ColorRGB(), and m_data.

Here is the call graph for this function:

◆ ORANGE()

const ColorRGB Slic3r::ColorRGB::ORANGE ( )
inlinestatic
66{ return { 0.92f, 0.50f, 0.26f }; }

References ColorRGB().

Here is the call graph for this function:

◆ ORCA()

const ColorRGB Slic3r::ColorRGB::ORCA ( )
inlinestatic
71{ return {0.0f, 150.f / 255.0f, 136.0f / 255}; }

References ColorRGB().

Referenced by Slic3r::GUI::ImGuiWrapper::init_style().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ r() [1/2]

float Slic3r::ColorRGB::r ( ) const
inline

◆ r() [2/2]

void Slic3r::ColorRGB::r ( float r)
inline
42{ m_data[0] = std::clamp(r, 0.0f, 1.0f); }

References m_data, and r().

Here is the call graph for this function:

◆ r_uchar()

unsigned char Slic3r::ColorRGB::r_uchar ( ) const
inline
51{ return static_cast<unsigned char>(m_data[0] * 255.0f); }

References m_data.

Referenced by Slic3r::encode_color(), Slic3r::GUI::ObjectTablePanel::init_filaments_and_colors(), and Slic3r::GUI::BitmapCache::mksolid().

Here is the caller graph for this function:

◆ RED()

const ColorRGB Slic3r::ColorRGB::RED ( )
inlinestatic
67{ return { 1.0f, 0.0f, 0.0f }; }

References ColorRGB().

Here is the call graph for this function:

◆ REDISH()

const ColorRGB Slic3r::ColorRGB::REDISH ( )
inlinestatic
68{ return { 1.0f, 0.5f, 0.5f }; }

References ColorRGB().

Here is the call graph for this function:

◆ set()

void Slic3r::ColorRGB::set ( unsigned int comp,
float value )
inline
46 {
47 assert(0 <= comp && comp <= 2);
48 m_data[comp] = std::clamp(value, 0.0f, 1.0f);
49 }

References m_data.

◆ WARNING()

const ColorRGB Slic3r::ColorRGB::WARNING ( )
inlinestatic
72{ return {241.0f / 255, 117.f / 255.0f, 78.0f / 255}; }

References ColorRGB().

Here is the call graph for this function:

◆ WHITE()

const ColorRGB Slic3r::ColorRGB::WHITE ( )
inlinestatic
70{ return { 1.0f, 1.0f, 1.0f }; }

References ColorRGB().

Referenced by Slic3r::GUI::Selection::render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ X()

const ColorRGB Slic3r::ColorRGB::X ( )
inlinestatic
74{ return { 255 / 255.f, 60 / 255.f, 91 / 255.f};}

References ColorRGB().

Referenced by Slic3r::GUI::Bed_2D::repaint(), and Slic3r::ColorRGBA::X().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Y()

const ColorRGB Slic3r::ColorRGB::Y ( )
inlinestatic
75{ return { 100 / 255.f, 200 / 255.f, 24 / 255.f};}

References ColorRGB().

Referenced by Slic3r::GUI::Bed_2D::repaint(), and Slic3r::ColorRGBA::Y().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ YELLOW()

const ColorRGB Slic3r::ColorRGB::YELLOW ( )
inlinestatic
69{ return { 1.0f, 1.0f, 0.0f }; }

References ColorRGB().

Referenced by Slic3r::GUI::Selection::render(), and Slic3r::GUI::Selection::render_synchronized_volumes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Z()

const ColorRGB Slic3r::ColorRGB::Z ( )
inlinestatic
76{ return { 47 / 255.f, 136 / 255.f, 233 / 255.f};}

References ColorRGB().

Referenced by Slic3r::GUI::Bed_2D::repaint(), and Slic3r::ColorRGBA::Z().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_data

std::array<float, 3> Slic3r::ColorRGB::m_data {1.0f, 1.0f, 1.0f}
private

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Color.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Color.cpp