@ -4,6 +4,8 @@
@@ -4,6 +4,8 @@
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <unistd.h>
# include <floatimg.h>
@ -129,92 +131,99 @@ if (666==count) {
@@ -129,92 +131,99 @@ if (666==count) {
# endif
switch ( idFx ) {
case 0 : /* DO NOTHING */
case CR_none : /* DO NOTHING */
retval = 0 ; break ;
case 1 :
case CR_cos01 :
fimg_cos_01 ( image , image ,
fimg_get_maxvalue ( image ) ) ;
break ;
case 2 :
case CR_cos010 :
fimg_cos_010 ( image , image ,
fimg_get_maxvalue ( image ) ) ;
break ;
case 3 :
case CR_fx3 :
retval = effect_3 ( image ) ;
break ;
case 4 :
case CR_rnd48a :
brotche_rand48_a ( image , 0.20 ,
fimg_get_maxvalue ( image ) ) ;
break ;
case 5 :
case CR_rnd48b :
brotche_rand48_b ( image , 0.10 ,
fimg_get_maxvalue ( image ) * 0.8 ) ;
break ;
case 6 :
case CR_killcola :
retval = fimg_killcolors_a ( image , 0.0 ) ;
break ;
case 7 :
case CR_colmixa :
retval = fimg_colors_mixer_a ( image , 2.0 ) ;
break ;
case 8 :
case CR_ctr2x2 :
retval = insitu_ctr2x2 ( image ) ;
break ;
case 9 :
case CR_classtrial :
retval = fimg_classif_trial ( image , image , 0.37 , 0 ) ;
break ;
case 10 :
case CR_binarize :
retval = binarize ( image , 0 ) ;
break ;
case 11 :
case CR_trinarize :
retval = trinarize ( image , 0 ) ;
break ;
case 12 :
case CR_liss2x2 :
retval = fimg_lissage_2x2 ( image ) ;
( void ) fimg_killborders ( image ) ;
break ;
case 13 :
case CR_liss3x3 :
/* smooth filter */
retval = insitu_filtre3x3 ( image , 0 ) ;
break ;
case 14 :
case CR_desaturate :
retval = fimg_desaturate ( image , image , 0 ) ;
break ;
case 15 :
case CR_killlines :
retval = kill_a_few_lines ( image , fval ,
image - > height / 20 ) ;
break ;
case 16 :
case CR_water :
retval = bouger_les_pixels ( image , 8 ) ;
break ;
case 17 :
case CR_mirsplit :
retval = mirror_split ( image , 0 ) ;
break ;
case 18 :
case CR_updown :
retval = upside_down ( image ) ;
break ;
case 19 :
case CR_hipass :
/* hipass filter */
retval = insitu_filtre3x3 ( image , 1 ) ;
break ;
case 20 :
case CR_octotree :
retval = octotree_classif ( image , 0.500 , 0 ) ;
break ;
/* here are the glitches */
case 24 : /* experiment ! */
case CR_bsombra : /* experiment ! */
retval = des_bords_sombres_a ( image , 160 ) ;
break ;
case 25 :
case CR_vsglitch :
/* please make this function more tweakable */
retval = vertical_singlitch ( image , 290 + rand ( ) % 45 ,
fval , 0.19 , 0 ) ;
fval , 0.19 , 0 ) ;
break ;
case 26 :
case CR_rndblks :
retval = random_blocks ( image , 70 ) ;
break ;
case CR_message :
fprintf ( stderr , " ### message from pid %d, fv=%f ### \n " ,
getpid ( ) , fval ) ;
retval = 0 ;
break ;
default :
fprintf ( stderr , " %s : effect #%d invalid \n " ,
__func__ , idFx ) ;
@ -241,54 +250,38 @@ typedef struct {
@@ -241,54 +250,38 @@ typedef struct {
int flags ;
} Crapulor ;
# include "crapstr.h"
Crapulor CrapL [ ] = {
{ CR_none , str_none } ,
{ CR_cos01 , str_cos01 } ,
{ CR_cos010 , str_cos010 } ,
{ CR_fx3 , str_fx3 } ,
{ CR_end , str_end }
} ;
/* Warning: overengeniring inside */
# include "crapstr.h" /* generated file ! */
# define NBCRAP (sizeof(CrapL) / sizeof(Crapulor))
void list_crapulors ( char * texte )
{
int idx ;
for ( idx = 0 ; idx < NBCRAP ; idx + + ) {
fprintf ( stderr , " %3d : %3d %-12s %5d %f \n " , idx ,
CrapL [ idx ] . id ,
# define OUT stdout
fprintf ( OUT , " ______________. %s \n " , texte ) ;
for ( idx = 0 ; CrapL [ idx ] . id ! = - 1 ; idx + + ) {
fprintf ( OUT , " %-12s | %4d | %5d | %8.3f \n " ,
CrapL [ idx ] . name ,
CrapL [ idx ] . id ,
CrapL [ idx ] . ipar ,
CrapL [ idx ] . fpar ) ;
}
# undef OUT
}
/* -------------------------------------------------------------- */
char * crap_name_from_number ( int num )
{
switch ( num ) {
case 0 : return " none " ;
case 1 : return " cos01 " ;
case 2 : return " cos010 " ;
case 6 : return " killcola " ;
case 7 : return " colmixa " ;
case 8 : return " ctr2x2 " ;
case 9 : return " classif0 " ;
case 10 : return " binariz " ;
case 11 : return " trinariz " ;
case 12 : return " smoo2x2 " ;
case 13 : return " fltr3x3 " ;
case 14 : return " desatur " ;
case 15 : return " killines " ;
case 18 : return " updown " ;
case 20 : return " octoclass " ;
case 25 : return " vsglitch " ;
int idx ;
# if DEBUG_LEVEL
fprintf ( stderr , " >>> %s ( %d ) \n " , __func__ , num ) ;
# endif
for ( idx = 0 ; CrapL [ idx ] . id ! = - 1 ; idx + + ) {
if ( num = = CrapL [ idx ] . id ) {
return CrapL [ idx ] . name ;
}
}
return " ??? " ;
@ -296,8 +289,26 @@ return "???";
@@ -296,8 +289,26 @@ return "???";
/* -------------------------------------------------------------- */
int crap_number_from_name ( char * name )
{
int idx , foo , retval ;
# if DEBUG_LEVEL
fprintf ( stderr , " >>> %s ( '%s' ) \n " , __func__ , name ) ;
# endif
retval = - 1 ; /* not found */
for ( idx = 0 ; CrapL [ idx ] . id ! = - 1 ; idx + + ) {
foo = strcmp ( CrapL [ idx ] . name , name ) ;
if ( 0 = = foo ) {
// fprintf(stderr, "found '%s' -> %d\n", name,
// CrapL[idx].id);
retval = CrapL [ idx ] . id ;
break ;
}
}
return - 1 ;
return retval ; /* not found */
}
/* -------------------------------------------------------------- */