cosmetic
This commit is contained in:
parent
63b0bce081
commit
ca9947e7cc
@ -7,8 +7,9 @@
|
||||
Et c,a va me forcer a installer libpng
|
||||
--------------------------------------
|
||||
15May01: on attend toujours libPNG
|
||||
07Dec01: pfeue, libPNG toujours pas là...
|
||||
07Dec01: pfeue, libPNG toujours pas la...
|
||||
03Fev14: ... please wait more ...
|
||||
04Oct22: on the way, stay tuned.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -2,17 +2,17 @@
|
||||
BASIC_IO Sept 2001
|
||||
-------- ---------
|
||||
|
||||
Ce module a été écrit pour tenter de régler les
|
||||
problèmes de "boutisme" pour que ça puisse aussi
|
||||
Ce module a ete ecrit pour tenter de regler les
|
||||
problemes de "boutisme" pour que c,a puisse aussi
|
||||
tourner sur les vrais processeurs, parce que, bon,
|
||||
les 386, ça suffit, hein...
|
||||
les 386, parfois, on s'en gave, hein...
|
||||
|
||||
Ceci dit, je ne sais pas vraiment comment traiter
|
||||
le problème. Pour le moment (Septembre 2001) c'est
|
||||
le probleme. Pour le moment (Septembre 2001) c'est
|
||||
un peu beaucoup du "try and test".
|
||||
|
||||
D'autre part, comment ça va se passer sur des CPUs
|
||||
à 64 (ou 128) bits ?
|
||||
D'autre part, comment les choses vont se passer sur
|
||||
des CPUs a 64 (ou 128) bits ?
|
||||
-------------------------------------------------
|
||||
|
||||
9 oct 2001: pourquoi pas de fonction pour ecrire des BYTEs ?
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_col4bits_and(Image_Desc *src, Image_Desc *dst)
|
||||
int Image_col4bits_and(Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int foo;
|
||||
|
||||
@ -69,8 +68,7 @@ return ( (r1+g1+b1) - (r2+g2+b2) );
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
||||
#define TAILLE (1<<12)
|
||||
int
|
||||
Image_calc_Map_4bits(Image_Desc *img, RGB_map *map, int nbre)
|
||||
int Image_calc_Map_4bits(Image_Desc *img, RGB_map *map, int nbre)
|
||||
{
|
||||
long surface, maxi;
|
||||
int x, y, r, g, b, idx;
|
||||
@ -81,8 +79,7 @@ struct elem elems[TAILLE];
|
||||
fprintf(stderr, " Calc map 4 bits: nbre = %d\n", nbre);
|
||||
#endif
|
||||
|
||||
if ( (nbre<1) || (nbre>255) )
|
||||
{
|
||||
if ( (nbre<1) || (nbre>255) ) {
|
||||
fprintf(stderr, "Calc map 4 bits: nbre %d out of range\n", nbre);
|
||||
return BAD_COLOR_NUMBER;
|
||||
}
|
||||
@ -92,24 +89,20 @@ surface = img->width * img->height;
|
||||
fprintf(stderr, " calc Map 4 bits: surface de l'image = %ld pixels\n", surface);
|
||||
#endif
|
||||
|
||||
for (x=0; x<TAILLE; x++)
|
||||
{
|
||||
for (x=0; x<TAILLE; x++) {
|
||||
elems[x].compte = 0L;
|
||||
elems[x].rgb = x;
|
||||
}
|
||||
|
||||
maxi = 0L;
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (x=0; x<img->width; x++) {
|
||||
for (y=0; y<img->height; y++) {
|
||||
r = (img->Rpix[y])[x] >> 4;
|
||||
g = (img->Gpix[y])[x] >> 4;
|
||||
b = (img->Bpix[y])[x] >> 4;
|
||||
idx = (r<<8) | (g<<4) | b;
|
||||
|
||||
if (idx >= TAILLE)
|
||||
{
|
||||
if (idx >= TAILLE) {
|
||||
fprintf(stderr, "FATAL ERROR in %s\n", __func__);
|
||||
exit(5);
|
||||
}
|
||||
@ -130,16 +123,14 @@ qsort(elems, TAILLE, sizeof(struct elem), compare_compteur);
|
||||
|
||||
/*
|
||||
* trier la palette, certe, mais dans quel ordre ?
|
||||
*
|
||||
* 28 Jan 2002: why ?
|
||||
* 28 Jan 2002: why ?
|
||||
*/
|
||||
qsort(elems, nbre, sizeof(struct elem), compare_teinte);
|
||||
|
||||
/*
|
||||
* recopier les 'nbre' entrees hautes dans la palette
|
||||
*/
|
||||
for(x=0; x<nbre; x++)
|
||||
{
|
||||
for(x=0; x<nbre; x++) {
|
||||
y = elems[x].rgb;
|
||||
|
||||
r = ((y>>8)&0xf)<<4;
|
||||
|
@ -19,8 +19,7 @@
|
||||
/*
|
||||
* the easy one.
|
||||
*/
|
||||
int
|
||||
Image_paint_A_rect(Image_Desc *img, Image_Rect *rect, RGBA *rgba)
|
||||
int Image_paint_A_rect(Image_Desc *img, Image_Rect *rect, RGBA *rgba)
|
||||
{
|
||||
int xd, yd, xf, yf, x, y;
|
||||
int r, g, b, a0, a1, nbre;
|
||||
@ -42,10 +41,8 @@ a1 = rgba->a;
|
||||
|
||||
nbre = 0;
|
||||
|
||||
for (x=xd; x<xf; x++)
|
||||
{
|
||||
for (y=yd; y<yf; y++)
|
||||
{
|
||||
for (x=xd; x<xf; x++) {
|
||||
for (y=yd; y<yf; y++) {
|
||||
Image_getRGB(img, x, y, &r, &g, &b);
|
||||
/*
|
||||
* ok, compute now...
|
||||
@ -58,18 +55,15 @@ for (x=xd; x<xf; x++)
|
||||
}
|
||||
}
|
||||
|
||||
/* fprintf(stderr, "%d points traités\n", nbre); */
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* new 15 Janvier 2003.
|
||||
* première utilisation: l'écriture des titres des
|
||||
* premiere utilisation: l'ecriture des titres des
|
||||
* image de l'expovsition.
|
||||
*/
|
||||
int
|
||||
Image_fade_A_rect(Image_Desc *img, Image_Rect *rect, int alpha)
|
||||
int Image_fade_A_rect(Image_Desc *img, Image_Rect *rect, int alpha)
|
||||
{
|
||||
int xd, yd, xf, yf, x, y;
|
||||
int r, g, b ;
|
||||
@ -85,10 +79,8 @@ fprintf(stderr, "Fade Alpha Rect: %d < X < %d %d < Y < %d\n",
|
||||
fprintf(stderr, " coefficient alpha = %d\n", alpha);
|
||||
#endif
|
||||
|
||||
for (x=xd; x<xf; x++)
|
||||
{
|
||||
for (y=yd; y<yf; y++)
|
||||
{
|
||||
for (x=xd; x<xf; x++) {
|
||||
for (y=yd; y<yf; y++) {
|
||||
Image_getRGB(img, x, y, &r, &g, &b);
|
||||
/*
|
||||
* ok, compute now...
|
||||
@ -108,34 +100,29 @@ return FUNC_IS_BETA; /* need unit testing */
|
||||
* bon, une fonction pour tamponner une image quelconque avec une
|
||||
* image alpha, il serait temps de la mettre en place, nom ?
|
||||
*/
|
||||
int
|
||||
Image_tampon_alpha_0(Image_Desc *src, Image_Desc *tampon, Image_Desc *dst)
|
||||
int Image_tampon_alpha_0(Image_Desc *src, Image_Desc *tampon, Image_Desc *dst)
|
||||
{
|
||||
int x, y, rs, gs, bs, rt, gt, bt;
|
||||
int rd, gd, bd, clean_tampon;
|
||||
|
||||
clean_tampon = 0;
|
||||
/* if the 'tampon' is not defined, we have to imagine one */
|
||||
if (NULL==tampon)
|
||||
{
|
||||
if (NULL==tampon) {
|
||||
tampon = Image_clone(src, 0);
|
||||
fprintf(stderr, "fake tampon @ %p\n", tampon);
|
||||
Image_mirror(src, tampon, 0);
|
||||
clean_tampon = 1;
|
||||
}
|
||||
|
||||
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++) {
|
||||
Image_getRGB(src, x, y, &rs, &gs, &bs);
|
||||
Image_getRGB(tampon, x, y, &rt, >, &bt);
|
||||
rd = (rs * rt) / 256;
|
||||
}
|
||||
}
|
||||
|
||||
if (clean_tampon)
|
||||
{
|
||||
if (clean_tampon) {
|
||||
fprintf(stderr, "clean %p in %s\n", tampon, __func__);
|
||||
Image_DeAllocate(tampon); free(tampon);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ Image_plotRGB(i, x+xc, y+yc, 100, 100, 100);
|
||||
fprintf(stderr, "sym %d %d\n", x, y);
|
||||
}
|
||||
|
||||
/* le paramètre 'wrap' ne sert à rien */
|
||||
/* le parametre 'wrap' ne sert a rien */
|
||||
int Image_draw_circle(Image_Desc *i, int xc, int yc, int rayon, RGBA *q, int wrap)
|
||||
{
|
||||
int x, y, d;
|
||||
@ -111,7 +111,7 @@ return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* XXX si je veux remplacer 'plotRGB' par un accès direct
|
||||
* XXX si je veux remplacer 'plotRGB' par un acces direct
|
||||
* XXX dans les buffers, il faut soigner les controles
|
||||
*/
|
||||
int Image_paint_rect(Image_Desc *img, Image_Rect *rect, int r, int g, int b)
|
||||
@ -128,10 +128,10 @@ yd = max(0, rect->y);
|
||||
xf = min((img->width), (rect->x+rect->w));
|
||||
yf = min((img->height), (rect->y+rect->h));
|
||||
/*
|
||||
* 24 Juin 2002: est-ce que le code ci-dessus a été sérieusement validé ?
|
||||
* 24 Juin 2002: est-ce que le code ci-dessus est vraiment valide ?
|
||||
* 24 Avril 2008: NON !
|
||||
* 26 janvier 2014 : toujours non...
|
||||
* 19 septembre 2022 : je n'ai pas de certitude à ce sujet
|
||||
* 19 septembre 2022 : je n'ai pas de certitude a ce sujet
|
||||
*/
|
||||
|
||||
#if DEBUG_LEVEL > 2
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
+---------------------------------------+
|
||||
| Effets speciaux sur les images |
|
||||
| troisième module |
|
||||
| troisieme module |
|
||||
+---------------------------------------+
|
||||
Thierry Boudet <oulala@chez.com>
|
||||
*/
|
||||
@ -70,8 +70,7 @@ return FUNC_IS_BETA;
|
||||
/*
|
||||
* 3 avril 2007: je me rend compte que les parametres ne servent a rien.
|
||||
*/
|
||||
int
|
||||
Image_effect_x_1(Image_Desc *src, Image_Desc *dst)
|
||||
int Image_effect_x_1(Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int foo, x, y, r, g, b;
|
||||
|
||||
@ -86,7 +85,7 @@ for (y=0; y<dst->height; y++) {
|
||||
g = src->Gpix[y][x];
|
||||
b = src->Bpix[y][x];
|
||||
|
||||
/* 2 fevrier 2003: je fait du n'importe quoi, là... */
|
||||
/* 2 fevrier 2003: je fait du n'importe quoi, la... */
|
||||
dst->Rpix[y][x] = g^b;
|
||||
dst->Gpix[y][x] = r^b;
|
||||
dst->Bpix[y][x] = r^g;
|
||||
@ -97,11 +96,10 @@ return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* 1er Février 2003: encore une autre expérimentation, qui va être
|
||||
* basée sur la trigonométrie.
|
||||
* 1er Fevrier 2003: encore une autre experimentation, qui va etre
|
||||
* basee sur la trigonometrie.
|
||||
*/
|
||||
int
|
||||
Image_effect_x_2(Image_Desc *src, Image_Desc *dst, int kx, int ky, int kv)
|
||||
int Image_effect_x_2(Image_Desc *src, Image_Desc *dst, int kx, int ky, int kv)
|
||||
{
|
||||
int foo, x, y, r, g, b;
|
||||
double dr, dg, db, ar, ag, ab;
|
||||
@ -135,7 +133,7 @@ for (y=0; y<dst->height; y++) {
|
||||
ab = atan2(dr, dg);
|
||||
|
||||
/*
|
||||
* et là, il y a des soucis d'echelle :)
|
||||
* et la il y a des soucis d'echelle :)
|
||||
* 15 mars 2005: pourquoi 156 ? (XXX)
|
||||
*/
|
||||
r = (int)(ar * 156.0);
|
||||
@ -154,14 +152,13 @@ return FUNC_IS_BETA;
|
||||
/*
|
||||
* 30 Jan 2003: hop, j'improvise pendant que les patates cuisent :)
|
||||
* 4 Fev 2003: et je peaufine pendant que le poulet mijote :)
|
||||
* 27 Oct 2003: je debugge pendant que le thé infuse :)
|
||||
* 27 Oct 2003: je debugge pendant que le the 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 :)
|
||||
* 19 aout 2022: je comprend pas ce que c'est cense faire :)
|
||||
*
|
||||
*/
|
||||
int
|
||||
Image_effect_x_3(Image_Desc *src, Image_Desc *dst, int kx, int ky, char *comp)
|
||||
int Image_effect_x_3(Image_Desc *src, Image_Desc *dst, int kx, int ky, char *comp)
|
||||
{
|
||||
int foo, sx, sy;
|
||||
int x, y, r, g, b;
|
||||
@ -171,15 +168,13 @@ int cx, cy, dx, dy;
|
||||
fprintf(stderr, "%s : kx %d ky %d comp '%s'\n", __func__, kx, ky, comp);
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if (strlen(comp) != 2)
|
||||
{
|
||||
fprintf(stderr, "eff x3: bad comp parameter '%s'\n", comp);
|
||||
if (strlen(comp) != 2) {
|
||||
fprintf(stderr, "%s: bad comp parameter '%s'\n", __func__, comp);
|
||||
fprintf(stderr, " must be a 2 chars string, from 'rgb'\n");
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
@ -193,25 +188,22 @@ sx = sy = 0;
|
||||
|
||||
/*
|
||||
* ici il faudrait une validation des deux lettres, mais j'ai la
|
||||
* flemme d'écrire ça maintenant. je vais plutôt aller boofer.
|
||||
* flemme d'ecrire ce genre de chos maintenant.
|
||||
* Je vais plutot aller boofer.
|
||||
*/
|
||||
|
||||
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++) {
|
||||
r = src->Rpix[y][x];
|
||||
g = src->Gpix[y][x];
|
||||
b = src->Bpix[y][x];
|
||||
|
||||
switch(cx)
|
||||
{
|
||||
switch(cx) {
|
||||
case 'r': dx = r; break;
|
||||
case 'g': dx = g; break;
|
||||
case 'b': dx = b; break;
|
||||
}
|
||||
switch(cy)
|
||||
{
|
||||
switch(cy) {
|
||||
case 'r': dy = r; break;
|
||||
case 'g': dy = g; break;
|
||||
case 'b': dy = b; break;
|
||||
@ -221,15 +213,13 @@ for (y=0; y<dst->height; y++)
|
||||
sy = y + ((ky * (dy-128)) / 100);
|
||||
|
||||
if ( sx >= 0 && sx < dst->width &&
|
||||
sy >= 0 && sy < dst->height )
|
||||
{
|
||||
sy >= 0 && sy < dst->height ) {
|
||||
r = src->Rpix[sy][sx];
|
||||
g = src->Gpix[sy][sx];
|
||||
b = src->Bpix[sy][sx];
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
Image_plotRGB(dst, x, y, r, r, r);
|
||||
}
|
||||
/*
|
||||
@ -285,8 +275,7 @@ return FUNC_IS_BETA;
|
||||
* 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)
|
||||
int Image_effect_x_5(Image_Desc *src, Image_Desc *dst, int kx, int ky, int kz)
|
||||
{
|
||||
int foo, sx, sy;
|
||||
int x, y, r, g, b;
|
||||
|
69
Lib/morpho.c
69
Lib/morpho.c
@ -12,14 +12,14 @@ static struct
|
||||
int x, y;
|
||||
} deltas[] =
|
||||
{ { -1, -1, },
|
||||
{ 0, -1, },
|
||||
{ 1, -1, },
|
||||
{ -1, 0, },
|
||||
{ 0, 0, },
|
||||
{ 1, 0, },
|
||||
{ -1, 1, },
|
||||
{ 0, 1, },
|
||||
{ 1, 1 }
|
||||
{ 0, -1, },
|
||||
{ 1, -1, },
|
||||
{ -1, 0, },
|
||||
{ 0, 0, },
|
||||
{ 1, 0, },
|
||||
{ -1, 1, },
|
||||
{ 0, 1, },
|
||||
{ 1, 1 }
|
||||
};
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
@ -27,33 +27,24 @@ static struct
|
||||
* =============================
|
||||
* 23 avril 2007: switched to direct pixel access.
|
||||
*/
|
||||
int
|
||||
Image_expand_max(Image_Desc *src, Image_Desc *dst, int factor)
|
||||
int Image_expand_max(Image_Desc *src, Image_Desc *dst, int factor)
|
||||
{
|
||||
int foo, x, y, maxr, maxg, maxb;
|
||||
int r, g, b;
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "%s: images non compatibles\n", __func__);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if ( 0 != factor )
|
||||
{
|
||||
if ( 0 != factor ) {
|
||||
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "expanding MAX %p to %p\n", src, dst);
|
||||
#endif
|
||||
|
||||
for (y=1; y<src->height-1; y++)
|
||||
{
|
||||
for (x=1; x<src->width-1; x++)
|
||||
{
|
||||
for (y=1; y<src->height-1; y++) {
|
||||
for (x=1; x<src->width-1; x++) {
|
||||
maxr = maxg = maxb = 0;
|
||||
for (foo=0; foo<9; foo++)
|
||||
{
|
||||
for (foo=0; foo<9; foo++) {
|
||||
/* XXX Faster pussy cat !
|
||||
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||
&r, &g, &b);
|
||||
@ -78,19 +69,16 @@ dst->modified = 1;
|
||||
return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_expand_min(Image_Desc *src, Image_Desc *dst, int factor)
|
||||
int Image_expand_min(Image_Desc *src, Image_Desc *dst, int factor)
|
||||
{
|
||||
int foo, x, y, minr, ming, minb;
|
||||
int r, g, b;
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
if ( 0 != factor )
|
||||
{
|
||||
if ( 0 != factor ) {
|
||||
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
||||
}
|
||||
|
||||
@ -98,13 +86,10 @@ if ( 0 != factor )
|
||||
fprintf(stderr, "expanding MIN %p to %p\n", src, dst);
|
||||
#endif
|
||||
|
||||
for (y=1; y<src->height-1; y++)
|
||||
{
|
||||
for (x=1; x<src->width-1; x++)
|
||||
{
|
||||
for (y=1; y<src->height-1; y++) {
|
||||
for (x=1; x<src->width-1; x++) {
|
||||
minr = ming = minb = 1664;
|
||||
for (foo=0; foo<9; foo++)
|
||||
{
|
||||
for (foo=0; foo<9; foo++) {
|
||||
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||
&r, &g, &b);
|
||||
|
||||
@ -133,8 +118,7 @@ Image_sortmat_display(FILE *ou, struct sort_pixel *table)
|
||||
fprintf(ou, "%s ( %p )\n", __func__, table);
|
||||
}
|
||||
|
||||
int
|
||||
Image_Gray_Sorted_Points(Image_Desc *src, Image_Desc *dst, int *filtre)
|
||||
int Image_Gray_Sorted_Points(Image_Desc *src, Image_Desc *dst, int *filtre)
|
||||
{
|
||||
int x, y, r, g, b;
|
||||
int foo, gris;
|
||||
@ -145,13 +129,10 @@ struct sort_pixel pixels[9];
|
||||
fprintf(stderr, "Image Gray Sorted Points: %p -> %p\n", src, dst);
|
||||
#endif
|
||||
|
||||
for (y=1; y<src->height-1; y++)
|
||||
{
|
||||
for (x=1; x<src->width-1; x++)
|
||||
{
|
||||
for (y=1; y<src->height-1; y++) {
|
||||
for (x=1; x<src->width-1; x++) {
|
||||
/* collecte des infos sur les voisins. */
|
||||
for (foo=0; foo<9; foo++)
|
||||
{
|
||||
for (foo=0; foo<9; foo++) {
|
||||
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||
&r, &g, &b);
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
25 Aout 1999: certaines fonctions utilisent 'alloca'.
|
||||
|
||||
4 Fevrier 2001: je me rend compte que certaines interfaces sont trop
|
||||
simplistes, et que définir des structures contenant de multiples
|
||||
paramètres ne serait peut-être pas une mauvaise idée...
|
||||
simplistes, et que definir des structures contenant de multiples
|
||||
parametres ne serait peut-etre pas une mauvaise idee...
|
||||
|
||||
16 Oct 2001: je deplace quelques fonctions dans d'autres modules.
|
||||
|
||||
@ -132,7 +132,7 @@ return FUNC_IS_BETA;
|
||||
}
|
||||
/*
|
||||
* p'taing, c'est tellement crade qu'il faut:
|
||||
* 1) retrouver d'ou ça vient
|
||||
* 1) retrouver d'ou c,a vient
|
||||
* 2) la virer illico !...
|
||||
*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
110
Lib/plotteur.c
110
Lib/plotteur.c
@ -13,7 +13,7 @@
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
#define SOMBRE 26 /* pourquoi ces valeurs sont codées en */
|
||||
#define SOMBRE 26 /* pourquoi ces valeurs sont codees en */
|
||||
#define CLAIR 242 /* dur ? et ~/.tth/libimagerc alors ? */
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
@ -30,18 +30,16 @@ for (foo=bas; foo<=haut; foo++)
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 20 mars 2002
|
||||
*/
|
||||
int
|
||||
Image_plot_luts(char *nomtga, int *lr, int *lg, int *lb, char *texte)
|
||||
int Image_plot_luts(char *nomtga, int *lr, int *lg, int *lb, char *texte)
|
||||
{
|
||||
Image_Desc *img;
|
||||
int foo;
|
||||
RGBA paper, ink;
|
||||
int vr, vg, vb, ovr, ovg, ovb;
|
||||
|
||||
if ( (img = Image_alloc(400, 300, 3)) == NULL )
|
||||
{
|
||||
if ( (img = Image_alloc(400, 300, 3)) == NULL ) {
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Plot Luts: alloc of img failed, file=%s\n", nomtga);
|
||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, nomtga);
|
||||
#endif
|
||||
return IMAGE_NO_MEM;
|
||||
}
|
||||
@ -138,13 +136,13 @@ fprintf(stderr, "taille txt %d\n", strlen(txt));
|
||||
|
||||
Image_trace_chaine_1(img, txt, 5, 5, "libimage.fonte", &paper, &ink);
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "[%s] tracée...\n", txt);
|
||||
fprintf(stderr, "[%s] drawed...\n", txt);
|
||||
#endif
|
||||
|
||||
sprintf(chaine, "max rgb = %ld", maxhisto);
|
||||
Image_trace_chaine_1(img, chaine, 5, 15, NULL, &paper, &ink);
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "[%s] tracée...\n", chaine);
|
||||
fprintf(stderr, "[%s] drawed...\n", chaine);
|
||||
#endif
|
||||
|
||||
Image_cadre_A(img);
|
||||
@ -177,8 +175,7 @@ return FUNC_IS_BETA;
|
||||
* fabrique dans une image une petite bande a partir d'une palette
|
||||
* cette bande est horizontale.
|
||||
*/
|
||||
int
|
||||
Image_plot_h_Map(Image_Desc *img, RGB_map *map, int xpos, int ypos, int h)
|
||||
int Image_plot_h_Map(Image_Desc *img, RGB_map *map, int xpos, int ypos, int h)
|
||||
{
|
||||
int x, y, v;
|
||||
|
||||
@ -212,15 +209,12 @@ return FUNC_IS_BETA;
|
||||
* fabrique dans une image une petite bande a partir d'une palette
|
||||
* cette bande est verticale.
|
||||
*/
|
||||
int
|
||||
Image_plot_v_Map(Image_Desc *img, RGB_map *map, int xpos, int ypos, int l)
|
||||
int Image_plot_v_Map(Image_Desc *img, RGB_map *map, int xpos, int ypos, int l)
|
||||
{
|
||||
int x, y, v;
|
||||
|
||||
for (y=0; y<256; y++)
|
||||
{
|
||||
for (x=0; x<l; x++)
|
||||
{
|
||||
for (y=0; y<256; y++) {
|
||||
for (x=0; x<l; x++) {
|
||||
if ( ((y>>2)+(x>>2)) & 1) v = SOMBRE;
|
||||
else v = CLAIR;
|
||||
Image_plotRGB(img, x+xpos, y+ypos, v, v, v);
|
||||
@ -247,8 +241,7 @@ return FUNC_IS_BETA;
|
||||
* fabrique une petite TGA horizontale avec une palette dedans
|
||||
*/
|
||||
#define LITTLE_DIM 42
|
||||
int
|
||||
Image_plot_little_h_Map(char *nom, RGB_map *map, char *texte)
|
||||
int Image_plot_little_h_Map(char *nom, RGB_map *map, char *texte)
|
||||
{
|
||||
Image_Desc *img;
|
||||
int foo;
|
||||
@ -276,11 +269,10 @@ return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* 20 Février 2002.
|
||||
* 20 Fevrier 2002.
|
||||
* fabrique une petite TGA verticale avec une palette dedans
|
||||
*/
|
||||
int
|
||||
Image_plot_little_v_Map(char *nom, RGB_map *map, char *texte)
|
||||
int Image_plot_little_v_Map(char *nom, RGB_map *map, char *texte)
|
||||
{
|
||||
Image_Desc *img;
|
||||
int foo;
|
||||
@ -306,8 +298,7 @@ return FUNC_IS_BETA;
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 2 decembre 2009 - ave St Exupery
|
||||
*/
|
||||
int
|
||||
Image_plot_square_Map(char *fname, RGB_map *map, char *texte, int k)
|
||||
int Image_plot_square_Map(char *fname, RGB_map *map, char *texte, int k)
|
||||
{
|
||||
int x, y, foo;
|
||||
int r, g, b;
|
||||
@ -320,10 +311,9 @@ fprintf(stderr, "%s ( '%s' %p '%s' %d )\n", __func__,
|
||||
fname, map, texte, k);
|
||||
#endif
|
||||
|
||||
if ( (img = Image_alloc(512, 512, 3)) == NULL )
|
||||
{
|
||||
if ( (img = Image_alloc(512, 512, 3)) == NULL ) {
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Plot MAP: alloc of img failed, file=%s\n", fname);
|
||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, fname);
|
||||
#endif
|
||||
return IMAGE_NO_MEM;
|
||||
}
|
||||
@ -332,8 +322,7 @@ Image_clear(img, 0, 0, 0);
|
||||
|
||||
rect.h = rect.w = 31;
|
||||
|
||||
for (foo=0; foo<256; foo++)
|
||||
{
|
||||
for (foo=0; foo<256; foo++) {
|
||||
x = ( foo & 0x0f ) * 32;
|
||||
y = ( foo & 0xf0 ) * 2;
|
||||
#if DEBUG_LEVEL > 1
|
||||
@ -343,8 +332,7 @@ for (foo=0; foo<256; foo++)
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
|
||||
if (foo < map->nbre)
|
||||
{
|
||||
if (foo < map->nbre) {
|
||||
r = map->red[foo];
|
||||
g = map->green[foo];
|
||||
b = map->blue[foo];
|
||||
@ -353,11 +341,7 @@ for (foo=0; foo<256; foo++)
|
||||
#endif
|
||||
Image_paint_rect(img, &rect, r, g, b);
|
||||
}
|
||||
else /* on est au dela de la fin de la palette */
|
||||
{
|
||||
#if DEBUG_LEVEL > 1
|
||||
printf(" xxx\n");
|
||||
#endif
|
||||
else { /* on est au dela de la fin de la palette */
|
||||
/* Image_gadrct_Hsweep_0(img, &rect, 0); */
|
||||
Image_gadrct_cross(img, &rect, 0);
|
||||
}
|
||||
@ -386,17 +370,14 @@ Image_Rect rect;
|
||||
if ( (img = Image_alloc(400, 300, 3)) == NULL )
|
||||
{
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Plot MAP: alloc of img failed, file=%s\n", nomtga);
|
||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, nomtga);
|
||||
#endif
|
||||
return IMAGE_NO_MEM;
|
||||
}
|
||||
|
||||
Image_clear(img, SOMBRE, SOMBRE, SOMBRE);
|
||||
|
||||
|
||||
|
||||
for (foo=0; foo<map->nbre; foo++)
|
||||
{
|
||||
for (foo=0; foo<map->nbre; foo++) {
|
||||
Image_plotRGB(img, foo+90, 120, 255, 255, 255);
|
||||
Image_plotRGB(img, foo+90, 200, 255, 255, 255);
|
||||
Image_plotRGB(img, foo+90, 280, 255, 255, 255);
|
||||
@ -414,10 +395,8 @@ Image_draw_rect(img, &rect, CLAIR/2, CLAIR/2, CLAIR/2);
|
||||
fprintf(stderr, "Plot MAP: the text is '%s'\n", txt);
|
||||
#endif
|
||||
|
||||
for (foo=0; foo<map->nbre; foo++)
|
||||
{
|
||||
for (x=21; x<50; x++)
|
||||
{
|
||||
for (foo=0; foo<map->nbre; foo++) {
|
||||
for (x=21; x<50; x++) {
|
||||
Image_plotRGB(img, x, foo+31,
|
||||
map->red[foo], map->green[foo], map->blue[foo]);
|
||||
}
|
||||
@ -427,7 +406,7 @@ paper.r = paper.b = paper.g = SOMBRE; paper.a = 0;
|
||||
ink.r = ink.b = ink.g = CLAIR; ink.a = 255;
|
||||
foo = Image_trace_chaine_1(img, txt, 15, 7, "8x8thin", &paper, &ink);
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "Plot MAP: retour trace chaine = %d\n", foo);
|
||||
fprintf(stderr, "%s: retour trace chaine = %d\n", __func__, foo);
|
||||
#endif
|
||||
Image_cadre_A(img);
|
||||
|
||||
@ -446,8 +425,7 @@ return OLL_KORRECT;
|
||||
* new 23 oct 2001
|
||||
* parameters 'p1' and 'p2' are not used, and must be 0 !
|
||||
*/
|
||||
int
|
||||
Image_plot_histo_hf15(Image_Desc *img, char *nom, char *txt, int p1, int p2)
|
||||
int Image_plot_histo_hf15(Image_Desc *img, char *nom, char *txt, int p1, int p2)
|
||||
{
|
||||
Image_Desc *plot;
|
||||
long *histo, maximum;
|
||||
@ -460,49 +438,41 @@ char chaine[200];
|
||||
fprintf(stderr, "%s: img %p ! work in progress !\n", __func__, img);
|
||||
#endif
|
||||
|
||||
if ( (histo=alloca(sizeof(long)*32768)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Plot histo hf15: no mem for buffer\n");
|
||||
if ( (histo=alloca(sizeof(long)*32768)) == NULL) {
|
||||
fprintf(stderr, "%s: no mem for buffer\n", __func__);
|
||||
#if FORCE_ABORT
|
||||
abort();
|
||||
#endif
|
||||
return BUFFER_NO_MEM;
|
||||
}
|
||||
|
||||
if ( (plot = Image_alloc(800, 600, 3)) == NULL )
|
||||
{
|
||||
if ( (plot = Image_alloc(800, 600, 3)) == NULL ) {
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "Plot histo hf15: alloc img failed\n");
|
||||
#endif
|
||||
free(histo);
|
||||
return IMAGE_NO_MEM;
|
||||
}
|
||||
|
||||
Image_clear(plot, SOMBRE, SOMBRE, SOMBRE);
|
||||
for (foo=0; foo<32768; foo++) histo[foo] = 0L;
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "Plot histo hf15: buffers allocated, computing now...\n");
|
||||
#endif
|
||||
|
||||
epic_fail = 0;
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
for (y=0; y<img->height; y++) {
|
||||
for (x=0; x<img->width; x++) {
|
||||
h = Image_hf15_height(img, x, y);
|
||||
if (h<0 || h>32767)
|
||||
epic_fail++;
|
||||
else
|
||||
histo[h]++;
|
||||
if (h<0 || h>32767) epic_fail++;
|
||||
else histo[h]++;
|
||||
}
|
||||
}
|
||||
|
||||
if (epic_fail)
|
||||
{
|
||||
fprintf(stderr, "%s : %d epic fail is epic\n", __func__, epic_fail);
|
||||
if (epic_fail) {
|
||||
fprintf(stderr, "%s: %d epic fail(s) is epic\n", __func__, epic_fail);
|
||||
#if FORCE_ABORT
|
||||
abort();
|
||||
#endif
|
||||
free(histo);
|
||||
|
||||
}
|
||||
|
||||
/* recherche du maximum de l'histogramme, pour faire la mise a l'echelle */
|
||||
@ -518,12 +488,10 @@ fprintf(stderr, "%s: maximum = %ld, diviseur = %g\n", __func__,
|
||||
maximum, diviseur);
|
||||
|
||||
h2 = 0;
|
||||
for (foo=0; foo<32768; foo+=4)
|
||||
{
|
||||
for (foo=0; foo<32768; foo+=4) {
|
||||
h = (int)((double)histo[foo] / diviseur);
|
||||
x = (foo/64)+60;
|
||||
if (foo) /* pourquoi ? */
|
||||
{
|
||||
if (foo) { /* pourquoi ? */
|
||||
vline(plot, x, 590-h, 290-h2, 'g', CLAIR);
|
||||
h2 = h;
|
||||
}
|
||||
|
@ -72,6 +72,9 @@ return FUNC_IS_ALPHA;
|
||||
some approximations\dots
|
||||
|
||||
this function is PRIVATE, see 'Image_getpix_bilin' for public interface
|
||||
|
||||
2022 September : update in progress.
|
||||
|
||||
*/
|
||||
static int getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||
int *pr, int *pg, int *pb)
|
||||
@ -125,6 +128,7 @@ if (rbb < 0.0) abort();
|
||||
if (gbb < 0.0) abort();
|
||||
if (bbb < 0.0) abort();
|
||||
|
||||
/* hu ho ? */
|
||||
rcc = (raa * (1.0-drh)) + (rbb * drh);
|
||||
gcc = (gaa * (1.0-drh)) + (gbb * drh);
|
||||
bcc = (baa * (1.0-drh)) + (bbb * drh);
|
||||
|
15
Lib/stereo.c
15
Lib/stereo.c
@ -11,11 +11,10 @@
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* première fonction, assez primitive, mais qui marche.
|
||||
* premiere fonction, assez primitive, mais qui marche.
|
||||
*/
|
||||
int
|
||||
Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
|
||||
Image_Desc *stereo)
|
||||
int Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
|
||||
Image_Desc *stereo)
|
||||
{
|
||||
int x, y, foo;
|
||||
int rouge, vert;
|
||||
@ -57,8 +56,7 @@ return OLL_KORRECT;
|
||||
* En fait (30 janv 2008, ave StEx) au lieu de faire du Rouge/Vert
|
||||
* il va faire du Rouge/Bleu. A la demande de Ker2x.
|
||||
*/
|
||||
int
|
||||
Image_combine_stereo_1(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||
int Image_combine_stereo_1(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||
int kr, int kg, int kb)
|
||||
{
|
||||
int x, y, foo, cumul;
|
||||
@ -99,7 +97,7 @@ return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* Et pour celui-ci, il faudrait trouver une façon de définir
|
||||
* Et pour celui-ci, il faudrait trouver une maniere de definir
|
||||
* les composantes pour l'image destination, afin de tenir
|
||||
* compte des filtres qui seront dans les lunettes...
|
||||
*/
|
||||
@ -112,6 +110,9 @@ int x, y, foo;
|
||||
int rouge, vert, bleu;
|
||||
XXX */
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %p %p '%c' '%c' )\n", __func__,
|
||||
s1, s2, d, cr, cl);
|
||||
|
||||
fprintf(stderr, "%s: %s missing, sorry.\n", __FILE__, __func__);
|
||||
|
||||
return FULL_NUCKED;
|
||||
|
@ -77,7 +77,7 @@ return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 8 jan 2002
|
||||
* le paramètre 'yo' ne sert à rien et doit être mis à 0
|
||||
* le parametre 'yo' ne sert a rien et doit etre mis a 0
|
||||
*/
|
||||
int Image_TV_gruud(Image_Desc *src, Image_Desc *dst, int yo)
|
||||
{
|
||||
@ -123,7 +123,7 @@ return FUNC_IS_BETA;
|
||||
#define GRIIIZ_SIZE 20
|
||||
|
||||
/*
|
||||
* le paramètre 'yo' ne sert à rien et doit être mis à 0
|
||||
* le parametre 'yo' ne sert e rien et doit etre mis a 0
|
||||
*/
|
||||
int Image_TV_griiiz(Image_Desc *src, Image_Desc *dst, int yo)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ if (img->magic != MAGIC_OF_IMAGE) {
|
||||
return NOT_AN_IMAGE_DESC;
|
||||
}
|
||||
/*
|
||||
* mais ça marche pas a tous les coups. il faudrait pouvoir tester si
|
||||
* mais c,a marche pas a tous les coups. il faudrait pouvoir tester si
|
||||
* le pointeur 'img' est coherent, mais je sais pas comment faire...
|
||||
*/
|
||||
if (compress != 0) {
|
||||
|
13
tthimage.h
13
tthimage.h
@ -4,7 +4,7 @@
|
||||
http:///la.buvette.org/devel/libimage/
|
||||
*/
|
||||
#ifndef IMAGE_VERSION_STRING
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 32"
|
||||
#define IMAGE_VERSION_STRING "0.4.51 pl 38"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
@ -1216,7 +1216,7 @@ int Image_lut15_essai(char *hfname, char *tganame, int ka);
|
||||
/* scale.c */
|
||||
int Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k);
|
||||
int Image_scale_bilinear(Image_Desc *src, Image_Desc *dst, int k);
|
||||
int Image_getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||
int Image_getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||
int *pr, int *pg, int *pb);
|
||||
Image_Desc * Image_new_scale( Image_Desc *, float, float, int );
|
||||
|
||||
@ -1356,8 +1356,17 @@ int Image_Pool_destroy(void *ptr, char *text, int flags);
|
||||
int Image_quadsym_simple(Image_Desc *src, Image_Desc *dst, int mode);
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* from zoom.c */
|
||||
|
||||
int Image_essai_zoom(Image_Desc *src, Image_Desc *dst,
|
||||
double kx, double ky, int flags);
|
||||
int Image_zoom_000(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
||||
float kx, float ky);
|
||||
int Image_zoom_001(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
||||
float kx, float ky);
|
||||
int Image_zoom_extract(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
||||
int flags);
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* imprime.c */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user