/*************************************************************************************************************************************/
/* */
/* G E N E R A T I O N D ' U N E M A T R I C E C O N T E N A N T 4 I M A G E S : */
/* */
/* */
/* Definition : */
/* */
/* Cette commande genere une matrice */
/* contenant quatre images arbitraires */
/* et la place dans l'image Resultat. */
/* */
/* */
/* Author of '$xci/images_04$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 1993??????????). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* I N T E R F A C E ' listG ' : */
/* */
/* */
/* :Debut_listG: */
/* :Fin_listG: */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D I R E C T I V E S S P E C I F I Q U E S D E C O M P I L A T I O N : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* F I C H I E R S D ' I N C L U D E S : */
/* */
/*************************************************************************************************************************************/
#include INCLUDES_BASE
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R A M E T R E S : */
/* */
/*************************************************************************************************************************************/
#define METTRE_UN_FOND \
FAUX \
/* Faut-il mettre un fond au cas ou l'on ne charge pas toutes les images... */
#define MOYENNAGE \
VRAI \
/* Indique si l'on moyenne ('VRAI'), ou bien si l'on prend le 'MAXI' ('FAUX'). */
#define CALCULER_LE_MAXIMUM \
CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE \
/* Dans le cas ou il ne faut pas calculer la moyenne, indique s'il faut calculer le */ \
/* maximum ('VRAI') ou pas ('FAUX'), c'est-a-dire prendre le point courant... */
#define FENETRE_BG \
VRAI
#define FENETRE_BD \
VRAI
#define FENETRE_HG \
VRAI
#define FENETRE_HD \
VRAI
/* Indique si la fenetre correspondante doit etre remplie par l'image associee ('VRAI') ou */
/* pas ('FAUX'). */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
#define GENERE(generer_la_fenetre,FENETRE,imageR,nom) \
Bblock \
Test(IL_FAUT(generer_la_fenetre)) \
Bblock \
EGAL(nom_image \
,COND(IFEQ_chaine(nom_postfixe,NOM_UNDEF_VIDE) \
,nom \
,chain_Aconcaten2_sauf_nom_pipe(nom,nom_postfixe) \
) \
); \
Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA,nom_image)))) \
/* A = image courante. */ \
Bblock \
FENETRE(imageR \
,ImageA \
,MULTIPLICITE_2x2_POUR_LES_DEMI_FENETRES \
,MULTIPLICITE_2x2_POUR_LES_DEMI_FENETRES \
,moyennage \
,calculer_le_maximum \
); \
/* R = image courante reduite la ou il faut ; on notera que la reduction de moitie est faite */ \
/* par extraction du 'MAXI' (voir 'moyennage') et ce afin d'eviter des artefacts dans */ \
/* images "multi-palettes"... */ \
Eblock \
ATes \
Bblock \
Test(IL_NE_FAUT_PAS(mettre_un_fond)) \
Bblock \
Test__CODE_ERREUR__ERREUR07; \
Eblock \
ATes \
Bblock \
Eblock \
ETes \
Eblock \
ETes \
Eblock \
ATes \
Bblock \
Eblock \
ETes \
Eblock \
/* Procedure d'insertion de l'image courante dans une fenetre. */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* R E D U C T I O N D ' U N E S U I T E D E 4 I M A G E S A R G U M E N T */
/* E T G E N E R A T I O N D ' U N E M A T R I C E L E S C O N T E N A N T */
/* E N V U E D E L E S A N I M E R : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(CHAR,INIC(POINTERc(nom_imageF),NOM_PIPE));
/* Nom du fond a utiliser au cas ou l'on ne charge pas toutes les images... */
DEFV(Logical,INIT(mettre_un_fond,METTRE_UN_FOND));
/* Indique s'il faut mettre ('VRAI') ou pas ('FAUX') un fond derriere... */
DEFV(CHAR,INIC(POINTERc(nom_imageABG),NOM_PIPE));
DEFV(CHAR,INIC(POINTERc(nom_imageABD),NOM_PIPE));
DEFV(CHAR,INIC(POINTERc(nom_imageAHG),NOM_PIPE));
DEFV(CHAR,INIC(POINTERc(nom_imageAHD),NOM_PIPE));
/* Nom des quatre images a reduire. */
DEFV(CHAR,INIC(POINTERc(nom_postfixe),NOM_UNDEF_VIDE));
/* Nom d'un eventuel postfixe a placer derriere <nom_imageA> (par exemple '$ROUGE'). */
DEFV(CHAR,INIT(POINTERc(nom_image),NOM_UNDEF));
/* Nom courant des images. */
DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
/* Nom de l'image a generer. */
DEFV(Logical,INIT(moyennage,MOYENNAGE));
/* Indique si l'on moyenne ('VRAI'), ou bien si l'on prend le 'MAXI' ('FAUX'). */
DEFV(Logical,INIT(calculer_le_maximum,CALCULER_LE_MAXIMUM));
/* Dans le cas ou il ne faut pas calculer la moyenne, indique s'il faut calculer le */
/* maximum ('VRAI') ou pas ('FAUX'), c'est-a-dire prendre le point courant... */
DEFV(Logical,INIT(fenetre_BG,FENETRE_BG));
DEFV(Logical,INIT(fenetre_BD,FENETRE_BD));
DEFV(Logical,INIT(fenetre_HG,FENETRE_HG));
DEFV(Logical,INIT(fenetre_HD,FENETRE_HD));
/* Indique si la fenetre correspondante doit etre remplie par l'image associee ('VRAI') ou */
/* pas ('FAUX'). */
/*..............................................................................................................................*/
GET_ARGUMENTSi(nombre_d_arguments
,BLOC(GET_ARGUMENT_L("Ireduction_moitie_____compatibilite_20030611=""compatibilite_20030611="
,Ireduction_moitie_____compatibilite_20030611
);
GET_ARGUMENT_C("imageF=""F=",nom_imageF);
GET_ARGUMENT_L("fond=",mettre_un_fond);
GET_ARGUMENT_C("imageABG=""ABG=",nom_imageABG);
GET_ARGUMENT_C("imageABD=""ABD=",nom_imageABD);
GET_ARGUMENT_C("imageAHG=""AHG=",nom_imageAHG);
GET_ARGUMENT_C("imageAHD=""AHD=",nom_imageAHD);
GET_ARGUMENT_C("postfixe=",nom_postfixe);
GET_ARGUMENT_C("imageR=""R=",nom_imageR);
GET_ARGUMENT_L("moyenne=",moyennage);
GET_ARGUMENT_L("maximum=",calculer_le_maximum);
GET_ARGUMENT_L("BG=",fenetre_BG);
GET_ARGUMENT_L("BD=",fenetre_BD);
GET_ARGUMENT_L("HG=",fenetre_HG);
GET_ARGUMENT_L("HD=",fenetre_HD);
)
);
CALi(Inoir(ImageR));
/* Initialisation de l'image Resultat. */
Test(IL_FAUT(mettre_un_fond))
Bblock
Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageR,nom_imageF))))
/* Un fond a ete demande, on le charge... */
Bblock
Eblock
ATes
Bblock
Test__CODE_ERREUR__ERREUR07;
EGAL(mettre_un_fond,FAUX);
/* En cas d'erreur, on supprime le fond, ce qui correspond a un fond 'NOIR'. */
Eblock
ETes
Eblock
ATes
Bblock
Eblock
ETes
GENERE(fenetre_BG,DEMI_FENETRE_BG_MULTIPLE,ImageR,nom_imageABG);
GENERE(fenetre_BD,DEMI_FENETRE_BD_MULTIPLE,ImageR,nom_imageABD);
GENERE(fenetre_HG,DEMI_FENETRE_HG_MULTIPLE,ImageR,nom_imageAHG);
GENERE(fenetre_HD,DEMI_FENETRE_HD_MULTIPLE,ImageR,nom_imageAHD);
/* Reduction primaire, */
CALi(Iupdate_image(nom_imageR,ImageR));
/* Et rangement... */
RETU_Commande;
Eblock
ECommande