#!/bin/csh

#######################################################################################################################################
#                                                                                                                                     #
#         M U L T I P L E X A G E   D E S   T R O I S   C O M P O S A N T E S   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   E N   U N E   I M A G E   E N   F A U S S E   C O U L E U R                           #
#         V I S U A L I S A B L E   E N S U I T E   A V E C   '$xiP/universel.11'  :                                                  #
#                                                                                                                                     #
#                                                                                                                                     #
#         Utilisation :                                                                                                               #
#                                                                                                                                     #
#                   $xci/multiplex$Z    <imageA> <imageR>                                                                             #
#                                                                                                                                     #
#                                                                                                                                     #
#         Author of '$xci/multiplex$Z' :                                                                                              #
#                                                                                                                                     #
#                     Jean-Francois Colonna (LACTAMME, AAAAMMJJhhmmss).                                                               #
#                                                                                                                                     #
#######################################################################################################################################

set                 nomA=$1
set                 nomR=$2

FileTmpB            nomT

set                 deux__bits=4
                                        # Pour passer d'une representation 2 bits a une representation sur 8 bits ('B').              #
set                 trois_bits=8
                                        # Pour passer d'une representation 3 bits a une representation sur 8 bits ('R' et 'V').       #
@                   mBLEUE = 1
                                        # "Translation" du 'BLEUE'.                                                                   #
@                   mVERTE = $mBLEUE * $deux__bits
                                        # "Translation" du 'VERTE'.                                                                   #
@                   mROUGE = $mVERTE * $trois_bits
                                        # "Translation" du 'ROUGE'.                                                                   #

set                 deux__bits=`$xcg/scale$X x=1 d=$COULEURS m=$deux__bits`
                                        # Pour passer d'une representation 8 bits a une representation sur 2 bits ('B').              #
set                 trois_bits=`$xcg/scale$X x=1 d=$COULEURS m=$trois_bits`
                                        # Pour passer d'une representation 8 bits a une representation sur 3 bits ('R' et 'V').       #

$xci/scale$X        A=$nomA$ROUGE a=$trois_bits b=0.0 R=$nomT$ROUGE $formatI
$xci/scale$X        A=$nomA$VERTE a=$trois_bits b=0.0 R=$nomT$VERTE $formatI
$xci/scale$X        A=$nomA$BLEUE a=$deux__bits b=0.0 R=$nomT$BLEUE $formatI
                                        # Passage de 8 a 2 ('BLEUE') ou 3 ('ROUGE' et 'VERTE') bits, suivant la composante.           #

$xci/scale$X        A=$nomT$ROUGE a=$mROUGE     b=0.0 R=$nomT$ROUGE $formatI
$xci/scale$X        A=$nomT$VERTE a=$mVERTE     b=0.0 R=$nomT$VERTE $formatI
$xci/scale$X        A=$nomT$BLEUE a=$mBLEUE     b=0.0 R=$nomT$BLEUE $formatI
                                        # Cadrage relatif des trois composantes.                                                      #

$xci/or_03$X        A1=$nomT$ROUGE A2=$nomT$VERTE A3=$nomT$BLEUE R=$nomR $formatI
                                        # Et enfin, multiplexage des trois composantes.                                               #

FileTmpE            nomT
                                        # Puis destruction des trois composantes {ROUGE,VERTE,BLEUE}.                                 #



Copyright © Jean-François Colonna, 2019-2021.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2019-2021.