\doxysection{Color.\+hpp}
\hypertarget{Color_8hpp_source}{}\label{Color_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Color.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Color.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_COLOR\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_COLOR\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Defs.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <string\_view>}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{keyword}{class\ }Color}
\DoxyCodeLine{00009\ \{}
\DoxyCodeLine{00010\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00011\ \ \ \ \ Color()\ \{\ \}}
\DoxyCodeLine{00012\ \ \ \ \ Color(std::string\_view);}
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keyword}{constexpr}\ Color(uint32\_t\ abgr)\ :\ mABGR(abgr)\ \{\ \}}
\DoxyCodeLine{00014\ \ \ \ \ \textcolor{keyword}{constexpr}\ Color(uint8\_t\ R,\ uint8\_t\ G,\ uint8\_t\ B,\ uint8\_t\ A\ =\ 255)\ :\ mABGR((A\ <<\ 24)\ |\ (B\ <<\ 16)\ |\ (G\ <<\ 8)\ |\ R)\ \{\ \}}
\DoxyCodeLine{00015\ \ \ \ \ uint32\_t\ ABGR8()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mABGR;\ \}}
\DoxyCodeLine{00016\ \ \ \ \ Color\&\ operator=(\textcolor{keyword}{const}\ Color\ \&c)\ \{\ mABGR\ =\ c.mABGR;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ Color\ \&c)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mABGR\ ==\ c.mABGR;\ \}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{bool}\ isVisible()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mABGR\ \&\ 0xff000000;\ \}}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{void}\ getFloat4(\textcolor{keywordtype}{float}\ *)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00020\ \ \ \ \ Color\ withAlpha(\textcolor{keywordtype}{float}\ a)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ Color((mABGR\ \&\ 0xffffff)\ |\ (uint(a\ *\ 255.0f)\ <<\ 24));\ \}}
\DoxyCodeLine{00021\ \ \ \ \ std::string\ str()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00022\ \ \ \ \ \textcolor{keyword}{static}\ Color\ HSV(\textcolor{keywordtype}{int}\ h,\ \textcolor{keywordtype}{float}\ s,\ \textcolor{keywordtype}{float}\ v,\ \textcolor{keywordtype}{float}\ a\ =\ 1.0f);}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keyword}{static}\ Color\ RGBA(\textcolor{keywordtype}{float}\ r,\ \textcolor{keywordtype}{float}\ g,\ \textcolor{keywordtype}{float}\ b,\ \textcolor{keywordtype}{float}\ a);}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ TRANSPARENT;}
\DoxyCodeLine{00025\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ BLACK;}
\DoxyCodeLine{00026\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ WHITE;}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ RED;}
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ GREEN;}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ BLUE;}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ CYAN;}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ MAGENTA;}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ YELLOW;}
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ ORANGE;}
\DoxyCodeLine{00034\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ PINK;}
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ POISON;}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ MINT;}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Color\ SKY;}
\DoxyCodeLine{00038\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00039\ \ \ \ \ uint32\_t\ mABGR\{0\};}
\DoxyCodeLine{00040\ \};}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::TRANSPARENT(0x00000000);}
\DoxyCodeLine{00043\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::BLACK(0xff000000);}
\DoxyCodeLine{00044\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::WHITE(0xffffffff);}
\DoxyCodeLine{00045\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::RED(0xff0000ff);}
\DoxyCodeLine{00046\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::GREEN(0xff00ff00);}
\DoxyCodeLine{00047\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::BLUE(0xffff0000);}
\DoxyCodeLine{00048\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::CYAN(0xffffff00);}
\DoxyCodeLine{00049\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::MAGENTA(0xffff00ff);}
\DoxyCodeLine{00050\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::YELLOW(0xff00ffff);}
\DoxyCodeLine{00051\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::ORANGE(0xff0080ff);}
\DoxyCodeLine{00052\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::PINK(0xff8000ff);}
\DoxyCodeLine{00053\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::POISON(0xff00ff80);}
\DoxyCodeLine{00054\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::MINT(0xff80ff00);}
\DoxyCodeLine{00055\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ Color::SKY(0xffff8000);}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{class\ }Palette}
\DoxyCodeLine{00058\ \{}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ uint\ MaxColors\ =\ 1024;}
\DoxyCodeLine{00060\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00061\ \ \ \ \ Palette()\ \{\ \}}
\DoxyCodeLine{00062\ \ \ \ \ Palette(\textcolor{keyword}{const}\ \mbox{\hyperlink{classColor}{Color}}\ *,\ uint);}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{void}\ setColor(uint,\ \mbox{\hyperlink{classColor}{Color}});}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ uint\ size()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mColors.size();\ \}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \ \ \ \ \mbox{\hyperlink{classColor}{Color}}\ operator[](uint\ i)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mColors[i\ \%\ \textcolor{keyword}{static\_cast<}uint\textcolor{keyword}{>}(mColors.size())];\ \}}
\DoxyCodeLine{00069\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ FootprintLine[2];}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ FootprintFill[2];}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ PinLine[2][2];\ \textcolor{comment}{//\ [-\/+net][z]}}
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ PinFill[2][2];\ \textcolor{comment}{//\ [-\/+net][z]}}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ PowerNet;}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{classColor}{Color}}\ GroundNet;}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keyword}{static}\ Palette\ Nets;}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{static}\ Palette\ Tracks;}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ uint\ Hues[16];}
\DoxyCodeLine{00079\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00080\ \ \ \ \ std::vector<Color>\ mColors;}
\DoxyCodeLine{00081\ \};}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{classColor}{Color}}\ Color::RGBA(\textcolor{keywordtype}{float}\ r,\ \textcolor{keywordtype}{float}\ g,\ \textcolor{keywordtype}{float}\ b,\ \textcolor{keywordtype}{float}\ a)}
\DoxyCodeLine{00084\ \{}
\DoxyCodeLine{00085\ \ \ \ \ int32\_t\ R\ =\ r\ *\ 255.0f;}
\DoxyCodeLine{00086\ \ \ \ \ int32\_t\ G\ =\ g\ *\ 255.0f;}
\DoxyCodeLine{00087\ \ \ \ \ int32\_t\ B\ =\ b\ *\ 255.0f;}
\DoxyCodeLine{00088\ \ \ \ \ int32\_t\ A\ =\ a\ *\ 255.0f;}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classColor}{Color}}((A\ <<\ 24)\ |\ (B\ <<\ 16)\ |\ (G\ <<\ 8)\ |\ R);}
\DoxyCodeLine{00090\ \};}
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_COLOR\_H}}

\end{DoxyCode}
