Compare commits
6 Commits
64489f5707
...
162e04e6fc
Author | SHA1 | Date | |
---|---|---|---|
|
162e04e6fc | ||
|
75584b8ada | ||
|
bce4464719 | ||
|
05f65ef5c9 | ||
|
530d2755d3 | ||
|
ce49cc7a08 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,6 +11,7 @@ Lib/t_t16x24
|
||||
Lib/testbmp
|
||||
|
||||
Tests/*.tga
|
||||
Tests/*.gif
|
||||
Tests/t_t16x24
|
||||
|
||||
Tools/genplot2
|
||||
|
9
Docs/README.md
Normal file
9
Docs/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# libtthimage
|
||||
|
||||
Les fichiers HTML que vous avez ici sont des versions historiques,
|
||||
qui seront peut-être mise à jour au prochain grand refactoring.
|
||||
Leur contenu est donc à prendre avec des pincettes, ymmv.
|
||||
|
||||
Ceci dit, les principes généraux sont encore bons...
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "../tthimage.h"
|
||||
|
||||
@ -17,6 +18,10 @@ h = img->height; w = img->width;
|
||||
fprintf(stderr, "%s: %p px=%d py=%d k=%d\n", __func__, img, parX, parY, k);
|
||||
#endif
|
||||
|
||||
if (k) {
|
||||
fprintf(stderr, "%s: k (%d) muste be 0\n", __func__, k);
|
||||
}
|
||||
|
||||
for (y=0; y<h; y++)
|
||||
{
|
||||
for (foo=0; foo<parX; foo++)
|
||||
@ -41,6 +46,13 @@ int foo;
|
||||
fprintf(stderr, "%s ( %p %d %d )\n", __func__, img, k0, k1);
|
||||
#endif
|
||||
|
||||
if (k0) {
|
||||
fprintf(stderr, "%s: k0 (%d) muste be 0\n", __func__, k0);
|
||||
}
|
||||
if (k1) {
|
||||
fprintf(stderr, "%s: k1 (%d) muste be 0\n", __func__, k1);
|
||||
}
|
||||
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (foo=0; foo<k1; foo++)
|
||||
|
@ -191,6 +191,9 @@ int Image_degouline_0(Image_Desc *source, Image_Desc *but, int k1, int k2)
|
||||
int x, y;
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">> %s ( %p %p %d %d )\n", __func__, source, but, k1, k2);
|
||||
#endif
|
||||
fprintf(stderr, "Degouline %d %d\n", k1, k2);
|
||||
|
||||
if ( (foo=Image_compare_desc(source, but)) ) {
|
||||
@ -198,10 +201,6 @@ if ( (foo=Image_compare_desc(source, but)) ) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s ( %p %p %d %d )\n", __func__, source, but, k1, k2);
|
||||
#endif
|
||||
|
||||
for (x=0; x<source->width; x++)
|
||||
{
|
||||
|
||||
|
@ -26,22 +26,20 @@ Image_effect_x_0(Image_Desc *src, Image_Desc *dst, int kr, int kg, int kb)
|
||||
int foo, x, y, r, g, b;
|
||||
int cr, cg, cb;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "*** Effect X_0: coeffs: %d %d %d\n", kr, kg, kb);
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
fprintf(stderr, "Image effect x 0: images are differents %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "*** Effect X_0: coeffs: %d %d %d\n", kr, kg, kb);
|
||||
#endif
|
||||
cr = cg = cb = 0; /* raz des compteurs */
|
||||
|
||||
cr = cg = cb = 0;
|
||||
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
for (y=0; y<dst->height; y++) {
|
||||
for (x=0; x<dst->width; x++) {
|
||||
Image_getRGB(src, x, y, &r, &g, &b);
|
||||
if (r > kr) {
|
||||
foo = g; g = b; b = foo;
|
||||
@ -61,7 +59,7 @@ for (y=0; y<dst->height; y++)
|
||||
|
||||
fprintf(stderr, "* %s : counts: %d %d %d\n", __func__, cr, cg, cb);
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* 2 fevrier 2003: je fait du n'importe quoi, la... */
|
||||
@ -113,10 +111,10 @@ if ( (foo=Image_compare_desc(src, dst)) )
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
/* a vrai dire, je ne comprend pas ou caser kx, ky et kz */
|
||||
|
||||
for (y=0; y<dst->height; y++) {
|
||||
for (x=0; x<dst->width; x++) {
|
||||
r = src->Rpix[y][x];
|
||||
g = src->Gpix[y][x];
|
||||
b = src->Bpix[y][x];
|
||||
@ -159,6 +157,7 @@ return FUNC_IS_BETA;
|
||||
* 27 Oct 2003: je debugge pendant que le thé infuse :)
|
||||
* 16 Mai 2005: je commence a ecrire la documentation.
|
||||
* 29 sept 2015: je devrais finir la doc d'ici 2 ans.
|
||||
* 19 aout 2022: je comprend pas ce que c'est censé faire :)
|
||||
*
|
||||
*/
|
||||
int
|
||||
@ -168,16 +167,16 @@ int foo, sx, sy;
|
||||
int x, y, r, g, b;
|
||||
int cx, cy, dx, dy;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : kx %d ky %d comp '%s'\n", __func__, kx, ky, comp);
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : kx %d ky %d comp '%s'\n", __func__, kx, ky, comp);
|
||||
#endif
|
||||
|
||||
if (strlen(comp) != 2)
|
||||
{
|
||||
fprintf(stderr, "eff x3: bad comp parameter '%s'\n", comp);
|
||||
@ -242,8 +241,7 @@ for (y=0; y<dst->height; y++)
|
||||
return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_effect_x_4(Image_Desc *src, Image_Desc *dst, int flags)
|
||||
int Image_effect_x_4(Image_Desc *src, Image_Desc *dst, int flags)
|
||||
{
|
||||
int foo;
|
||||
int x, y;
|
||||
@ -253,16 +251,13 @@ int r, g, b, r2, g2, b2;
|
||||
fprintf(stderr, "*** effect x4 is not ready for prime time ***\n");
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "Image effect x 4: images are differents %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (y=0; y<src->height; y++)
|
||||
{
|
||||
for (x=0; x<src->width; x++)
|
||||
{
|
||||
for (y=0; y<src->height; y++) {
|
||||
for (x=0; x<src->width; x++) {
|
||||
r = src->Rpix[y][x];
|
||||
g = src->Gpix[y][x];
|
||||
b = src->Bpix[y][x];
|
||||
@ -289,6 +284,7 @@ return FUNC_IS_BETA;
|
||||
/* 22 avril 2007: je vais essayer d'inventer un nouveau truc, mais il
|
||||
* faudrait que les gosses arretent de ma casser les oreilles avec leur
|
||||
* machine a batailles. putain de gamecube... */
|
||||
/* 23 aout 2022 : j'ai bien envie d'une SNES et d'un Trinitron */
|
||||
int
|
||||
Image_effect_x_5(Image_Desc *src, Image_Desc *dst, int kx, int ky, int kz)
|
||||
{
|
||||
@ -299,7 +295,7 @@ double dr, dg, db, dr2, dg2, db2;
|
||||
|
||||
fprintf(stderr, "*** effect x5 is not ready for prime time ***\n");
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s ( %p %p %d %d %d )\n", __func__, src, dst,
|
||||
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__, src, dst,
|
||||
kx, ky, kz);
|
||||
#endif
|
||||
|
||||
|
@ -24,23 +24,19 @@ Image_save_color_Map(char *file, char *name, RGB_map *map)
|
||||
int foo;
|
||||
FILE *fp;
|
||||
|
||||
if ( (fp=fopen(file, "w")) == NULL )
|
||||
{
|
||||
if ( (fp=fopen(file, "w")) == NULL ) {
|
||||
fprintf(stderr, "Save Color Map: err fopen\n");
|
||||
return FILE_CREATE_ERR;
|
||||
}
|
||||
|
||||
if ( map->nbre == 0 )
|
||||
{
|
||||
if ( map->nbre == 0 ) {
|
||||
fprintf(stderr, "Save Color Map: empty map\n");
|
||||
}
|
||||
|
||||
for (foo=0; foo<map->nbre; foo++)
|
||||
{
|
||||
for (foo=0; foo<map->nbre; foo++) {
|
||||
fprintf(fp, "%3d %3d %3d",
|
||||
map->red[foo], map->green[foo], map->blue[foo]);
|
||||
switch (foo)
|
||||
{
|
||||
switch (foo) {
|
||||
case 0:
|
||||
if (name != NULL)
|
||||
fprintf(fp, " Name: %s", name);
|
||||
@ -85,20 +81,17 @@ FILE *fp;
|
||||
int nbre, r, g, b, foo, errcode;
|
||||
char buffer[256];
|
||||
|
||||
if ( name != NULL )
|
||||
{
|
||||
if (strlen(name)>IMG_OBJNAME_LEN)
|
||||
return STRING_TOO_LONG;
|
||||
if ( name != NULL ) {
|
||||
if (strlen(name)>IMG_OBJNAME_LEN) return STRING_TOO_LONG;
|
||||
strcpy(where->name, name);
|
||||
}
|
||||
else strcpy(where->name, "no name");
|
||||
|
||||
/*
|
||||
* patch du 11 Décembre 2001: on utilise une fonction qui recherche le
|
||||
* fichier dans differents endroits. Cf 'musopen.c' pour + de détails.
|
||||
* fichier dans differents endroits. Cf 'mustopen.c' pour + de détails.
|
||||
*/
|
||||
if ((fp=Image_must_fopen(file, "r", 0)) == NULL)
|
||||
{
|
||||
if ((fp=Image_must_fopen(file, "r", 0)) == NULL) {
|
||||
/* safety poke */
|
||||
where->nbre = 0;
|
||||
fprintf(stderr, "Load color MAP: %s not found\n", file);
|
||||
@ -108,11 +101,9 @@ if ((fp=Image_must_fopen(file, "r", 0)) == NULL)
|
||||
nbre = 0; errcode = 0;
|
||||
where->nbre = 0; /* kill bad value */
|
||||
|
||||
while ( fgets(buffer, 250, fp) != NULL )
|
||||
{
|
||||
while ( fgets(buffer, 250, fp) != NULL ) {
|
||||
foo = sscanf(buffer, "%d %d %d", &r, &g, &b);
|
||||
if (foo != 3)
|
||||
{
|
||||
if (foo != 3) {
|
||||
fprintf(stderr, "line %d: [%s]\n", nbre, buffer);
|
||||
errcode = BAD_COLOR_NUMBER; break;
|
||||
}
|
||||
@ -120,8 +111,7 @@ while ( fgets(buffer, 250, fp) != NULL )
|
||||
where->green[nbre] = g;
|
||||
where->blue[nbre] = b;
|
||||
nbre++;
|
||||
if (nbre > 256)
|
||||
{
|
||||
if (nbre > 256) {
|
||||
fprintf(stderr, "load color map: nbre = %d\n", nbre);
|
||||
errcode = MAP_TOO_BIG; break;
|
||||
}
|
||||
@ -146,8 +136,7 @@ int foo;
|
||||
|
||||
fprintf(stderr, "Image attach Map: cette fonction n'est pas finie\n");
|
||||
foo = Image_load_color_Map(nom_map, "", &map);
|
||||
if (foo == 0)
|
||||
{
|
||||
if (foo == 0) {
|
||||
fprintf(stderr, "Attach Map: foo is zero ?\n");
|
||||
}
|
||||
|
||||
@ -163,15 +152,13 @@ int foo;
|
||||
|
||||
fprintf(stderr, "making a random map named '%s'\n", nom);
|
||||
|
||||
if (nbre < 0 || nbre > 255)
|
||||
{
|
||||
if (nbre < 0 || nbre > 255) {
|
||||
fprintf(stderr, "make random map: nbre = %d\n", map->nbre);
|
||||
return BAD_COLOR_NUMBER;
|
||||
}
|
||||
map->nbre = nbre;
|
||||
|
||||
for (foo=0; foo<nbre; foo++)
|
||||
{
|
||||
for (foo=0; foo<nbre; foo++) {
|
||||
map->red[foo] = rand() & 0xff;
|
||||
map->green[foo] = rand() & 0xff;
|
||||
map->blue[foo] = rand() & 0xff;
|
||||
@ -196,8 +183,7 @@ strcpy(map->name, "* FMBL roulaize *");
|
||||
|
||||
map->nbre = 64;
|
||||
|
||||
for (foo=0; foo<64; foo++)
|
||||
{
|
||||
for (foo=0; foo<64; foo++) {
|
||||
r = ((foo >> 0) & 0x03) * 85;
|
||||
g = ((foo >> 2) & 0x03) * 85;
|
||||
b = ((foo >> 4) & 0x03) * 85;
|
||||
@ -232,8 +218,7 @@ for (foo=0; foo<8; foo++)
|
||||
fprintf(stderr, " %3d %g\n", foo, pars[foo]);
|
||||
#endif
|
||||
|
||||
for (foo=0; foo<256; foo++)
|
||||
{
|
||||
for (foo=0; foo<256; foo++) {
|
||||
dfoo = (double)foo / 255.0 * M_PI * 2;
|
||||
dra = sin((pars[0] * dfoo) + pars[3]);
|
||||
dga = sin((pars[1] * dfoo) + pars[4]);
|
||||
@ -262,27 +247,23 @@ fprintf(stderr, "Image mix palette: work in progress...\n");
|
||||
|
||||
k2 = 10000 - k;
|
||||
|
||||
for (idx=0; idx<256; idx++)
|
||||
{
|
||||
for (idx=0; idx<256; idx++) {
|
||||
if (idx < p1->nbre)
|
||||
{
|
||||
r1 = p1->red[idx];
|
||||
g1 = p1->green[idx];
|
||||
b1 = p1->blue[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r1 = g1 = b1 = 0;
|
||||
}
|
||||
|
||||
if (idx < p2->nbre)
|
||||
{
|
||||
if (idx < p2->nbre) {
|
||||
r2 = p2->red[idx];
|
||||
g2 = p2->green[idx];
|
||||
b2 = p2->blue[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
r2 = g2 = b2 = 0;
|
||||
}
|
||||
|
||||
@ -315,19 +296,16 @@ int foo;
|
||||
int maxval = -99999;
|
||||
#endif
|
||||
|
||||
if (p->nbre < 1 || p->nbre > 256)
|
||||
{
|
||||
if (p->nbre < 1 || p->nbre > 256) {
|
||||
fprintf(stderr, "%s: RGB_map %p has %d entries ?\n",
|
||||
__func__, p, p->nbre);
|
||||
}
|
||||
|
||||
for (foo=0; foo<p->nbre; foo++)
|
||||
{
|
||||
for (foo=0; foo<p->nbre; foo++) {
|
||||
p->red[foo] = round((double)p->red[foo] * v);
|
||||
p->green[foo] = round((double)p->green[foo] * v);
|
||||
p->blue[foo] = round((double)p->blue[foo] * v);
|
||||
if (clip_it)
|
||||
{
|
||||
if (clip_it) {
|
||||
if (p->red[foo] < 0) p->red[foo] = 0;
|
||||
if (p->red[foo] > 255) p->red[foo] = 255;
|
||||
if (p->green[foo] < 0) p->green[foo] = 0;
|
||||
@ -356,19 +334,16 @@ int Image_scale3_palette(RGB_map *p, double rk, double gk, double bk,
|
||||
{
|
||||
int foo;
|
||||
|
||||
if (p->nbre < 1 || p->nbre > 256)
|
||||
{
|
||||
if (p->nbre < 1 || p->nbre > 256) {
|
||||
fprintf(stderr, "%s: RGB_map %p has %d entries ?\n",
|
||||
__func__, p, p->nbre);
|
||||
}
|
||||
|
||||
for (foo=0; foo<p->nbre; foo++)
|
||||
{
|
||||
for (foo=0; foo<p->nbre; foo++) {
|
||||
p->red[foo] = round((double)p->red[foo] * rk);
|
||||
p->green[foo] = round((double)p->green[foo] * gk);
|
||||
p->blue[foo] = round((double)p->blue[foo] * bk);
|
||||
if (clip_it)
|
||||
{
|
||||
if (clip_it) {
|
||||
if (p->red[foo] < 0) p->red[foo] = 0;
|
||||
if (p->red[foo] > 255) p->red[foo] = 255;
|
||||
if (p->green[foo] < 0) p->green[foo] = 0;
|
||||
@ -395,8 +370,7 @@ int foo;
|
||||
fprintf(stderr, "%s (( %p '%s' '%s' ))\n", __func__, p, fname, comment);
|
||||
#endif
|
||||
|
||||
if (NULL==p)
|
||||
{
|
||||
if (NULL == p) {
|
||||
fprintf(stderr, "in %s, can't gruik au nill map\n", __func__);
|
||||
abort();
|
||||
}
|
||||
@ -405,8 +379,7 @@ if (NULL==p)
|
||||
fprintf(stderr, "we have %d colors in palette at %p\n", p->nbre, p);
|
||||
#endif
|
||||
|
||||
if ( (fp=fopen(fname, "w")) == NULL )
|
||||
{
|
||||
if ( (fp=fopen(fname, "w")) == NULL ) {
|
||||
fprintf(stderr, "%s: err fopen %s\n", __func__, fname);
|
||||
return FILE_CREATE_ERR;
|
||||
}
|
||||
@ -414,8 +387,8 @@ fprintf(fp, "P3\n%d 1\n255\n", p->nbre);
|
||||
if (NULL != comment) {
|
||||
fprintf(fp, "# %s\n", comment);
|
||||
}
|
||||
for (foo=0; foo<p->nbre; foo++)
|
||||
{
|
||||
|
||||
for (foo=0; foo<p->nbre; foo++) {
|
||||
fprintf(fp, "%3d %3d %3d\n", p->red[foo], p->green[foo], p->blue[foo]);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ int foo;
|
||||
fprintf(stderr, "Pixeliz X: appel de test, pas finalise.\n");
|
||||
#endif
|
||||
|
||||
foo = Image_pixeliz_0(src, dst, 5, 15);
|
||||
foo = Image_pixeliz_0(src, dst, 5, 16);
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Pixeliz X: valeur obtenue: %d\n", foo);
|
||||
@ -79,12 +79,13 @@ Image_pixeliz_Y(Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "Pixeliz Y: appel de test, pas finalise.\n");
|
||||
#endif
|
||||
|
||||
foo = Image_pixeliz_0(src, dst, 16, 5);
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
foo = Image_pixeliz_0(src, dst, 15, 5);
|
||||
fprintf(stderr, "Pixeliz Y: valeur obtenue: %d\n", foo);
|
||||
#endif
|
||||
|
||||
|
@ -174,7 +174,7 @@ int len1, len2, len, foo;
|
||||
|
||||
len1 = len2 = 0;
|
||||
if (NULL != lig1) len1 = strlen(lig1);
|
||||
if (NULL != lig2) len2 - strlen(lig2);
|
||||
if (NULL != lig2) len2 = strlen(lig2);
|
||||
if (len2 > len1) len = len2;
|
||||
else len = len1;
|
||||
|
||||
@ -364,6 +364,9 @@ int res[8], foo;
|
||||
|
||||
printf(" R G B A\n");
|
||||
foo = Image_minmax_RGB(img, res);
|
||||
if (foo) {
|
||||
fprintf(stderr, "in %s, minmax rgb -> %d\n", __func__, foo);
|
||||
}
|
||||
printf("min %4d %4d %4d %4d\n", res[0], res[2], res[4], res[6]);
|
||||
printf("max %4d %4d %4d %4d\n", res[1], res[3], res[5], res[7]);
|
||||
return OLL_KORRECT;
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
Tester, c'est douter.
|
||||
|
||||
## État des lieux
|
||||
|
||||
Pas grand chose.
|
||||
|
||||
Allez quand même voir `config.sh` et `functions.sh` pour avoir une idée
|
||||
du désastre actuel
|
||||
|
||||
## Mais encore ?
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
SRC="/tmp/src.tga"
|
||||
BW="/tmp/bw.tga"
|
||||
source ./config.sh
|
||||
|
||||
DST="foo.tga"
|
||||
|
||||
|
8
Tests/config.sh
Normal file
8
Tests/config.sh
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
SRC="/tmp/src.tga"
|
||||
BW="/tmp/bw.tga"
|
||||
GIF89A="flashy.gif"
|
||||
|
||||
# find the last version of tga_*
|
||||
COMDIR="../Tools"
|
43
Tests/functions.sh
Normal file
43
Tests/functions.sh
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
test_des_xpers ()
|
||||
{
|
||||
command=$1
|
||||
echo ; echo " Test du xper $command"
|
||||
|
||||
# generation d'une image sur laquelle travailler
|
||||
$COMDIR/tga_mires mircol0 $SRC "hard xper '$command'"
|
||||
|
||||
|
||||
case $command in
|
||||
zero)
|
||||
$COMDIR/tga_effects $SRC x0 $DST 64 128 192
|
||||
;;
|
||||
un)
|
||||
$COMDIR/tga_effects $SRC x1 $DST 64 128 192
|
||||
;;
|
||||
deux)
|
||||
$COMDIR/tga_effects $SRC x2 $DST 64 128 192
|
||||
;;
|
||||
trois)
|
||||
$COMDIR/tga_effects $SRC x3 $DST 42 R1 "rg"
|
||||
;;
|
||||
quatre)
|
||||
$COMDIR/tga_effects $SRC x4 $DST 27
|
||||
;;
|
||||
cinq)
|
||||
$COMDIR/tga_effects $SRC x5 $DST 64 128 192
|
||||
;;
|
||||
*)
|
||||
echo "==== ERROR ON $command ===="
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
gif89a=$(printf "flashy_%s.gif" $command)
|
||||
|
||||
convert -delay 80 $SRC $DST $gif89a
|
||||
}
|
||||
# ---------------------------------------------------------------
|
||||
# ---------------------------------------------------------------
|
||||
|
17
Tests/xper.sh
Executable file
17
Tests/xper.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./config.sh
|
||||
source ./functions.sh
|
||||
|
||||
DST="foo.tga"
|
||||
|
||||
$COMDIR/tga_tools version
|
||||
|
||||
|
||||
test_des_xpers "zero"
|
||||
test_des_xpers "un"
|
||||
test_des_xpers "deux"
|
||||
test_des_xpers "trois"
|
||||
test_des_xpers "quatre"
|
||||
test_des_xpers "cinq"
|
||||
|
@ -132,11 +132,9 @@ switch (commande)
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
if (foo)
|
||||
fprintf(stderr, "dither %d retour = %d, %s\n", commande,
|
||||
foo, Image_err2str(foo));
|
||||
#endif
|
||||
|
||||
foo = Image_TGA_save(argv[3], dst, 0);
|
||||
|
||||
|
@ -437,12 +437,16 @@ switch (commande)
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s: return code is %d\n", __FILE__, foo);
|
||||
puts(""); /* make a nicer display in debug mode */
|
||||
#endif
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: return code is %d\n", __FILE__, foo);
|
||||
Image_print_error(argv[0], foo);
|
||||
}
|
||||
|
||||
foo = Image_TGA_save(argv[3], dst, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: error %d saving '%s'\n", __FILE__, foo, argv[3]);
|
||||
Image_print_error(argv[0], foo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
#define TGA_OUTILS_VERSION "0.60"
|
||||
#define TGA_OUTILS_VERSION "0.61"
|
||||
/*
|
||||
* 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
|
||||
* 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
|
||||
@ -21,7 +21,7 @@
|
||||
* 27 Jan 2014: V0.52 added : 'parse_rect_param'.
|
||||
*/
|
||||
|
||||
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2018"
|
||||
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2022"
|
||||
#define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/"
|
||||
|
||||
#define PERR(txt) fprintf(stderr, "\t| %s\n", (txt))
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define TIMESTAMP 34
|
||||
#define PRHISTO 35
|
||||
#define TAG7SEG0 40
|
||||
|
||||
#define BIZARRE 41
|
||||
#define ENVIRON 50
|
||||
/*::------------------------------------------------------------------::*/
|
||||
mot_clef commandes[] =
|
||||
@ -47,6 +47,7 @@ mot_clef commandes[] =
|
||||
{ "prhisto", PRHISTO, "s", "filename.tga" },
|
||||
{ "tag7", TAG7SEG0, "si", "fname.tga nnn" },
|
||||
{ "environ", ENVIRON, "", "" },
|
||||
{ "bizarre", BIZARRE, "", "portnawak..." },
|
||||
{ "mk_rgb", MK_RGB, "siiiii", "fname w h r g b" },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
@ -66,31 +67,28 @@ if (foo)
|
||||
{
|
||||
fprintf(stderr, "something is bad with %s : %d\n", filename, foo);
|
||||
Image_print_error("explanation", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = 0;
|
||||
switch(flags)
|
||||
{
|
||||
case 0:
|
||||
printf("%8d %8d\n", width, height);
|
||||
break;
|
||||
printf("%8d %8d\n", width, height); break;
|
||||
case 1:
|
||||
printf("%dx%d\n", width, height);
|
||||
break;
|
||||
printf("%dx%d\n", width, height); break;
|
||||
case 2:
|
||||
printf(" -w%d -h%d\n", width, height);
|
||||
break;
|
||||
printf(" -w%d -h%d\n", width, height); break;
|
||||
case 3:
|
||||
printf("width=%d height=%d\n", width, height);
|
||||
break;
|
||||
printf("width=%d height=%d\n", width, height); break;
|
||||
case 4:
|
||||
printf("%d\n", width);
|
||||
break;
|
||||
printf("%d\n", width); break;
|
||||
case 5:
|
||||
printf("%d\n", height);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "bad flag %d in %s\n", flags, __func__);
|
||||
abort();
|
||||
foo = BAD_PARAMETER;
|
||||
break; /* unreached ? */
|
||||
}
|
||||
return foo;
|
||||
@ -104,7 +102,7 @@ int foo;
|
||||
fprintf(stderr, "Show Header '%s' %d\n", filename, flag);
|
||||
#endif
|
||||
|
||||
foo = Image_TGA_show_header(filename, 0);
|
||||
foo = Image_TGA_show_header(filename, flag);
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s got %d\n", __func__, foo);
|
||||
@ -240,13 +238,13 @@ char *noms[] =
|
||||
"FIXED_SEED", ENV_DEFAULT_RGBA
|
||||
};
|
||||
|
||||
for (foo=0; foo<(sizeof(noms)/sizeof(char *)); foo++)
|
||||
for (foo=0; foo<(int)(sizeof(noms)/sizeof(char *)); foo++)
|
||||
{
|
||||
ptr = getenv(noms[foo]);
|
||||
printf("%5d %-25s %s\n", foo, noms[foo], ptr);
|
||||
}
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
return OLL_KORRECT; /* ? seriously ? */
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int tag_7_segments_0(char *fname, int value)
|
||||
@ -271,6 +269,10 @@ foo = Image_7seg_tag0(src, buffer, 0);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : tagging %s -> %d\n", __func__, fname, foo);
|
||||
#endif
|
||||
if (foo) {
|
||||
fprintf(stderr, "ERR %d IN %s\n", foo, __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
foo = Image_TGA_save(fname, src, 0);
|
||||
#if DEBUG_LEVEL > 1
|
||||
@ -280,6 +282,20 @@ fprintf(stderr, "%s : saving %s -> %d\n", __func__, fname, foo);
|
||||
return -1;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int bizarre(char *fname, int notused)
|
||||
{
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, fname, notused);
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "in %s notused must be zero, was %d\n",
|
||||
__func__, notused);
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
|
||||
return OLL_KORRECT;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int foo;
|
||||
@ -397,8 +413,13 @@ switch(mode)
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Hu ho %d ?\n", mode);
|
||||
foo = FULL_NUCKED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** at end of %s, foo was %d\n", __func__, foo);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
http:///la.buvette.org/devel/libimage/
|
||||
*/
|
||||
#ifndef IMAGE_VERSION_STRING
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 16"
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 18"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user