Mobdification de Courbe en CourbeDat dans gdd.mp, ajout des variable gddXlabel et...
[mp-gdd.git] / gdd-tra.mp
1 %% === Pseudo-transparence =====================================================
2 %% Code emprunté à Anthony Phan :
3 %%   http://www-math.univ-poitiers.fr/~phan/metalpha.html
4
5 color   gdd_tc;
6 numeric gdd_ta;
7 picture gdd_ap;
8
9 def gdd_AlphaFill expr c =
10     gdd_ap := nullpicture;
11     gdd_AlphaPicture(currentpicture,c);
12     addto currentpicture also gdd_ap;
13 enddef;
14
15 vardef gdd_AlphaPicture(expr p,c) =
16     save p_; picture p_;
17     p_ := nullpicture;
18     addto p_ contour c withcolor gdd_ta[background,gdd_tc];
19     for p__ within p:
20       if (not clipped p__) and (not bounded p__):
21         addto p_ also p__ withcolor
22          gdd_ta[(redpart p__,greenpart p__,bluepart p__), gdd_tc];
23       else:
24         begingroup save gdd_ap;
25          picture gdd_ap; gdd_ap = nullpicture;
26          gdd_AlphaPicture(p__,pathpart p__);
27          addto p_ also gdd_ap;
28         endgroup;
29       fi
30     endfor;
31     clip p_ to c;
32     addto gdd_ap also p_;
33 enddef;
34
35 vardef ColorieAvecTransparence(expr p,c,a)  =
36     gdd_tc := c; gdd_ta := a;
37     if path p:
38       gdd_AlphaFill (p gddEnPlace)
39     else:
40       gdd_AlphaFill ((gddTraceObjet p) gddEnPlace)
41     fi
42 enddef;
43
44 endinput;

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.