00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00042 #include "image.h"
00043 #include "proto2D.h"
00044 #include "bidon.h"
00045 #include <stdlib.h>
00046 #include <string.h>
00047
00048
00062 param *bidon_lect( bidon_t *des, param *ptp, char *debq){
00063 char question[500];
00064
00065 sprintf(question, "%s dimX (entier)", debq);
00066 lec_param(question, ptp);
00067 des->dimX = atoi(ptp->rep);
00068 ptp = ptp->next;
00069
00070 sprintf(question, "%s dimY (entier)", debq);
00071 lec_param(question, ptp);
00072 des->dimY = atoi(ptp->rep);
00073 ptp = ptp->next;
00074
00075 sprintf(question, "%s gain (reel)", debq);
00076 lec_param(question, ptp);
00077 des->gain = (float)atof(ptp->rep);
00078 ptp = ptp->next;
00079
00080 sprintf(question, "%s forme (nom)", debq);
00081 lec_param(question, ptp);
00082 strcpy(des->forme, ptp->rep);
00083 ptp = ptp->next;
00084
00085 return(ptp);
00086 }
00087
00088
00100 int bidonu1_init(bidon_t *des, imau1 im0, imau1 *imres){
00101 int i, j;
00102
00103
00104 imres->nc = im0.nc;
00105 imres->nr = im0.nr;
00106 sprintf(imres->nom, "%s_bidon_%dx%d", im0.nom, des->dimX, des->dimY);
00107 alloc_imau1(imres);
00108
00109
00110 des->msq.nc = des->dimX;
00111 des->msq.nr = des->dimY;
00112 alloc_imafl(&(des->msq));
00113
00114
00115 if( strcmp(des->forme, "rectangle") == 0 ){
00116 printf("\n>>bidonu1_init : masque %s %dx%d\n",
00117 des->forme, des->dimX, des->dimY);
00118 for(j=0; j<des->dimY; j++)
00119 for(i=0; i<des->dimX; i++){
00120 des->msq.p[j][i] = des->gain;
00121 }
00122 }
00123 else if( strcmp(des->forme, "triangle") == 0 ){
00124 printf("\n>>bidonu1_init : masque %s %dx%d\n",
00125 des->forme, des->dimX, des->dimY);
00126
00127 }
00128 else{
00129 printf("\n>>ERREUR bidonu1_init : masque %s inconnu\n",
00130 des->forme, des->dimX, des->dimY);
00131 exit(1);
00132 }
00133 }
00134
00135
00136
00147 int bidonu1_calc(bidon_t *des, imau1 im0, imau1 *imres){
00148 int i, j;
00149
00150 for(j=0; j<im0.nr; j++)
00151 for(i=0; i<im0.nc; i++)
00152 imres->p[j][i] = im0.p[j][i];
00153
00154 }
00155
00156