Compare commits

..

No commits in common. "0224f6fd37d31783f669a2d6544aeff3862fd59e" and "764b93e0b73b08f3c59b86f7fbc0fc758045aaac" have entirely different histories.

7 changed files with 11 additions and 115 deletions

View File

@ -2,7 +2,7 @@
* floatimg.h
*/
#define FIMG_VERSION 85
#define FIMG_VERSION 84
/*
* in memory descriptor
@ -91,10 +91,6 @@ int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
/* module funcs/rampes.c */
int fimg_hdeg_a(FloatImg *img, double dcoef);
int fimg_vdeg_a(FloatImg *img, double dcoef);
/* FIMG files module */
int fimg_fileinfos(char *fname, int *datas);
int fimg_dump_to_file(FloatImg *head, char *fname, int notused);

View File

@ -1,9 +1,9 @@
#---------------------------------------------------------------
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=1
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o
fimg-libpnm.o
#---------------------------------------------------------------
@ -30,8 +30,5 @@ misc-plots.o: misc-plots.c $(DEPS)
filtrage.o: filtrage.c $(DEPS)
gcc $(COPT) -c $<
rampes.o: rampes.c $(DEPS)
gcc $(COPT) -c $<
utils.o: utils.c $(DEPS)
gcc $(COPT) -c $<

View File

@ -13,7 +13,7 @@ int x, y, offset;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p )\n", __func__, img);
fprintf(stderr," type %d size %dx%d\n", img->type,
fprintf(stderr," type %s size %dx%d\n", img->type,
img->width, img->height);
#endif

View File

@ -1,62 +0,0 @@
/*
* FLOATIMG
* rampes diverses, trucs etranges
*/
#include <stdio.h>
#include "../floatimg.h"
/* --------------------------------------------------------------------- */
int fimg_hdeg_a(FloatImg *img, double dcoef)
{
int x, y;
float value;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %f )\n", __func__, img, dcoef);
#endif
if (FIMG_TYPE_RGB != img->type) {
fprintf(stderr, "%s bad type\n", __func__);
return -6;
}
for (x=0; x<img->width; x++)
{
value = (float)x / (float)img->width;
value *= dcoef;
for (y=0; y<img->height; y++) {
fimg_plot_rgb(img, x, y, value, value, value);
}
}
return 0;
}
/* --------------------------------------------------------------------- */
int fimg_vdeg_a(FloatImg *img, double dcoef)
{
int x, y;
float value;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %f )\n", __func__, img, dcoef);
#endif
if (FIMG_TYPE_RGB != img->type) {
fprintf(stderr, "%s bad type\n", __func__);
return -6;
}
for (y=0; y<img->height; y++)
{
value = (float)y / (float)img->height;
value *= dcoef;
for (x=0; x<img->width; x++) {
fimg_plot_rgb(img, x, y, value, value, value);
}
}
return 0;
}
/* --------------------------------------------------------------------- */

View File

@ -48,26 +48,6 @@ printf("%-10s %d\n\n", fname, foo);
foo = format_from_extension(fname="foo.xyzzy");
printf("%-10s %d\n\n", fname, foo);
return 0;
}
/* --------------------------------------------------------------------- */
int essai_rampes(void)
{
FloatImg fimg;
int foo;
fimg_create(&fimg, 640, 480, FIMG_TYPE_RGB);
foo = fimg_hdeg_a(&fimg, (double)3.141592654);
fprintf(stderr, "make h deg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "hdeg.pnm", 0);
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
foo = fimg_vdeg_a(&fimg, (double)3.141592654);
fprintf(stderr, "make h deg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "vdeg.pnm", 0);
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
return 0;
}
/* --------------------------------------------------------------------- */
@ -101,7 +81,7 @@ int foo;
puts("++++++++++++++++++++++++++++++++");
foo = essai_rampes();
foo = essai_ecrire_png("dessin.png");
return 0;
}

View File

@ -55,11 +55,7 @@ static void help(int lvl)
{
Fx *fx;
puts("------ fimg special effects ------");
puts("usage:");
puts("\tfimgfix [options] <effect> source.fimg resultat.fimg");
puts("effects:");
puts("--- fimg special effects ---");
printf("\t");
for (fx=fx_list; fx->name; fx++) {
printf("%s ", fx->name);

View File

@ -12,9 +12,6 @@ int verbosity;
#define T_BLACK 1
#define T_DRAND48 2
#define T_GRAY 3
#define T_HDEG_A 4
#define T_VDEG_A 5
typedef struct {
int code;
char *name;
@ -24,11 +21,7 @@ Type types[] = {
{ T_BLACK, "black" },
{ T_DRAND48, "drand48" },
{ T_GRAY, "gray" },
{ T_GRAY, "grey" },
{ T_HDEG_A, "hdeg" },
{ T_VDEG_A, "vdeg" },
{ 0, NULL }
{ T_GRAY, "grey" }
};
static int get_type(char *name)
@ -42,6 +35,7 @@ fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name);
// #define TEST(str) ( ! strcmp(name, str) )
for (type = types; type->code; type++) {
// printf("\t%-15s %d\n", type->name, type->code);
if (!strcmp(name, type->name)) {
return type->code;
}
@ -52,16 +46,13 @@ return -1;
/* --------------------------------------------------------------------- */
static void help(int lj)
{
int foo;
puts("Usage:\tmkfimg [options] quux.fimg width height");
puts("\t-k N.N\tgive a float parameter");
fputs("\t-t bla\thowto make the pic\n\t\t", stdout);
for (foo=0; types[foo].code; foo++) {
printf("%s ", types[foo].name);
}
puts("\n\t-v\tincrease verbosity");
puts("\t-t bla\t\thowto make the pic");
puts("\t\t\tblack, drand48...");
puts("\t-v\tincrease verbosity");
if (verbosity) fimg_print_version(1);
@ -123,8 +114,6 @@ switch(type) {
case T_DRAND48: fimg_drand48(&fimg, fvalue); break;
case T_GRAY: fimg_rgb_constant(&fimg, fvalue, fvalue, fvalue);
break;
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
}
foo = fimg_dump_to_file(&fimg, fname, 0);