206 uint8_t
m_red, m_green, m_blue, m_alpha;
281 Lightgoldenrodyellow,
361 Color() : m_red(0), m_green(0), m_blue(0), m_alpha(255) { }
364 Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) : m_red(r), m_green(g), m_blue(b), m_alpha(a) { }
367 Color(
int r,
int g,
int b,
int a = 255) : m_red((uint8_t)r), m_green((uint8_t)g), m_blue((uint8_t)b), m_alpha((uint8_t)a) { }
379 uint8_t
red()
const {
return m_red; }
382 uint8_t
green()
const {
return m_green; }
385 uint8_t
blue()
const {
return m_blue; }
388 uint8_t
alpha()
const {
return m_alpha; }
391 void red(uint8_t r) { m_red = r; }
394 void green(uint8_t g) { m_green = g; }
397 void blue(uint8_t b) { m_blue = b; }
400 void alpha(uint8_t a) { m_alpha = a; }
475 inline void initSecondMap(std::map<Enum, string> &fromMap, std::map<string, Enum> &toMap) {
476 for(
auto it : fromMap) {
477 toMap.emplace(it.second, it.first);
537 template<
class ToClass>
539 std::cout <<
"getMapToEnum was wrongly called\n";
544 template<
class FromClass>
547 std::cout <<
"getMapToString was wrongly called " <<
typeid(fc).name() <<
"\n";
583 template<
class FromClass>
585 auto *map = graphics::getMapToString<FromClass>();
587 graphics::init<FromClass>();
589 auto it = map->find(key);
594 template<
class ToClass>
596 auto map = graphics::getMapToEnum<ToClass>();
598 graphics::init<ToClass>();
600 auto it = map->find(key);
601 if(it != map->end()) {
604 Logger::slout() <<
"Encountered invalid " <<
typeid((*map->begin()).second).name()
605 <<
": " << key <<
" " << map->size() <<
" " << map->empty() << std::endl;
606 return static_cast<ToClass
>(std::numeric_limits<int>::min());
inverted parallelogram (slanted to the left)
uint8_t red() const
Returns the red component.
string toString(FromClass key)
Color(int r, int g, int b, int a=255)
Creates a color from given RGBA-values.
std::map< Shape, string > fromShape
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
ToClass fromString(string key)
std::map< StrokeType, string > * getMapToString()
parallelogram (slanted to the right)
trapeze (upper side shorter)
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Creates a color from given RGBA-values.
StrokeType stringToStrokeType(string s)
Converts string s to stroke type.
StrokeLineCap
Line cap types of strokes.
line style "dash dot dot dash dot dot ..."
StrokeLineJoin
Line join types of strokes.
static std::ostream & slout(Level level=Level::Default)
stream for logging-output (global)
FillPattern
Fill patterns.
EdgeArrow
Types for edge arrows.
void initSecondMap(std::map< Enum, string > &fromMap, std::map< string, Enum > &toMap)
isosceles triangle (base side down)
uint8_t green() const
Returns the green component.
edge arrow at target and source node of the edge
rectangle with rounded corners
float m_width
stroke width
string toString() const
Converts the color to a string and returns it.
FillPattern m_pattern
fill pattern
std::map< FillPattern, string > fromFillPattern
Shape
Types for node shapes.
string strokeTypeToString(StrokeType st)
Converts string s to stroke type.
Fill(Color c, FillPattern pattern)
StrokeLineJoin m_join
line-join of the stroke
uint8_t alpha() const
Returns the alpha channel.
Contains logging functionality.
isosceles triangle (base side up)
void init< FillPattern >()
bool operator!=(const Color &c) const
Returns true iff c and this color differ in any component.
string fillPatternToString(FillPattern fp)
Converts fillpattern fp to string.
Colors represented as RGBA values.
std::map< string, StrokeType > * getMapToEnum()
bool operator==(const Color &c) const
Returns true iff c and this color are equal in every component.
FillPattern intToFillPattern(int i)
Converts integer i to fill pattern.
edge arrow at target node of the edge
Color(const string &str)
Crates a color from string str.
line style "dash dot dash dot ..."
uint8_t blue() const
Returns the blue component.
Color(const char *str)
Crates a color from string str.
void blue(uint8_t b)
Sets the blue component to b.
Shape stringToShape(string s)
Converts string s to shape.
StrokeType intToStrokeType(int i)
Converts integer i to stroke type.
Basic declarations, included by all source files.
void initFillPatternHashing()
std::map< StrokeType, string > fromStrokeType
Name
Named colors (same as SVG color keywords).
StrokeType m_type
stroke type (e.g.
Fill(Color c, Color bgColor, FillPattern pattern)
FillPattern stringToFillPattern(string s)
Converts string s to fill pattern.
void green(uint8_t g)
Sets the green component to g.
StrokeType
Line types of strokes.
std::map< string, StrokeType > toStrokeType
edge arrow at source node of the edge
The namespace for all OGDF objects.
friend std::ostream & operator<<(std::ostream &os, const Color &c)
Writes the string representation of color c to output stream os.
Color m_color
stroke color
void alpha(uint8_t a)
Sets the alpha channel to a.
Color()
Creates an opaque black color.
void init< StrokeType >()
Color m_bgColor
background color of fill pattern
StrokeLineCap m_cap
line-cap of the stroke
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
string shapeToString(Shape s)
Converts shape s to string.
void red(uint8_t r)
Sets the red component to r.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
std::map< string, FillPattern > toFillPattern
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
std::map< string, Shape > toShape
inverted trapeze (upper side longer)