% color cfond, cbord; % cfond := (1,1,0); % couleur du fond % cbord := (.9,.9,.9); % couleur du bord % numeric sep,ray,epa; % sep := 4pt; % séparation du bord / texte % ray := 4pt; % rayon de l'arrondi % epa := 1pt; % épaisseur du bord; % % Légende Cadre avec bords arrondis (CR) % ------------------------------------------------------------------------------ vardef legendeCR(expr pos,ech,cfond,cbord,sep,ray,epa,txt) = picture $; path $$; pair BLLC,BULC,BURC,BLRC; numeric RRAY; RRAY = 1-1/sqrt(2); % Acquisition du texte à encadrer sous forme d'image $ = thelabel(txt,(0,0)) scaled ech; % Calcul des coins BLLC = llcorner $ shifted -(sep,sep); BULC = ulcorner $ shifted (-sep,sep); BURC = urcorner $ shifted (sep,sep) ; BLRC = lrcorner $ shifted (sep,-sep); % Construction du bord de la boîte $$ = (BLLC + (0,ray)) -- (BULC - (0,ray)) .. (BULC + RRAY*(ray,-ray)) .. (BULC + (ray,0)) -- (BURC - (ray,0)) .. (BURC - RRAY*(ray,ray)) .. (BURC - (0,ray)) -- (BLRC + (0,ray)) .. (BLRC + RRAY*(-ray,ray)) .. (BLRC - (ray,0)) -- (BLLC + (ray,0)) .. (BLLC + RRAY*(ray,ray)) .. cycle; fill ($$ shifted pos) withcolor cfond; draw $ shifted pos; draw ($$ shifted pos) withcolor cbord withpen pencircle scaled epa; enddef; % % Légende Cadre avec bords carrés et ombre (CCO) % ------------------------------------------------------------------------------ vardef legendeCCO(expr pos,ech,cfond,combre,sep,decalage,txt) = picture $; path $$; pair BLLC,BULC,BURC,BLRC; % Acquisition du texte à encadrer sous forme d'image $ = thelabel(txt,(0,0)) scaled ech; % Calcul des coins BLLC = llcorner $ shifted -(sep,sep); BULC = ulcorner $ shifted (-sep,sep); BURC = urcorner $ shifted (sep,sep) ; BLRC = lrcorner $ shifted (sep,-sep); % Construction du bord de la boîte $$ = BLLC -- BULC -- BURC -- BLRC -- cycle; fill ($$ shifted (pos+decalage)) withcolor combre; fill ($$ shifted pos) withcolor cfond; draw $ shifted pos; enddef; endinput