- Added '--monochrome' switch, to be used in thesis output. There is a
hardcoded lightness factor in dotout.c (MONOCHROMEFACTOR)
This commit is contained in:
parent
6a74883adf
commit
0679cbc3b8
26
src/dotout.c
26
src/dotout.c
@ -34,6 +34,7 @@ extern Role I_RRSD;
|
||||
#define RUNCOLORDELTA 0.2 // maximum hue delta between roles (0.2): smaller means role colors of a protocol become more similar.
|
||||
#define RUNCOLORCONTRACT 0.8 // contract from protocol edges: smaller means more distinction between protocols.
|
||||
#define UNTRUSTEDCOLORS 0.4
|
||||
#define MONOCHROMEFACTOR 0.7 // Monochrome settings. 0.0: all colors become white. 1.0: all colors remain the same lightness as the color versions.
|
||||
|
||||
/*
|
||||
* Dot output
|
||||
@ -270,7 +271,7 @@ hlsValue (double n1, double n2, double hue)
|
||||
|
||||
//! hls to rgb conversion
|
||||
void
|
||||
hlsrgb (int *r, int *g, int *b, double h, double l, double s)
|
||||
hlsrgbreal (int *r, int *g, int *b, double h, double l, double s)
|
||||
{
|
||||
double m1, m2;
|
||||
|
||||
@ -305,6 +306,29 @@ hlsrgb (int *r, int *g, int *b, double h, double l, double s)
|
||||
}
|
||||
}
|
||||
|
||||
//! hls to rgb conversion
|
||||
/**
|
||||
* Secretly takes the monochrome switch into account
|
||||
*/
|
||||
void
|
||||
hlsrgb (int *r, int *g, int *b, double h, double l, double s)
|
||||
{
|
||||
if (switches.monochrome)
|
||||
{
|
||||
// No colors: make lighter
|
||||
s = 0;
|
||||
h = 0;
|
||||
l = 1 - ((1 - l) * MONOCHROMEFACTOR);
|
||||
hlsrgbreal (r, g, b, h, l, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
// colors
|
||||
hlsrgbreal (r, g, b, h, l, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! print color from h,l,s triplet
|
||||
void
|
||||
printColor (double h, double l, double s)
|
||||
|
@ -76,7 +76,8 @@ switchesInit (int argc, char **argv)
|
||||
switches.countStates = false; // default off
|
||||
switches.extendNonReads = 0; // default off
|
||||
switches.extendTrivial = 0; // default off
|
||||
switches.plain = false; // default colors
|
||||
switches.plain = false; // default colors for terminal
|
||||
switches.monochrome = false; // default colors for dot
|
||||
|
||||
// Process the environment variable SCYTHERFLAGS
|
||||
process_environment ();
|
||||
@ -892,6 +893,20 @@ switcher (const int process, int index, int commandline)
|
||||
}
|
||||
}
|
||||
|
||||
if (detect (' ', "monochrome", 0))
|
||||
{
|
||||
if (!process)
|
||||
{
|
||||
/* discourage: hide
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
switches.monochrome = true;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
if (detect (' ', "intruder-actions", 1))
|
||||
{
|
||||
if (!process)
|
||||
|
@ -56,7 +56,8 @@ struct switchdata
|
||||
int countStates; //!< Count states
|
||||
int extendNonReads; //!< Show further events in arachne xml output.
|
||||
int extendTrivial; //!< Show further events in arachne xml output, based on knowledge underapproximation. (Includes at least the events of the nonreads extension)
|
||||
int plain; //!< Disable color output
|
||||
int plain; //!< Disable color output on terminal
|
||||
int monochrome; //!< Disable colors in dot output
|
||||
};
|
||||
|
||||
extern struct switchdata switches; //!< pointer to switchdata structure
|
||||
|
Loading…
Reference in New Issue
Block a user