Compare commits
No commits in common. "92b7eb478ce65d3d8956f90a87be0276da26c9ae" and "cc79dd515217c8fc01ea3b28908218ca58018614" have entirely different histories.
92b7eb478c
...
cc79dd5152
@ -305,10 +305,10 @@ if (verbosity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verbosity > 1) {
|
if (verbosity > 1) {
|
||||||
fputs("=========================\n", stderr);
|
puts("=========================");
|
||||||
filterstack_list(0, __FILE__);
|
filterstack_list(0, __FILE__);
|
||||||
filterstack_list(1, __FILE__);
|
filterstack_list(1, __FILE__);
|
||||||
fputs("=========================\n", stderr);
|
puts("=========================");
|
||||||
}
|
}
|
||||||
|
|
||||||
nbrsteps = atoi(argv[optind+2]);
|
nbrsteps = atoi(argv[optind+2]);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* http://la.buvette.org/photos/cumul
|
* http://la.buvette.org/photos/cumul
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIMG_VERSION 147
|
#define FIMG_VERSION 145
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in memory descriptor
|
* in memory descriptor
|
||||||
@ -218,7 +218,6 @@ int fimg_save_as_bmp(FloatImg *src, char *outname, int flags);
|
|||||||
|
|
||||||
int fimg_test_pattern(FloatImg *fimg, int type, double dval);
|
int fimg_test_pattern(FloatImg *fimg, int type, double dval);
|
||||||
int fimg_draw_something(FloatImg *fimg);
|
int fimg_draw_something(FloatImg *fimg);
|
||||||
int fimg_mircol_1(FloatImg *dst, float mval);
|
|
||||||
int fimg_multirandom(FloatImg *fimg, long nbpass);
|
int fimg_multirandom(FloatImg *fimg, long nbpass);
|
||||||
|
|
||||||
/* file is 'funcs/utils.c' */
|
/* file is 'funcs/utils.c' */
|
||||||
|
@ -59,7 +59,7 @@ for (y=0; y<psrc->height; y++) {
|
|||||||
fimg_get_rgb(psrc, x, y, rgb);
|
fimg_get_rgb(psrc, x, y, rgb);
|
||||||
|
|
||||||
dispx = (float)x + (rgb[1]/dltg * 20.0);
|
dispx = (float)x + (rgb[1]/dltg * 20.0);
|
||||||
dispy = (float)y + (rgb[2]/dltb * 20.0);
|
dispy = (float)y + (rgb[2]/dltb * 10.0);
|
||||||
dstx = (int)roundf(dispx - 10.0);
|
dstx = (int)roundf(dispx - 10.0);
|
||||||
dsty = (int)roundf(dispy - 10.0);
|
dsty = (int)roundf(dispy - 10.0);
|
||||||
|
|
||||||
|
@ -86,24 +86,6 @@ for (y=1; y<fimg->height; y++) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
int fimg_mircol_1(FloatImg *dst, float mval)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
float fx, fy, rgb[3];
|
|
||||||
|
|
||||||
for (y=0; y<dst->height; y++) {
|
|
||||||
fy = (float)y / (float)dst->height;
|
|
||||||
for (x=0; x<dst->width; x++) {
|
|
||||||
fx = (float)x / (float)dst->width;
|
|
||||||
rgb[0] = mval * fx;
|
|
||||||
rgb[1] = mval * ((fx+fy)/2.0);
|
|
||||||
rgb[2] = mval * fy;
|
|
||||||
fimg_put_rgb(dst, x, y, rgb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------- */
|
|
||||||
int fimg_multirandom(FloatImg *fimg, long nbpass)
|
int fimg_multirandom(FloatImg *fimg, long nbpass)
|
||||||
{
|
{
|
||||||
int foo, x, y;
|
int foo, x, y;
|
||||||
|
@ -20,8 +20,7 @@ int verbosity;
|
|||||||
#define T_HDEG_A 4
|
#define T_HDEG_A 4
|
||||||
#define T_VDEG_A 5
|
#define T_VDEG_A 5
|
||||||
#define T_TPAT0 6
|
#define T_TPAT0 6
|
||||||
#define T_MIRCOL1 7
|
|
||||||
#define T_BLOUP 8
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int code;
|
int code;
|
||||||
char *name;
|
char *name;
|
||||||
@ -35,12 +34,10 @@ Type types[] = {
|
|||||||
{ T_HDEG_A, "hdeg" },
|
{ T_HDEG_A, "hdeg" },
|
||||||
{ T_VDEG_A, "vdeg" },
|
{ T_VDEG_A, "vdeg" },
|
||||||
{ T_TPAT0, "tpat0" },
|
{ T_TPAT0, "tpat0" },
|
||||||
{ T_MIRCOL1, "mircol1" },
|
|
||||||
{ T_BLOUP, "bloup" },
|
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int get_type_by_name(char *name)
|
static int get_type(char *name)
|
||||||
{
|
{
|
||||||
Type *type;
|
Type *type;
|
||||||
|
|
||||||
@ -61,18 +58,15 @@ return -1;
|
|||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
static void help(int lj)
|
static void help(int lj)
|
||||||
{
|
{
|
||||||
int foo, cc;
|
int foo;
|
||||||
|
|
||||||
puts("Usage:\tmkfimg [options] quux.fimg width height");
|
puts("Usage:\tmkfimg [options] quux.fimg width height");
|
||||||
|
|
||||||
puts("\t-k N.N\tgive a float parameter");
|
puts("\t-k N.N\tgive a float parameter");
|
||||||
fputs("\t-t bla\thowto make the pic :\n\t\t| ", stdout);
|
fputs("\t-t bla\thowto make the pic :\n\t\t", stdout);
|
||||||
|
for (foo=0; types[foo].code; foo++) {
|
||||||
for (foo=cc=0; types[foo].code; foo++) {
|
printf("%s ", types[foo].name);
|
||||||
cc += printf("%s ", types[foo].name);
|
|
||||||
if (cc>42) { cc=0; printf("\n\t\t| "); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
puts("\n\t-v\tincrease verbosity");
|
puts("\n\t-v\tincrease verbosity");
|
||||||
|
|
||||||
if (verbosity) {
|
if (verbosity) {
|
||||||
@ -98,8 +92,7 @@ while ((opt = getopt(argc, argv, "hk:t:v")) != -1) {
|
|||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h': help(0); break;
|
case 'h': help(0); break;
|
||||||
case 'k': fvalue = atof(optarg); break;
|
case 'k': fvalue = atof(optarg); break;
|
||||||
case 't': type = get_type_by_name(tname=optarg);
|
case 't': type = get_type(tname=optarg); break;
|
||||||
break;
|
|
||||||
case 'v': verbosity++; break;
|
case 'v': verbosity++; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,15 +122,13 @@ switch (nbargs) {
|
|||||||
height = atoi(argv[optind+2]);
|
height = atoi(argv[optind+2]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s need filename, width & height\n",
|
fprintf(stderr, "%s need filename, width & height\n", argv[0]);
|
||||||
argv[0]);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fname = argv[optind];
|
fname = argv[optind];
|
||||||
|
|
||||||
if (verbosity>1) fprintf(stderr, "*** mkfimg *** %s %s\n",
|
if (verbosity>1) fprintf(stderr, "*** mkfimg *** %s %s\n", __DATE__, __TIME__);
|
||||||
__DATE__, __TIME__);
|
|
||||||
if (verbosity) fprintf(stderr, "making '%s' %dx%d, type %d\n",
|
if (verbosity) fprintf(stderr, "making '%s' %dx%d, type %d\n",
|
||||||
fname, width, height, type);
|
fname, width, height, type);
|
||||||
|
|
||||||
@ -158,8 +149,6 @@ switch(type) {
|
|||||||
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
|
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
|
||||||
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
|
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
|
||||||
case T_TPAT0: fimg_test_pattern(&fimg, 0, fvalue); break;
|
case T_TPAT0: fimg_test_pattern(&fimg, 0, fvalue); break;
|
||||||
case T_MIRCOL1: fimg_mircol_1(&fimg, fvalue); break;
|
|
||||||
case T_BLOUP: fimg_draw_something(&fimg); break;
|
|
||||||
case -1: exit(1);
|
case -1: exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user