|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
165 uint8_t
m_red, m_green, m_blue, m_alpha;
240 Lightgoldenrodyellow,
320 Color() : m_red(0), m_green(0), m_blue(0), m_alpha(255) { }
323 Color(uint8_t
r, uint8_t g, uint8_t b, uint8_t a = 255)
324 : m_red(
r), m_green(g), m_blue(b), m_alpha(a) { }
328 : m_red((uint8_t)
r), m_green((uint8_t)g), m_blue((uint8_t)b), m_alpha((uint8_t)a) { }
340 uint8_t
red()
const {
return m_red; }
343 uint8_t
green()
const {
return m_green; }
346 uint8_t
blue()
const {
return m_blue; }
349 uint8_t
alpha()
const {
return m_alpha; }
355 void green(uint8_t g) { m_green = g; }
358 void blue(uint8_t b) { m_blue = b; }
361 void alpha(uint8_t a) { m_alpha = a; }
404 : m_color(
Color::Name::Black)
433 : m_color(c), m_bgColor(
Color::Name::Black), m_pattern(pattern) { }
436 : m_color(c), m_bgColor(bgColor), m_pattern(pattern) { }
453 inline void initSecondMap(std::map<Enum, string>& fromMap, std::map<string, Enum>& toMap) {
454 for (
auto it : fromMap) {
455 toMap.emplace(it.second, it.first);
514 template<
class ToClass>
516 std::cout <<
"getMapToEnum was wrongly called\n";
521 template<
class FromClass>
524 std::cout <<
"getMapToString was wrongly called " <<
typeid(fc).name() <<
"\n";
560 template<
class FromClass>
562 auto* map = graphics::getMapToString<FromClass>();
564 graphics::init<FromClass>();
566 auto it = map->find(key);
571 template<
class ToClass>
573 auto map = graphics::getMapToEnum<ToClass>();
575 graphics::init<ToClass>();
577 auto it = map->find(key);
578 if (it != map->end()) {
581 Logger::slout() <<
"Encountered invalid " <<
typeid((*map->begin()).second).name() <<
": "
582 << key <<
" " << map->size() <<
" " << map->empty() << std::endl;
583 return static_cast<ToClass
>(std::numeric_limits<int>::min());
Colors represented as RGBA values.
The namespace for all OGDF objects.
@ Dashdot
line style "dash dot dash dot ..."
@ Last
edge arrow at target node of the edge
std::map< FillPattern, string > fromFillPattern
FillPattern m_pattern
fill pattern
StrokeType
Line types of strokes.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
std::map< string, StrokeType > toStrokeType
uint8_t red() const
Returns the red component.
Color(int r, int g, int b, int a=255)
Creates a color from given RGBA-values.
std::map< string, FillPattern > toFillPattern
Color()
Creates an opaque black color.
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
Fill(Color c, FillPattern pattern)
Color m_color
stroke color
void init< StrokeType >()
Fill(Color c, Color bgColor, FillPattern pattern)
@ RoundedRect
rectangle with rounded corners
void init< FillPattern >()
std::map< string, Shape > toShape
@ Dashdotdot
line style "dash dot dot dash dot dot ..."
@ Trapeze
trapeze (upper side shorter)
void initFillPatternHashing()
void initSecondMap(std::map< Enum, string > &fromMap, std::map< string, Enum > &toMap)
Contains logging functionality.
@ First
edge arrow at source node of the edge
float m_width
stroke width
bool operator==(const Color &c) const
Returns true iff c and this color are equal in every component.
std::map< Shape, string > fromShape
Color m_bgColor
background color of fill pattern
uint8_t green() const
Returns the green component.
ToClass fromString(string key)
@ Parallelogram
parallelogram (slanted to the right)
StrokeLineJoin m_join
line-join of the stroke
Name
Named colors (same as SVG color keywords).
StrokeLineJoin
Line join types of strokes.
@ InvTriangle
isosceles triangle (base side up)
uint8_t blue() const
Returns the blue component.
void alpha(uint8_t a)
Sets the alpha channel to a.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
StrokeType m_type
stroke type (e.g.
void green(uint8_t g)
Sets the green component to g.
string toString() const
Converts the color to a string and returns it.
std::map< FromClass, string > * getMapToString()
Color(const char *str)
Crates a color from string str.
EdgeArrow
Types for edge arrows.
@ InvTrapeze
inverted trapeze (upper side longer)
Color(const string &str)
Crates a color from string str.
void blue(uint8_t b)
Sets the blue component to b.
@ InvParallelogram
inverted parallelogram (slanted to the left)
uint8_t alpha() const
Returns the alpha channel.
string toString(FromClass key)
Basic declarations, included by all source files.
@ Both
edge arrow at target and source node of the edge
bool operator!=(const Color &c) const
Returns true iff c and this color differ in any component.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Shape
Types for node shapes.
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Creates a color from given RGBA-values.
std::map< StrokeType, string > fromStrokeType
StrokeLineCap
Line cap types of strokes.
friend std::ostream & operator<<(std::ostream &os, const Color &c)
Writes the string representation of color c to output stream os.
FillPattern intToFillPattern(int i)
Converts integer i to fill pattern.
FillPattern
Fill patterns.
@ Triangle
isosceles triangle (base side down)
void red(uint8_t r)
Sets the red component to r.
StrokeType intToStrokeType(int i)
Converts integer i to stroke type.
static std::ostream & slout(Level level=Level::Default)
stream for logging-output (global)
StrokeLineCap m_cap
line-cap of the stroke
std::map< string, ToClass > * getMapToEnum()