wip wip wip

This commit is contained in:
tTh 2023-11-18 19:56:25 +01:00
parent 56941f1215
commit 2246a5d744
10 changed files with 58 additions and 65 deletions

View File

@ -63,6 +63,7 @@ extractbits.o: extractbits.c $(DEPS)
filtadapt.o: filtadapt.c $(DEPS)
filtres.o: filtres.c $(DEPS)
falsecolors.o: falsecolors.c $(DEPS)
gadgrect.o: gadgrect.c $(DEPS)
glitch.o: glitch.c $(DEPS)
@ -132,7 +133,6 @@ vignetize.o: vignetize.c $(DEPS)
warp0.o: warp0.c $(DEPS)
warp1.o: warp1.c $(DEPS)
warp2.o: warp2.c $(DEPS)
warp3.o: warp3.c $(DEPS)
zoom.o: zoom.c $(DEPS)
@ -152,7 +152,7 @@ OBJECTS = 7seg.o \
dither.o dither2.o dither3.o \
doublesz.o drawalpha.o drawing.o drawpatt.o \
effects.o effects2.o effects3.o extractbits.o \
filtadapt.o filtres.o \
filtadapt.o filtres.o falsecolors.o \
gadgrect.o glitch.o gradient.o \
halfsize.o \
image.o imprime.o \
@ -175,7 +175,7 @@ OBJECTS = 7seg.o \
text0.o text1.o text16x24.o \
tga.o tools.o turtle.o \
vignetize.o \
warp0.o warp1.o warp2.o warp3.o \
warp0.o warp1.o warp2.o \
zoom.o
../libtthimage.a: $(OBJECTS)

View File

@ -2,7 +2,7 @@
calcluts.c
----------
voir aussi: luts15bits.c
voir aussi: luts15bits.c & palettes.c
*/
@ -42,7 +42,7 @@ for (foo=0; foo<256; foo++) {
lut[foo] = quux;
}
return FUNC_IS_BETA;
return FUNC_IS_ALPHA;
}
/*::------------------------------------------------------------------::*/
int Image_calclut_foo(int *lut, int v0, int v255)
@ -67,7 +67,7 @@ for (foo=0; foo<256; foo++) {
if (fp!=stdout) fclose(fp);
return FUNC_IS_BETA;
return FUNC_IS_ALPHA;
}
/*::------------------------------------------------------------------::*/
int Image_load_lut(int *lut, char *fname, int flag)
@ -98,6 +98,6 @@ for (idx=0; idx<256; idx++) {
fclose(fp);
return FUNC_IS_BETA;
return FUNC_IS_ALPHA;
}
/*::------------------------------------------------------------------::*/

View File

@ -42,7 +42,7 @@ if ( (foo=Image_compare_desc(s, d)) )
Image_TGA_save("/tmp/aaaa_debug_a.tga", s, 0);
#endif
Image_clear(d, 0, 0, 0);
/* XXX Image_clear(d, 0, 0, 0); */
for (y=0; y<s->height-3; y+=3)
{
@ -108,7 +108,7 @@ if ( (foo=Image_compare_desc(s, d)) )
fprintf(stderr, "* Image_dither_3x3_1 (%s) is experimental\n", __FILE__);
#endif
Image_clear(d, 0, 0, 0);
/* XXX Image_clear(d, 0, 0, 0); */
for (y=0; y<s->height-3; y+=3)
{
@ -167,7 +167,7 @@ if ( (foo=Image_compare_desc(s, d)) )
return foo;
}
Image_clear(d, 0, 0, 0);
/* XXX Image_clear(d, 0, 0, 0); */
return FUNC_NOT_FINISH;
}
@ -183,7 +183,7 @@ if ( (foo=Image_compare_desc(s, d)) )
return foo;
}
Image_clear(d, 0, 0, 0);
/* XXX Image_clear(d, 0, 0, 0); */
return FUNC_NOT_FINISH;
}

View File

@ -69,8 +69,7 @@ fprintf(stderr, "%s ( %p %p %d %d )\n", __func__, s, d, shuff, mono);
/* remplissage de la matrice */
fprintf(stderr, " init matrice\n");
for(foo=0; foo<256; foo++)
{
for(foo=0; foo<256; foo++) {
((uint16_t *)matrice)[foo] = foo;
}
/* brasssage de la matrice */

View File

@ -64,7 +64,6 @@ printf("RGBA : %5ld\n", sizeof(RGBA));
printf("A_BitPlane : %5ld\n", sizeof(A_BitPlane));
printf("RGB_map : %5ld\n", sizeof(RGB_map));
printf("Image_Point : %5ld\n", sizeof(Image_Point));
printf("RGB LUTs : %5ld\n", sizeof(Image_LUTs));
}
/*::------------------------------------------------------------------::*/

View File

