Debian Codegraph @

texmf-dist/metapost/metauml/util_shade.mp

raw
1 % Copyright 2005 2015 Ovidiu Gheorghies
2 % Licensed under the Apache License, Version 2.0.
3
4 if known _util_shade_mp:
5 expandafter endinput
6 fi;
7 _util_shade_mp:=1;
8
9 % Sadly, this copy of the macro is needed to prevent multiple file loads being shown by MetaPost.
10 % The guard values (such as _metauml_mp) do ensure that the file isn't loaded multiple times,
11 % but this macro makes sure that MetaPost won't try to load the file and display a message for that.
12 def inputonce text libraryFile=
13 if not known scantokens ("_" & str libraryFile & "_mp"):
14 %includeonce% show "Loading " & str libraryFile;
15 scantokens ("input " & str libraryFile);
16 else:
17 %includeonce% show str libraryFile & " already loaded.";
18 fi;
19 enddef;
20
21 inputonce util_log;
22
23 vardef ShadeInfo@#=
24 _n_ := str @#;
25 generic_declare(numeric) _n.shift;
26 generic_declare(color) _n.background;
27
28 @#shift := 1;
29 @#background := .7white;
30 enddef;
31
32 vardef ShadeInfoCopy@#(text src)=
33 ShadeInfo.@#;
34 ShadeInfo_copy@#(src);
35 enddef;
36
37 vardef ShadeInfo_copy@#(text src)=
38 @#shift := src.shift;
39 @#background := src.background;
40 enddef;
41
42 vardef ShadeInfo_toString@#=
43 save @#ret;
44 string @#ret;
45 @#ret := "Shade (shift: " & (decimal @#shift) & " back: (" &
46 (decimal redpart @#background) & ", " &
47 (decimal greenpart @#background) & ", " &
48 (decimal bluepart @#background) & ")";
49
50 @#ret
51 enddef;
52
53