added the triptyq fx to library
This commit is contained in:
parent
02b4493659
commit
a433176c54
34
funcs/sfx4.c
34
funcs/sfx4.c
@ -83,4 +83,38 @@ for(idx=0; idx<surface; idx++) {
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int fimg_make_triptyq(FloatImg *src, FloatImg *dst, int notused)
|
||||
{
|
||||
int x, y, sh, foo, ow;
|
||||
float r, g, b, in[3];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (fimg_images_not_compatible(src, dst)) {
|
||||
fprintf(stderr, "%s : compatibility error\n", __func__);
|
||||
return -8;
|
||||
}
|
||||
|
||||
fimg_clear(dst);
|
||||
|
||||
ow = src->width / 3;
|
||||
for (y=0; y<src->height; y++) {
|
||||
for (x=0; x<src->width/3; x++) {
|
||||
r = g = b = 0.0;
|
||||
for (sh=0; sh<3; sh++) {
|
||||
foo = fimg_get_rgb(src, (x*3)+sh, y, in);
|
||||
r+=in[0], g+=in[1], b+=in[2];
|
||||
}
|
||||
for (sh=0; sh<3; sh++) {
|
||||
fimg_plot_rgb(dst, x, y, r, 0, 0);
|
||||
fimg_plot_rgb(dst, x+ow, y, 0, g, 0);
|
||||
fimg_plot_rgb(dst, x+(2*ow), y, 0, 0, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -26,7 +26,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Geometrie, FileType, Mirror, KillRGB,
|
||||
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
|
||||
Rectangle, Dicom, Fakolor0, Fakolor3,
|
||||
Fmorpho0, Fluffy, ThermoCol };
|
||||
Fmorpho0, Fluffy, ThermoCol, TriPtyq };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@ -66,6 +66,7 @@ Command commands[] = {
|
||||
{ "fmorpho0", Fmorpho0 },
|
||||
{ "fluffy", Fluffy },
|
||||
{ "thermocol", ThermoCol },
|
||||
{ "triptyq", TriPtyq },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@ -271,6 +272,10 @@ switch(opt) {
|
||||
foo = essai_thermocol(filename, outfile);
|
||||
fprintf(stderr, "retour thermocolor = %d\n", foo);
|
||||
break;
|
||||
case TriPtyq:
|
||||
foo = essai_triptyq(filename, outfile);
|
||||
fprintf(stderr, "retour triptyq = %d\n", foo);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
|
@ -23,6 +23,39 @@ extern int verbosity;
|
||||
#define W 1024
|
||||
#define H 768
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* new Mon Apr 1 15:35:57 UTC 2024 -> sfx4.c */
|
||||
int essai_triptyq(char *infile, char *outfile)
|
||||
{
|
||||
FloatImg src, dst;
|
||||
int idx, foo;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %s %s )\n", __func__, infile, outfile);
|
||||
|
||||
foo = fimg_create_from_dump(infile, &src);
|
||||
if (0 != foo) {
|
||||
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
|
||||
foo, infile);
|
||||
return foo;
|
||||
}
|
||||
fimg_clone(&src, &dst, 1);
|
||||
|
||||
foo = fimg_make_triptyq(&src, &dst, 0);
|
||||
if (0 != foo) {
|
||||
fprintf(stderr, "%s: make_triptyq -> %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_export_picture(&dst, outfile, 0);
|
||||
if (0 != foo) {
|
||||
fprintf(stderr, "%s: err %d exporting to '%s'\n", __func__,
|
||||
foo, outfile);
|
||||
return foo;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* nouveau 30 octobre 2022 --> fmorpho.c
|
||||
|
@ -31,6 +31,7 @@ int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
|
||||
int essai_histogramme(char *fname, int k);
|
||||
int essai_0_fausses_couleurs(char *dstfile, int type);
|
||||
int essai_thermocol(char *infile, char *outfile);
|
||||
int essai_triptyq(char *infile, char *outfile);
|
||||
|
||||
int essai_lecture_png(char *fname, char *outfile, int notused);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user