/*************************************************************************************************************************************/ /* */ /* C A L C U L D U N I V E A U M O Y E N M U L T I P L E X E */ /* D E F A C O N " U N I V E R S E L L E " D E S T R O I S C O M P O S A N T E S */ /* C H R O M A T I Q U E S ( R , V , B ) D ' U N E I M A G E E N V R A I E S C O U L E U R S : */ /* */ /* */ /* Definition : */ /* */ /* Cette commande genere une image */ /* dont le nom est le premier argument */ /* d'appel ; elle est le resultat du */ /* multiplexage "universel" chromatique */ /* compatible avec la palette '$xiP/universel.11'. */ /* */ /* */ /* Author of '$xci/moyen_RVB.01$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 20001210104223). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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 #include image_image_QUAD_IMAGE_EXT /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P A R A M E T R E S : */ /* */ /*************************************************************************************************************************************/ #define EDITER_EN_HEXADECIMAL \ VRAI \ /* Faut-il editer en hexadecimal ('VRAI') ou bien en decimal ('FAUX') ? */ #define NOMBRE_DE_CHIFFRES_CONSTANT \ VRAI \ /* Faut-il editer les niveaux de type 'genere_p' avec un nombre de chiffres constant */ \ /* ('VRAI') ou bien avec juste le nombre de chiffres necessaires ('FAUX') ? */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ #include xci/extrema.01.I" #define CALCUL_DU_NIVEAU_MOYEN(image,niveau_moyen) \ Bblock \ DEFV(genere_p,INIT(niveau_minimum,NIVEAU_UNDEF)); \ /* Donne le dernier niveau minimal rencontre. */ \ DEFV(pointF_2D,point_minimum); \ /* Donne les coordonnees dans [0,1] du dernier niveau minimal rencontre. */ \ DEFV(genere_p,INIT(niveau_maximum,NIVEAU_UNDEF)); \ /* Donne le dernier niveau maximal rencontre. */ \ DEFV(pointF_2D,point_maximum); \ /* Donne les coordonnees dans [0,1] du dernier niveau maximal rencontre. */ \ \ INITIALISATION_POINT_2D(point_minimum,_____cNORMALISE_OX(UNDEF),_____cNORMALISE_OY(UNDEF)); \ /* Donne les coordonnees dans [0,1] du dernier niveau minimal rencontre. */ \ INITIALISATION_POINT_2D(point_maximum,_____cNORMALISE_OX(UNDEF),_____cNORMALISE_OY(UNDEF)); \ /* Donne les coordonnees dans [0,1] du dernier niveau maximal rencontre. */ \ \ CALS(Inivo_extrema(image \ ,ADRESSE(niveau_minimum),ADRESSE(point_minimum) \ ,ADRESSE(niveau_maximum),ADRESSE(point_maximum) \ ) \ ); \ EGAL(niveau_moyen,Inivo_extrema_____niveau_moyen); \ /* Recherche des extrema... */ \ Eblock \ /* Recherche du niveau moyen d'une image. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C A L C U L D U N I V E A U M O Y E N M U L T I P L E X E */ /* D E F A C O N " U N I V E R S E L L E " D E S T R O I S C O M P O S A N T E S */ /* C H R O M A T I Q U E S ( R , V , B ) D ' U N E I M A G E E N V R A I E S C O U L E U R S : */ /* */ /*************************************************************************************************************************************/ BCommande(nombre_d_arguments,arguments) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_PIPE)); DEFV(Logical,INIT(editer_en_hexadecimal,EDITER_EN_HEXADECIMAL)); /* Faut-il editer en hexadecimal ('VRAI') ou bien en decimal ('FAUX') ? */ DEFV(Logical,INIT(nombre_de_chiffres_constant,NOMBRE_DE_CHIFFRES_CONSTANT)); /* Faut-il editer les niveaux de type 'genere_p' avec un nombre de chiffres constant */ /* ('VRAI') ou bien avec juste le nombre de chiffres necessaires ('FAUX') ? */ /*..............................................................................................................................*/ GET_ARGUMENTSi(nombre_d_arguments ,BLOC(GET_ARGUMENT_C("imageA=""A=",nom_imageA); GET_ARGUMENT_L("hexadecimal=",editer_en_hexadecimal); GET_ARGUMENT_L("constant=",nombre_de_chiffres_constant); ) ); Test(PAS_D_ERREUR(CODE_ERROR(Iload_image_en_couleurs(Image_ROUGE,Image_VERTE,Image_BLEUE ,nom_imageA ,ESPACE_DE_COULEURS_RVB ) ) ) ) Bblock DEFV(genere_p,INIT(niveau_moyen_ROUGE,NIVEAU_UNDEF)); DEFV(genere_p,INIT(niveau_moyen_VERTE,NIVEAU_UNDEF)); DEFV(genere_p,INIT(niveau_moyen_BLEUE,NIVEAU_UNDEF)); /* Definitions des trois niveaux moyens. */ DEFV(genere_p,INIT(niveau_multiplexe,NIVEAU_UNDEF)); /* Definitions du niveau multiplexe. */ CALCUL_DU_NIVEAU_MOYEN(Image_ROUGE,niveau_moyen_ROUGE); CALCUL_DU_NIVEAU_MOYEN(Image_VERTE,niveau_moyen_VERTE); CALCUL_DU_NIVEAU_MOYEN(Image_BLEUE,niveau_moyen_BLEUE); /* Recherche des niveaux moyens. */ EGAL(niveau_multiplexe,MULTIPLEXAGE_RVB_332(niveau_moyen_ROUGE,niveau_moyen_VERTE,niveau_moyen_BLEUE)); /* Calcul du niveau multiplexe. */ Test(IL_FAUT(editer_en_hexadecimal)) Bblock CAL3(Prme2("%0*x" ,INTE(DIVI(LO2X(COULEURS),NBITHX)) ,niveau_multiplexe ) ); Eblock ATes Bblock CAL3(Prme2("%0*d" ,NOMBRE_DE_CHIFFRES_NECESSAIRES(niveau_multiplexe) ,niveau_multiplexe ) ); Eblock ETes Eblock ATes Bblock gTest__CODE_ERREUR__ERREUR07(BLOC(Bblock PRINT_ATTENTION("la fin de flot a ete rencontree lors du chargement d''image's"); Eblock ) ,BLOC(Bblock PRINT_ERREUR("les fichiers demandes n'existent pas ou ne sont pas de type 'image'"); Eblock ) ); Eblock ETes RETU_Commande; Eblock ECommande