test_charts.anubis
5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
read widgets4/widget.anubis
read widgets4/host_window.anubis
read widgets4/image.anubis
read tools/basis.anubis
read graphism/geometrical_figures.anubis
read charts.anubis
define Float
opp
(
Float f
) =
if (0-f) is
{
failure then f,
success(s) then s
}.
define List(HG_Data)
data
=
[
hg_data("1",[2.0,0.0]),
hg_data("2",[4.0,5.0]),
hg_data("3",[0.0,0.0]),
hg_data("4",[1.0,3.0]),
//hg_data("5",[1.0,opp(2.0)]),
hg_data("5",[1.0,2.0]),
hg_data("6",[1.0,1.1]),
hg_data("7",[2.0,6.0]),
hg_data("8",[1.0,1.0]),
hg_data("9",[1.0,2.0]),
hg_data("10",[0.0,0.0]),
].
define Chart_Settings
chart_sets
=
chart_sets
(rgba(255,255,180,255), // bg_color
rgba(0,0,0,255),
rgba(0,100,195,255),
"helvetica_medium_r_8",
true).
define Image_Settings
img_sets
=
img_sets(500,500,rgba(255,255,255,0)).
define One
make_histogram_H
=
with histo =
histogram("Histogramme_H",
rgba(255,0,0,255),
data,
[rgba(200,75,75,255),rgba(70,175,60,255)],
["N1","N2"],
chart_sets,
img_sets,
horizontal,
ysets(0.0,1,1,sub_axis(dotted(4,2)),true),
4),
if create_histogram_r(histo,"histogram_h.jpeg") is
{
error(e) then print("ERROR ="+e+"\n"),
ok(rh) then
if x_int(rh) is (nxi,lxi) then
if y_int(rh) is (nyi,lyi) then
print("xh = "+x_length(rh)+"\n");
print("yh = "+y_length(rh)+"\n");
print(if left_top(rh) is (l,t) then "l="+l+" t="+t+"\n");
print(if right_bottom(rh) is (r,b) then "r="+r+" b="+b+"\n");
print("nxi="+nxi+" lxi="+lxi+"\n");
print("nyi="+nyi+" lyi="+lyi+"\n");
if left_top(rh) is (hl,ht) then
if right_bottom(rh) is (hr,hb) then
if read_image_from_JPEG_file("histogram.jpeg") is
{
cannot_open_file then print("COF\n"),
decompress_error then print("DE \n"),
ok(j) then
print("W="+width(j)+" H="+height(j)+"\n");
with rgbai = to_RGBA(j,1),
draw_rectangle(rgbai,rect(hl,ht,300,300),rgba(238,196,249,130));
if write_image_to_JPEG_file(to_JPEG(rgbai),"surimpress.jpg",100) is
{
cannot_create_file then print("CCF\n"),
compression_error then print("CE \n"),
ok then print("OK \n")
}
}}.
create_histogram(histo).
*** Histo V
define List(HG_Data)
data_V
=
[
hg_data("1111111",[2.0,0.0]),
hg_data("2222222",[4.0,5.0]),
hg_data("3333333",[0.0,0.0]),
hg_data("44444",[1.0,3.0]),
//hg_data("5",[1.0,opp(2.0)]),
hg_data("5555555",[1.0,2.0]),
hg_data("66666",[1.0,1.1]),
hg_data("77777",[2.0,6.0]),
hg_data("8888888",[1.0,1.0]),
hg_data("999999",[1.0,2.0]),
hg_data("100000",[0.0,0.0]),
].
define One
make_histogram_V
=
with histo =
histogram("Histogramme_V",
rgba(255,0,0,255),
data_V,
[rgba(200,75,75,255),rgba(70,175,60,255)],
["NV1","NV2"],
chart_sets,
img_sets,
vertical,
ysets(0.0,1,1,sub_axis(dotted(4,2)),true),
4),
if create_histogram_r(histo,"histogram_v.jpeg") is
{
error(e) then print("ERROR ="+e+"\n"),
ok(rh) then
if x_int(rh) is (nxi,lxi) then
if y_int(rh) is (nyi,lyi) then
print("xh = "+x_length(rh)+"\n");
print("yh = "+y_length(rh)+"\n");
print(if left_top(rh) is (l,t) then "l="+l+" t="+t+"\n");
print(if right_bottom(rh) is (r,b) then "r="+r+" b="+b+"\n");
print("nxi="+nxi+" lxi="+lxi+"\n");
print("nyi="+nyi+" lyi="+lyi+"\n");
if left_top(rh) is (hl,ht) then
if right_bottom(rh) is (hr,hb) then
if read_image_from_JPEG_file("histogram.jpeg") is
{
cannot_open_file then print("COF\n"),
decompress_error then print("DE \n"),
ok(j) then
print("W="+width(j)+" H="+height(j)+"\n");
with rgbai = to_RGBA(j,1),
draw_rectangle(rgbai,rect(hl,ht,300,300),rgba(238,196,249,130));
if write_image_to_JPEG_file(to_JPEG(rgbai),"surimpress.jpg",100) is
{
cannot_create_file then print("CCF\n"),
compression_error then print("CE \n"),
ok then print("OK \n")
}
}}.
*** CurveQualify
define List(Curve_Data_XY)
cd_true
=
[dataxy(1.2,3.0),
dataxy(2.5,5.0),
dataxy(2.7,8.0),
dataxy(3.5,9.0),
dataxy(4.7,3.5)].
define List(Curve_Data_XY)
cd_false
=
[dataxy(2.0,4.0),
dataxy(1.0,7.0)].
define One
make_curves
=
with curve =
curve("Curve",
rgba(255,0,0,255),
[cdata(rgba(200,55,100,255),dotted(3,3),disk(medium,rgba(200,55,100,255)),"BON",cd_true),
cdata(rgba(100,100,255,255),filled,fsquare(medium,rgba(100,100,255,255),),
"MAUVAIS",cd_false)],
chart_sets,
img_sets,
xsets(0.5,0.0,2,horizontal),
ysets(0.0,1,0,sub_axis(dotted(4,2)),true)),
create_curve(curve,"curve.jpeg").
create_curve(curve).
define One
test_charts
=
print(" Histogram (X horizontal) : ..... 1\n");
print(" Histogram (X vertical) : ....... 2\n");
print(" Curves : ....................... 3\n");
with c = prompt(" choice : "),
if c="1" then make_histogram_H else
if c="2" then make_histogram_V else
if c="3" then make_curves else
test_charts.
global define One
test_charts (List(String) ls) =
if ls is
{
[] then test_charts,
[c . t] then
if c="1" then make_histogram_H else
if c="2" then make_histogram_V else
if c="3" then make_curves else
test_charts
}.