1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Node Support Backgrounds}
15
16
17
18
19
20\unprotect
21
22\registerctxluafile{nodebck}{optimize}
23
24
25
26
27
28
29\def\colorattr#1
30 {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
31 \node_backgrounds_thecolorattr{\currentcolorprefix#1}
32 \else\ifcsname\??colorattribute#1\endcsname
33 \node_backgrounds_thecolorattr{#1}
34 \fi\fi}
35
36\def\node_backgrounds_thecolorattr#1
37 {attr \colormodelattribute \c_attr_colormodel
38 attr \colorattribute \lastnamedcs
39 attr \transparencyattribute \thetransparencyattribute{#1} }
40
41\def\thecolorattr#1
42 {attr \colormodelattribute \c_attr_colormodel
43 attr \colorattribute \csname\??colorattribute#1\endcsname
44 attr \transparencyattribute \thetransparencyattribute{#1} }
45
46\def\backgroundcolorattr#1
47 {\ifcsname\??colorattribute\currentcolorprefix#1\endcsname
48 \node_backgrounds_thebackgroundcolorattr{\currentcolorprefix#1}
49 \else\ifcsname\??colorattribute#1\endcsname
50 \node_backgrounds_thebackgroundcolorattr{#1}
51 \fi\fi}
52
53\def\thebackgroundcolorattr#1
54 {attr \backgroundattribute \plusone
55 attr \colormodelattribute \c_attr_colormodel
56 attr \colorattribute \csname\??colorattribute#1\endcsname
57 attr \transparencyattribute \thetransparencyattribute{#1} }
58
59\def\node_backgrounds_thebackgroundcolorattr#1
60 {attr \backgroundattribute \plusone
61 attr \colormodelattribute \c_attr_colormodel
62 attr \colorattribute \lastnamedcs
63 attr \transparencyattribute \thetransparencyattribute{#1} }
64
65\def\thealignbackgroundcolorattr#1
66 {attr \alignbackgroundattribute \plusone
67 attr \colormodelattribute \c_attr_colormodel
68 attr \colorattribute \csname\??colorattribute#1\endcsname
69 attr \transparencyattribute \thetransparencyattribute{#1} }
70
71\unexpanded\def\backgroundhbox{\node_backgrounds_boxes_add\hbox}
72\unexpanded\def\backgroundvbox{\node_backgrounds_boxes_add\vbox}
73\unexpanded\def\backgroundvtop{\node_backgrounds_boxes_add\vtop}
74
75\unexpanded\def\backgroundline{\dontleavehmode
76 \node_backgrounds_boxes_add\hbox}
77
78
79
80
81
82
83
84
85
86
87
88
89
90\def\node_backgrounds_boxes_add#1[#2]
91 {\clf_enablebackgroundboxes
92 #1\backgroundcolorattr{#2}}
93
94\protect \endinput
95 |