@ -24,6 +24,9 @@ Image_save_color_Map(char *file, char *name, RGB_map *map)
int foo;
FILE *fp;
fprintf(stderr, ">>> %s ( '%s' '%s' %p )\n", __func__,
file, name, map);
if ( (fp=fopen(file, "w")) == NULL ) {
fprintf(stderr, "Save Color Map: err fopen\n");
return FILE_CREATE_ERR;
@ -81,11 +84,14 @@ FILE *fp;
int nbre, r, g, b, foo, errcode;
char buffer[256];
fprintf(stderr, ">>> %s ( '%s' '%s' %p )\n", __func__,
file, name, where);
if ( name != NULL ) {
if (strlen(name)>IMG_OBJNAME_LEN) return STRING_TOO_LONG;
strcpy(where->name, name);
}
else strcpy(where->name, "no name");
else strcpy(where->name, "<noname>");
/*
* patch du 11 Décembre 2001: on utilise une fonction qui recherche le

View File

@ -35,11 +35,10 @@ Image_PtList * Image_ptl_alloc(int nbre, char *name)
Image_PtList *ptr;
#if DEBUG_LEVEL
fprintf(stderr, "Image PtList: alloc: %d '%s'\n", nbre, name);
fprintf(stderr, ">>> %s ( %d '%s' )\n", __func__, nbre, name);
#endif
if ( (ptr=malloc(sizeof(Image_PtList)))==NULL)
{
if ( (ptr=malloc(sizeof(Image_PtList)))==NULL) {
fprintf(stderr, "Image PtList: struct malloc failed\n");
#if FORCE_ABORT
abort();
@ -56,8 +55,7 @@ if (strlen(name) < IMG_OBJNAME_LEN)
else
strcpy(ptr->name, "name too long");
if ( (ptr->points=malloc(sizeof(Image_Point)*nbre))==NULL)
{
if ( (ptr->points=malloc(sizeof(Image_Point)*nbre))==NULL) {
fprintf(stderr, "Image PtList: array malloc failed\n");
#if FORCE_ABORT
abort();
@ -80,8 +78,7 @@ fprintf(stderr, "Image PtList: addpt to %p: %5d %5d %5d %5d\n",
/* in first, we check if this is a valid point list */
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "ptl addpt: invalid point list %p\n", ptl);
#if FORCE_ABORT
abort();
@ -91,12 +88,10 @@ if (ptl->control != 0xfde9601a)
/*
* in second, we check if we have room for the new point.
*/
if (ptl->nbre==ptl->alloc)
{
if (ptl->nbre==ptl->alloc) {
newsize = ptl->alloc + 200;
fprintf(stderr, "ptl: realloc array %d\n", newsize);
if ((ptrpt=realloc(ptl->points, sizeof(Image_Point)*newsize))==NULL)
{
if ((ptrpt=realloc(ptl->points, sizeof(Image_Point)*newsize))==NULL) {
fprintf(stderr, "%s: REALLOC FAIL\n", __func__);
exit(5);
}
@ -117,7 +112,7 @@ return FUNC_IS_BETA;
/*
* attention, il est _important_ de respecter le format d'écriture
* parce que les fichiers de liste de points sont parfois relus par
* des programmes FORTRAN, beaucoup plus pointilleux sur le
* des programmes FORTRAN 77, beaucoup plus pointilleux sur le
* formatage des données.
*/
int Image_ptl_write(char *filename, Image_PtList *ptl)
@ -125,17 +120,15 @@ int Image_ptl_write(char *filename, Image_PtList *ptl)
FILE *fp;
int foo;
if ( (fp=fopen(filename, "w"))==NULL )
{
fprintf(stderr, "Image PtList: write: fopen fail.\n");
if ( (fp=fopen(filename, "w"))==NULL ) {
fprintf(stderr, "%s: write %s fopen fail.\n", __func__, filename);
return FILE_CREATE_ERR;
}
fprintf(fp, "%8d\n", ptl->nbre);
fprintf(fp, "%08d%08d\n", ptl->width, ptl->height);
fprintf(fp, "%08d%08d\n", 42, 42); /* reserved */
for (foo=0; foo<ptl->nbre; foo++)
{
for (foo=0; foo<ptl->nbre; foo++) {
fprintf(fp, "%8d%8d%8d%8d\n",
ptl->points[foo].x, ptl->points[foo].y,
ptl->points[foo].h, ptl->points[foo].c);
@ -155,8 +148,7 @@ int foo;
fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, filename, ptl);
#endif
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "%s: no deadbeef in %p\n", __func__, ptl);
fprintf(stderr, " can't read '%s'\n", filename);
return 666;
@ -175,8 +167,7 @@ int Image_ptl_kill(Image_PtList *ptl, char *msg)
fprintf(stderr, "Killing point list %p for '%s'\n", ptl, msg);
#endif
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "%s: no deadbeef in %p\n", __func__, ptl);
return 666;
}
@ -198,8 +189,7 @@ return FULL_NUCKED;
int
Image_ptl_get_size(Image_PtList *ptl, int *nbre, int *alloc)
{
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "%s: no deadbeef in %p\n", __func__, ptl);
return 666;
}
@ -211,19 +201,16 @@ return OLL_KORRECT;
/*::------------------------------------------------------------------::*/
int Image_ptl_get_point(Image_PtList *ptl, Image_Point *pt, int idx)
{
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "%s: no deadbeef in %p\n", __func__, ptl);
return 666;
}
if (idx < 0)
{
if (idx < 0) {
fprintf(stderr, "%s:%s point idx %d is negative, so bad !\n",
__FILE__, __func__, idx);
return FULL_NUCKED;
}
if (idx>ptl->nbre)
{
if (idx>ptl->nbre) {
fprintf(stderr, "%s:%s point idx %d is too big, so bad !\n",
__FILE__, __func__, idx);
return FULL_NUCKED;
@ -243,8 +230,7 @@ int Image_ptl_boundingbox(Image_PtList *ptl, Image_Rect *box)
int xmin, ymin, xmax, ymax;
int foo;
if (ptl->control != 0xfde9601a)
{
if (ptl->control != 0xfde9601a) {
fprintf(stderr, "%s: no deadbeef in %p\n", __func__, ptl);
return 666;
}
@ -252,8 +238,7 @@ if (ptl->control != 0xfde9601a)
xmin = ymin = 999999999;
xmax = ymax = -999999999;
for (foo=0; foo<ptl->nbre; foo++)
{
for (foo=0; foo<ptl->nbre; foo++) {
if (ptl->points[foo].x < xmin) xmin = ptl->points[foo].x;
if (ptl->points[foo].x > xmax) xmax = ptl->points[foo].x;
if (ptl->points[foo].y < ymin) ymin = ptl->points[foo].y;

View File

@ -179,7 +179,7 @@ fprintf(stderr, "%s: ltr %3d '%c' %4d %4d\n", __func__, lettre,
#endif
/*
* use default if not provided my caller
* use default if not provided by caller
*/
if (NULL==pap) pap = &blanc;
if (NULL==ink) ink = &noir;

View File

@ -9,16 +9,16 @@
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/
int
Image_turtle_infos(Image_Desc *img, int flags)
int Image_turtle_infos(Image_Desc *img, int flags)
{
#if DEBUG_LEVEL
fprintf(stderr, "Image turtle infos: flags = %04x\n", flags);
#endif
if ( flags & 1 )
if ( flags & 1 ) {
Image_dump_descriptor(img, "turtle infos");
}
return FUNC_IS_ALPHA;
}
@ -29,8 +29,7 @@ return FUNC_IS_ALPHA;
* Q: pourquoi le canal alpha n'est pas pris en compte ?
* A: parce que :)
*/
int
Image_turtle_setcolors(Image_Desc *img, int r, int g, int b)
int Image_turtle_setcolors(Image_Desc *img, int r, int g, int b)
{
img->rt = r; img->gt = g; img->bt = b;
@ -39,23 +38,28 @@ img->at = 0; /* ? bonne valeur ? */
return FUNC_IS_ALPHA;
}
/*::------------------------------------------------------------------::*/
int
Image_turtle_move(Image_Desc *img, double xt, double yt)
int Image_turtle_move(Image_Desc *img, double xt, double yt)
{
fprintf(stderr, ">>> %s ( %p %f %f )\n", __func__, img, xt, yt);
img->xt = xt;
img->yt = yt;
fprintf(stderr, ">>> %s ( %p %f %f )\n", __func__, img, xt, yt);
return FUNC_NOT_FINISH;
}
/*::------------------------------------------------------------------::*/
int
Image_turtle_draw(Image_Desc *img, double xt, double yt)
int Image_turtle_draw(Image_Desc *img, double xt, double yt)
{
int x1, y1, x2, y2;
RGBA color = { 200, 200, 200, 0, 0, 0 };
fprintf(stderr, ">>> %s ( %p %f %f )\n", __func__, img, xt, yt);
x1 = (int)img->xt, y1 = (int)img->yt;
x2 = (int)xt , y2 = (int)yt;
Image_draw_line(img, x1, y1, x2, y2, &color);
return FUNC_NOT_FINISH;
}

View File

@ -65,13 +65,13 @@ for (y=0; y<dst->height; y++) {
return FUNC_IS_BETA;
}
/*::------------------------------------------------------------------::*/
int
Image_warp_essai_1(Image_Desc *src, Image_Desc *dst, double angle)
int Image_warp_essai_1(Image_Desc *src, Image_Desc *dst, double angle, double shift)
{
#if DEBUG_LEVEL
fprintf(stderr, "Warp 1: what I can do here ?\n");
#endif
fprintf(stderr, ">>> %s ( %p %p %f %f )\n", __func__, src, dst, angle, shift);
return FUNC_NOT_FINISH;
}