Compare commits
No commits in common. "2c4612411bd0dea0489ef753b53c0f3c767a8abf" and "63b0bce08119967b0eaea77cee228abf68382618" have entirely different histories.
2c4612411b
...
63b0bce081
@ -7,9 +7,8 @@
|
|||||||
Et c,a va me forcer a installer libpng
|
Et c,a va me forcer a installer libpng
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
15May01: on attend toujours libPNG
|
15May01: on attend toujours libPNG
|
||||||
07Dec01: pfeue, libPNG toujours pas la...
|
07Dec01: pfeue, libPNG toujours pas là...
|
||||||
03Fev14: ... please wait more ...
|
03Fev14: ... please wait more ...
|
||||||
04Oct22: on the way, stay tuned.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
BASIC_IO Sept 2001
|
BASIC_IO Sept 2001
|
||||||
-------- ---------
|
-------- ---------
|
||||||
|
|
||||||
Ce module a ete ecrit pour tenter de regler les
|
Ce module a été écrit pour tenter de régler les
|
||||||
problemes de "boutisme" pour que c,a puisse aussi
|
problèmes de "boutisme" pour que ça puisse aussi
|
||||||
tourner sur les vrais processeurs, parce que, bon,
|
tourner sur les vrais processeurs, parce que, bon,
|
||||||
les 386, parfois, on s'en gave, hein...
|
les 386, ça suffit, hein...
|
||||||
|
|
||||||
Ceci dit, je ne sais pas vraiment comment traiter
|
Ceci dit, je ne sais pas vraiment comment traiter
|
||||||
le probleme. Pour le moment (Septembre 2001) c'est
|
le problème. Pour le moment (Septembre 2001) c'est
|
||||||
un peu beaucoup du "try and test".
|
un peu beaucoup du "try and test".
|
||||||
|
|
||||||
D'autre part, comment les choses vont se passer sur
|
D'autre part, comment ça va se passer sur des CPUs
|
||||||
des CPUs a 64 (ou 128) bits ?
|
à 64 (ou 128) bits ?
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
9 oct 2001: pourquoi pas de fonction pour ecrire des BYTEs ?
|
9 oct 2001: pourquoi pas de fonction pour ecrire des BYTEs ?
|
||||||
|
@ -11,23 +11,26 @@
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* fonction en chantier -> coredump probable
|
* fonction en chantier -> coredump probable
|
||||||
* je ne sais pas a quoi va servir le parametre 'flags' ...
|
* je ne sais pas à quoi va servir le paramètre 'flags' ...
|
||||||
* 7 nov 2007:
|
* 7 nov 2007:
|
||||||
* le flag a disparu, il contient maintenant la valeur de
|
* le flag a disparu, il contient maintenant la valeur de
|
||||||
* la composante verte. lol.
|
* la composante verte. lol.
|
||||||
*/
|
*/
|
||||||
int Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
|
int
|
||||||
|
Image_cadre_burp_0(Image_Desc *img, int p1, int p2, int gval)
|
||||||
{
|
{
|
||||||
int x, y, zz, v;
|
int x, y, zz, v;
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %d %d 0x%02x )\n", __func__, img, p1, p2, gval);
|
fprintf(stderr, "%s p1=%d p2=%d flg=0x%02x\n", __func__, p1, p2, gval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<img->width; x++) {
|
for (x=0; x<img->width; x++)
|
||||||
|
{
|
||||||
v = (x * 256) / img->width;
|
v = (x * 256) / img->width;
|
||||||
for (zz=0; zz<p1; zz++) {
|
for (zz=0; zz<p1; zz++)
|
||||||
|
{
|
||||||
y = zz;
|
y = zz;
|
||||||
(img->Rpix[y])[x] = 0;
|
(img->Rpix[y])[x] = 0;
|
||||||
(img->Gpix[y])[x] = gval;
|
(img->Gpix[y])[x] = gval;
|
||||||
@ -40,9 +43,11 @@ for (x=0; x<img->width; x++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=p1; y<img->height-p1; y++) {
|
for (y=p1; y<img->height-p1; y++)
|
||||||
|
{
|
||||||
v = (y * 256) / img->height;
|
v = (y * 256) / img->height;
|
||||||
for (zz=0; zz<p2; zz++) {
|
for (zz=0; zz<p2; zz++)
|
||||||
|
{
|
||||||
x = zz;
|
x = zz;
|
||||||
(img->Rpix[y])[x] = 0;
|
(img->Rpix[y])[x] = 0;
|
||||||
(img->Gpix[y])[x] = gval;
|
(img->Gpix[y])[x] = gval;
|
||||||
@ -65,7 +70,8 @@ return FUNC_IS_BETA;
|
|||||||
* 1er Juillet 2022: la colere est toujours la, mais ce n'est pas la
|
* 1er Juillet 2022: la colere est toujours la, mais ce n'est pas la
|
||||||
* meme qu'il y a vingt ans...
|
* meme qu'il y a vingt ans...
|
||||||
*/
|
*/
|
||||||
int Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
|
int
|
||||||
|
Image_cadre_burp_1(Image_Desc *img, int p1, int p2, int flags)
|
||||||
{
|
{
|
||||||
int x, xx, y, yy, v;
|
int x, xx, y, yy, v;
|
||||||
|
|
||||||
@ -75,12 +81,14 @@ int x, xx, y, yy, v;
|
|||||||
fprintf(stderr, ">>> %s ( %p %d %d $%x )\n", __func__, img, p1, p2, flags);
|
fprintf(stderr, ">>> %s ( %p %d %d $%x )\n", __func__, img, p1, p2, flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<img->width; x++) {
|
for (x=0; x<img->width; x++)
|
||||||
|
{
|
||||||
v = (x * 256) / img->width;
|
v = (x * 256) / img->width;
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
printf("%s : debug %d %d\n", __func__, x, v);
|
printf("%s : debug %d %d\n", __func__, x, v);
|
||||||
#endif
|
#endif
|
||||||
for (yy=0; yy<p1; yy++) {
|
for (yy=0; yy<p1; yy++)
|
||||||
|
{
|
||||||
y = yy;
|
y = yy;
|
||||||
(img->Rpix[y])[x] = TOPV-v;
|
(img->Rpix[y])[x] = TOPV-v;
|
||||||
(img->Gpix[y])[x] = TOPV;
|
(img->Gpix[y])[x] = TOPV;
|
||||||
@ -93,9 +101,11 @@ for (x=0; x<img->width; x++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=p1; y<img->height-p1; y++) {
|
for (y=p1; y<img->height-p1; y++)
|
||||||
|
{
|
||||||
v = (y * 256) / img->height;
|
v = (y * 256) / img->height;
|
||||||
for (xx=0; xx<p2; xx++) {
|
for (xx=0; xx<p2; xx++)
|
||||||
|
{
|
||||||
x = xx;
|
x = xx;
|
||||||
(img->Rpix[y])[x] = 0;
|
(img->Rpix[y])[x] = 0;
|
||||||
(img->Gpix[y])[x] = TOPV;
|
(img->Gpix[y])[x] = TOPV;
|
||||||
@ -108,7 +118,8 @@ for (y=p1; y<img->height-p1; y++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & 1) {
|
if (flags & 1)
|
||||||
|
{
|
||||||
fprintf(stderr, "plop from %s\n", __func__);
|
fprintf(stderr, "plop from %s\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +133,8 @@ return OLL_KORRECT;
|
|||||||
* des exemples des objets POV de tTh
|
* des exemples des objets POV de tTh
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
|
int
|
||||||
|
Image_cadre_burp_2(Image_Desc *img, int taille, int pr, int pg, int pb)
|
||||||
{
|
{
|
||||||
int x, y, zz;
|
int x, y, zz;
|
||||||
|
|
||||||
@ -130,8 +142,10 @@ int x, y, zz;
|
|||||||
fprintf(stderr, ">>> %s: sz %d, rgb %d %d %d\n", __func__, taille, pr, pg, pb);
|
fprintf(stderr, ">>> %s: sz %d, rgb %d %d %d\n", __func__, taille, pr, pg, pb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<img->width; x++) {
|
for (x=0; x<img->width; x++)
|
||||||
for (zz=0; zz<taille; zz++) {
|
{
|
||||||
|
for (zz=0; zz<taille; zz++)
|
||||||
|
{
|
||||||
y = zz;
|
y = zz;
|
||||||
(img->Rpix[y])[x] |= pr;
|
(img->Rpix[y])[x] |= pr;
|
||||||
(img->Gpix[y])[x] ^= pg;
|
(img->Gpix[y])[x] ^= pg;
|
||||||
@ -144,8 +158,10 @@ for (x=0; x<img->width; x++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=taille; y<img->height-taille; y++) {
|
for (y=taille; y<img->height-taille; y++)
|
||||||
for (zz=0; zz<taille; zz++) {
|
{
|
||||||
|
for (zz=0; zz<taille; zz++)
|
||||||
|
{
|
||||||
x = zz;
|
x = zz;
|
||||||
(img->Rpix[y])[x] |= pr;
|
(img->Rpix[y])[x] |= pr;
|
||||||
(img->Gpix[y])[x] ^= pg;
|
(img->Gpix[y])[x] ^= pg;
|
||||||
@ -161,13 +177,13 @@ for (y=taille; y<img->height-taille; y++) {
|
|||||||
return OLL_KORRECT;
|
return OLL_KORRECT;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
int Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
|
int
|
||||||
|
Image_cadre_burp_3(Image_Desc *img, int taille, int pr, int pg, int pb)
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %d %d %d %d)\n", __func__, img, taille,
|
fprintf(stderr, "Cadre burp3 on %p\n", img);
|
||||||
pr, pg, pb);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foo = Image_cadre_burp_2(img, taille, pr, pg, pb);
|
foo = Image_cadre_burp_2(img, taille, pr, pg, pb);
|
||||||
@ -185,7 +201,7 @@ int foo;
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, img, taille);
|
fprintf(stderr, "%s : img at %p, taille=%d\n", __func__, img, taille);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RASTA_RAND 4
|
#define RASTA_RAND 4
|
||||||
@ -194,30 +210,33 @@ rect.x = rect.y = 0;
|
|||||||
rect.w = img->width;
|
rect.w = img->width;
|
||||||
rect.h = img->height;
|
rect.h = img->height;
|
||||||
|
|
||||||
for (foo=0; foo<taille; foo++) {
|
for (foo=0; foo<taille; foo++)
|
||||||
|
{
|
||||||
r = 220 + (rand() % RASTA_RAND);
|
r = 220 + (rand() % RASTA_RAND);
|
||||||
b = 10 + (rand() % RASTA_RAND);
|
b = 10 + (rand() % RASTA_RAND);
|
||||||
Image_draw_rect(img, &rect, r, 12, b);
|
Image_draw_rect(img, &rect, r, 10, b);
|
||||||
rect.x++; rect.y++;
|
rect.x++; rect.y++;
|
||||||
rect.h-=2; rect.w-=2;
|
rect.h-=2; rect.w-=2;
|
||||||
}
|
}
|
||||||
for (foo=0; foo<taille; foo++) {
|
for (foo=0; foo<taille; foo++)
|
||||||
|
{
|
||||||
r = 220 + (rand() % RASTA_RAND);
|
r = 220 + (rand() % RASTA_RAND);
|
||||||
g = 200 + (rand() % RASTA_RAND);
|
g = 200 + (rand() % RASTA_RAND);
|
||||||
Image_draw_rect(img, &rect, r, g, 12);
|
Image_draw_rect(img, &rect, r, g, 10);
|
||||||
rect.x++; rect.y++;
|
rect.x++; rect.y++;
|
||||||
rect.h-=2; rect.w-=2;
|
rect.h-=2; rect.w-=2;
|
||||||
}
|
}
|
||||||
for (foo=0; foo<taille; foo++) {
|
for (foo=0; foo<taille; foo++)
|
||||||
|
{
|
||||||
g = 220 + (rand() % RASTA_RAND);
|
g = 220 + (rand() % RASTA_RAND);
|
||||||
b = 10 + (rand() % RASTA_RAND);
|
b = 10 + (rand() % RASTA_RAND);
|
||||||
Image_draw_rect(img, &rect, 12, g, b);
|
Image_draw_rect(img, &rect, 10, g, b);
|
||||||
rect.x++; rect.y++;
|
rect.x++; rect.y++;
|
||||||
rect.h-=2; rect.w-=2;
|
rect.h-=2; rect.w-=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
img->modified = 1;
|
img->modified = 1;
|
||||||
|
|
||||||
return OLL_KORRECT;
|
return FUNC_IS_BETA;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
#include "../tthimage.h"
|
#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;
|
int foo;
|
||||||
|
|
||||||
@ -68,7 +69,8 @@ return ( (r1+g1+b1) - (r2+g2+b2) );
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
|
||||||
#define TAILLE (1<<12)
|
#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;
|
long surface, maxi;
|
||||||
int x, y, r, g, b, idx;
|
int x, y, r, g, b, idx;
|
||||||
@ -79,7 +81,8 @@ struct elem elems[TAILLE];
|
|||||||
fprintf(stderr, " Calc map 4 bits: nbre = %d\n", nbre);
|
fprintf(stderr, " Calc map 4 bits: nbre = %d\n", nbre);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (nbre<1) || (nbre>255) ) {
|
if ( (nbre<1) || (nbre>255) )
|
||||||
|
{
|
||||||
fprintf(stderr, "Calc map 4 bits: nbre %d out of range\n", nbre);
|
fprintf(stderr, "Calc map 4 bits: nbre %d out of range\n", nbre);
|
||||||
return BAD_COLOR_NUMBER;
|
return BAD_COLOR_NUMBER;
|
||||||
}
|
}
|
||||||
@ -89,20 +92,24 @@ surface = img->width * img->height;
|
|||||||
fprintf(stderr, " calc Map 4 bits: surface de l'image = %ld pixels\n", surface);
|
fprintf(stderr, " calc Map 4 bits: surface de l'image = %ld pixels\n", surface);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<TAILLE; x++) {
|
for (x=0; x<TAILLE; x++)
|
||||||
|
{
|
||||||
elems[x].compte = 0L;
|
elems[x].compte = 0L;
|
||||||
elems[x].rgb = x;
|
elems[x].rgb = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxi = 0L;
|
maxi = 0L;
|
||||||
for (x=0; x<img->width; x++) {
|
for (x=0; x<img->width; x++)
|
||||||
for (y=0; y<img->height; y++) {
|
{
|
||||||
|
for (y=0; y<img->height; y++)
|
||||||
|
{
|
||||||
r = (img->Rpix[y])[x] >> 4;
|
r = (img->Rpix[y])[x] >> 4;
|
||||||
g = (img->Gpix[y])[x] >> 4;
|
g = (img->Gpix[y])[x] >> 4;
|
||||||
b = (img->Bpix[y])[x] >> 4;
|
b = (img->Bpix[y])[x] >> 4;
|
||||||
idx = (r<<8) | (g<<4) | b;
|
idx = (r<<8) | (g<<4) | b;
|
||||||
|
|
||||||
if (idx >= TAILLE) {
|
if (idx >= TAILLE)
|
||||||
|
{
|
||||||
fprintf(stderr, "FATAL ERROR in %s\n", __func__);
|
fprintf(stderr, "FATAL ERROR in %s\n", __func__);
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
@ -123,6 +130,7 @@ qsort(elems, TAILLE, sizeof(struct elem), compare_compteur);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* trier la palette, certe, mais dans quel ordre ?
|
* trier la palette, certe, mais dans quel ordre ?
|
||||||
|
*
|
||||||
* 28 Jan 2002: why ?
|
* 28 Jan 2002: why ?
|
||||||
*/
|
*/
|
||||||
qsort(elems, nbre, sizeof(struct elem), compare_teinte);
|
qsort(elems, nbre, sizeof(struct elem), compare_teinte);
|
||||||
@ -130,7 +138,8 @@ qsort(elems, nbre, sizeof(struct elem), compare_teinte);
|
|||||||
/*
|
/*
|
||||||
* recopier les 'nbre' entrees hautes dans la palette
|
* recopier les 'nbre' entrees hautes dans la palette
|
||||||
*/
|
*/
|
||||||
for(x=0; x<nbre; x++) {
|
for(x=0; x<nbre; x++)
|
||||||
|
{
|
||||||
y = elems[x].rgb;
|
y = elems[x].rgb;
|
||||||
|
|
||||||
r = ((y>>8)&0xf)<<4;
|
r = ((y>>8)&0xf)<<4;
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
/*
|
/*
|
||||||
* the easy one.
|
* 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 xd, yd, xf, yf, x, y;
|
||||||
int r, g, b, a0, a1, nbre;
|
int r, g, b, a0, a1, nbre;
|
||||||
@ -41,8 +42,10 @@ a1 = rgba->a;
|
|||||||
|
|
||||||
nbre = 0;
|
nbre = 0;
|
||||||
|
|
||||||
for (x=xd; x<xf; x++) {
|
for (x=xd; x<xf; x++)
|
||||||
for (y=yd; y<yf; y++) {
|
{
|
||||||
|
for (y=yd; y<yf; y++)
|
||||||
|
{
|
||||||
Image_getRGB(img, x, y, &r, &g, &b);
|
Image_getRGB(img, x, y, &r, &g, &b);
|
||||||
/*
|
/*
|
||||||
* ok, compute now...
|
* ok, compute now...
|
||||||
@ -55,15 +58,18 @@ for (x=xd; x<xf; x++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fprintf(stderr, "%d points traités\n", nbre); */
|
||||||
|
|
||||||
return FUNC_IS_BETA;
|
return FUNC_IS_BETA;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* new 15 Janvier 2003.
|
* new 15 Janvier 2003.
|
||||||
* premiere utilisation: l'ecriture des titres des
|
* première utilisation: l'écriture des titres des
|
||||||
* image de l'expovsition.
|
* 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 xd, yd, xf, yf, x, y;
|
||||||
int r, g, b ;
|
int r, g, b ;
|
||||||
@ -79,8 +85,10 @@ fprintf(stderr, "Fade Alpha Rect: %d < X < %d %d < Y < %d\n",
|
|||||||
fprintf(stderr, " coefficient alpha = %d\n", alpha);
|
fprintf(stderr, " coefficient alpha = %d\n", alpha);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=xd; x<xf; x++) {
|
for (x=xd; x<xf; x++)
|
||||||
for (y=yd; y<yf; y++) {
|
{
|
||||||
|
for (y=yd; y<yf; y++)
|
||||||
|
{
|
||||||
Image_getRGB(img, x, y, &r, &g, &b);
|
Image_getRGB(img, x, y, &r, &g, &b);
|
||||||
/*
|
/*
|
||||||
* ok, compute now...
|
* ok, compute now...
|
||||||
@ -100,29 +108,34 @@ return FUNC_IS_BETA; /* need unit testing */
|
|||||||
* bon, une fonction pour tamponner une image quelconque avec une
|
* bon, une fonction pour tamponner une image quelconque avec une
|
||||||
* image alpha, il serait temps de la mettre en place, nom ?
|
* 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 x, y, rs, gs, bs, rt, gt, bt;
|
||||||
int rd, gd, bd, clean_tampon;
|
int rd, gd, bd, clean_tampon;
|
||||||
|
|
||||||
clean_tampon = 0;
|
clean_tampon = 0;
|
||||||
/* if the 'tampon' is not defined, we have to imagine one */
|
/* if the 'tampon' is not defined, we have to imagine one */
|
||||||
if (NULL==tampon) {
|
if (NULL==tampon)
|
||||||
|
{
|
||||||
tampon = Image_clone(src, 0);
|
tampon = Image_clone(src, 0);
|
||||||
fprintf(stderr, "fake tampon @ %p\n", tampon);
|
fprintf(stderr, "fake tampon @ %p\n", tampon);
|
||||||
Image_mirror(src, tampon, 0);
|
Image_mirror(src, tampon, 0);
|
||||||
clean_tampon = 1;
|
clean_tampon = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<src->height; y++) {
|
for (y=0; y<src->height; y++)
|
||||||
for (x=0; x<src->width; x++) {
|
{
|
||||||
|
for (x=0; x<src->width; x++)
|
||||||
|
{
|
||||||
Image_getRGB(src, x, y, &rs, &gs, &bs);
|
Image_getRGB(src, x, y, &rs, &gs, &bs);
|
||||||
Image_getRGB(tampon, x, y, &rt, >, &bt);
|
Image_getRGB(tampon, x, y, &rt, >, &bt);
|
||||||
rd = (rs * rt) / 256;
|
rd = (rs * rt) / 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clean_tampon) {
|
if (clean_tampon)
|
||||||
|
{
|
||||||
fprintf(stderr, "clean %p in %s\n", tampon, __func__);
|
fprintf(stderr, "clean %p in %s\n", tampon, __func__);
|
||||||
Image_DeAllocate(tampon); free(tampon);
|
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);
|
fprintf(stderr, "sym %d %d\n", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* le parametre 'wrap' ne sert a rien */
|
/* le paramètre 'wrap' ne sert à rien */
|
||||||
int Image_draw_circle(Image_Desc *i, int xc, int yc, int rayon, RGBA *q, int wrap)
|
int Image_draw_circle(Image_Desc *i, int xc, int yc, int rayon, RGBA *q, int wrap)
|
||||||
{
|
{
|
||||||
int x, y, d;
|
int x, y, d;
|
||||||
@ -111,7 +111,7 @@ return 0;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* XXX si je veux remplacer 'plotRGB' par un acces direct
|
* XXX si je veux remplacer 'plotRGB' par un accès direct
|
||||||
* XXX dans les buffers, il faut soigner les controles
|
* 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)
|
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));
|
xf = min((img->width), (rect->x+rect->w));
|
||||||
yf = min((img->height), (rect->y+rect->h));
|
yf = min((img->height), (rect->y+rect->h));
|
||||||
/*
|
/*
|
||||||
* 24 Juin 2002: est-ce que le code ci-dessus est vraiment valide ?
|
* 24 Juin 2002: est-ce que le code ci-dessus a été sérieusement validé ?
|
||||||
* 24 Avril 2008: NON !
|
* 24 Avril 2008: NON !
|
||||||
* 26 janvier 2014 : toujours non...
|
* 26 janvier 2014 : toujours non...
|
||||||
* 19 septembre 2022 : je n'ai pas de certitude a ce sujet
|
* 19 septembre 2022 : je n'ai pas de certitude à ce sujet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 2
|
#if DEBUG_LEVEL > 2
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
+---------------------------------------+
|
+---------------------------------------+
|
||||||
| Effets speciaux sur les images |
|
| Effets speciaux sur les images |
|
||||||
| troisieme module |
|
| troisième module |
|
||||||
+---------------------------------------+
|
+---------------------------------------+
|
||||||
Thierry Boudet <oulala@chez.com>
|
Thierry Boudet <oulala@chez.com>
|
||||||
*/
|
*/
|
||||||
@ -70,7 +70,8 @@ return FUNC_IS_BETA;
|
|||||||
/*
|
/*
|
||||||
* 3 avril 2007: je me rend compte que les parametres ne servent a rien.
|
* 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;
|
int foo, x, y, r, g, b;
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ for (y=0; y<dst->height; y++) {
|
|||||||
g = src->Gpix[y][x];
|
g = src->Gpix[y][x];
|
||||||
b = src->Bpix[y][x];
|
b = src->Bpix[y][x];
|
||||||
|
|
||||||
/* 2 fevrier 2003: je fait du n'importe quoi, la... */
|
/* 2 fevrier 2003: je fait du n'importe quoi, là... */
|
||||||
dst->Rpix[y][x] = g^b;
|
dst->Rpix[y][x] = g^b;
|
||||||
dst->Gpix[y][x] = r^b;
|
dst->Gpix[y][x] = r^b;
|
||||||
dst->Bpix[y][x] = r^g;
|
dst->Bpix[y][x] = r^g;
|
||||||
@ -96,10 +97,11 @@ return FUNC_IS_BETA;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* 1er Fevrier 2003: encore une autre experimentation, qui va etre
|
* 1er Février 2003: encore une autre expérimentation, qui va être
|
||||||
* basee sur la trigonometrie.
|
* basée sur la trigonométrie.
|
||||||
*/
|
*/
|
||||||
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;
|
int foo, x, y, r, g, b;
|
||||||
double dr, dg, db, ar, ag, ab;
|
double dr, dg, db, ar, ag, ab;
|
||||||
@ -133,7 +135,7 @@ for (y=0; y<dst->height; y++) {
|
|||||||
ab = atan2(dr, dg);
|
ab = atan2(dr, dg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* et la il y a des soucis d'echelle :)
|
* et là, il y a des soucis d'echelle :)
|
||||||
* 15 mars 2005: pourquoi 156 ? (XXX)
|
* 15 mars 2005: pourquoi 156 ? (XXX)
|
||||||
*/
|
*/
|
||||||
r = (int)(ar * 156.0);
|
r = (int)(ar * 156.0);
|
||||||
@ -152,13 +154,14 @@ return FUNC_IS_BETA;
|
|||||||
/*
|
/*
|
||||||
* 30 Jan 2003: hop, j'improvise pendant que les patates cuisent :)
|
* 30 Jan 2003: hop, j'improvise pendant que les patates cuisent :)
|
||||||
* 4 Fev 2003: et je peaufine pendant que le poulet mijote :)
|
* 4 Fev 2003: et je peaufine pendant que le poulet mijote :)
|
||||||
* 27 Oct 2003: je debugge pendant que le the infuse :)
|
* 27 Oct 2003: je debugge pendant que le thé infuse :)
|
||||||
* 16 Mai 2005: je commence a ecrire la documentation.
|
* 16 Mai 2005: je commence a ecrire la documentation.
|
||||||
* 29 sept 2015: je devrais finir la doc d'ici 2 ans.
|
* 29 sept 2015: je devrais finir la doc d'ici 2 ans.
|
||||||
* 19 aout 2022: je comprend pas ce que c'est cense faire :)
|
* 19 aout 2022: je comprend pas ce que c'est censé 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 foo, sx, sy;
|
||||||
int x, y, r, g, b;
|
int x, y, r, g, b;
|
||||||
@ -168,13 +171,15 @@ int cx, cy, dx, dy;
|
|||||||
fprintf(stderr, "%s : kx %d ky %d comp '%s'\n", __func__, kx, ky, comp);
|
fprintf(stderr, "%s : kx %d ky %d comp '%s'\n", __func__, kx, ky, comp);
|
||||||
#endif
|
#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);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(comp) != 2) {
|
if (strlen(comp) != 2)
|
||||||
fprintf(stderr, "%s: bad comp parameter '%s'\n", __func__, comp);
|
{
|
||||||
|
fprintf(stderr, "eff x3: bad comp parameter '%s'\n", comp);
|
||||||
fprintf(stderr, " must be a 2 chars string, from 'rgb'\n");
|
fprintf(stderr, " must be a 2 chars string, from 'rgb'\n");
|
||||||
return INVALID_PARAM;
|
return INVALID_PARAM;
|
||||||
}
|
}
|
||||||
@ -188,22 +193,25 @@ sx = sy = 0;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* ici il faudrait une validation des deux lettres, mais j'ai la
|
* ici il faudrait une validation des deux lettres, mais j'ai la
|
||||||
* flemme d'ecrire ce genre de chos maintenant.
|
* flemme d'écrire ça maintenant. je vais plutôt aller boofer.
|
||||||
* Je vais plutot aller boofer.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (y=0; y<dst->height; y++) {
|
for (y=0; y<dst->height; y++)
|
||||||
for (x=0; x<dst->width; x++) {
|
{
|
||||||
|
for (x=0; x<dst->width; x++)
|
||||||
|
{
|
||||||
r = src->Rpix[y][x];
|
r = src->Rpix[y][x];
|
||||||
g = src->Gpix[y][x];
|
g = src->Gpix[y][x];
|
||||||
b = src->Bpix[y][x];
|
b = src->Bpix[y][x];
|
||||||
|
|
||||||
switch(cx) {
|
switch(cx)
|
||||||
|
{
|
||||||
case 'r': dx = r; break;
|
case 'r': dx = r; break;
|
||||||
case 'g': dx = g; break;
|
case 'g': dx = g; break;
|
||||||
case 'b': dx = b; break;
|
case 'b': dx = b; break;
|
||||||
}
|
}
|
||||||
switch(cy) {
|
switch(cy)
|
||||||
|
{
|
||||||
case 'r': dy = r; break;
|
case 'r': dy = r; break;
|
||||||
case 'g': dy = g; break;
|
case 'g': dy = g; break;
|
||||||
case 'b': dy = b; break;
|
case 'b': dy = b; break;
|
||||||
@ -213,13 +221,15 @@ for (y=0; y<dst->height; y++) {
|
|||||||
sy = y + ((ky * (dy-128)) / 100);
|
sy = y + ((ky * (dy-128)) / 100);
|
||||||
|
|
||||||
if ( sx >= 0 && sx < dst->width &&
|
if ( sx >= 0 && sx < dst->width &&
|
||||||
sy >= 0 && sy < dst->height ) {
|
sy >= 0 && sy < dst->height )
|
||||||
|
{
|
||||||
r = src->Rpix[sy][sx];
|
r = src->Rpix[sy][sx];
|
||||||
g = src->Gpix[sy][sx];
|
g = src->Gpix[sy][sx];
|
||||||
b = src->Bpix[sy][sx];
|
b = src->Bpix[sy][sx];
|
||||||
Image_plotRGB(dst, x, y, r, g, b);
|
Image_plotRGB(dst, x, y, r, g, b);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
Image_plotRGB(dst, x, y, r, r, r);
|
Image_plotRGB(dst, x, y, r, r, r);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -275,7 +285,8 @@ return FUNC_IS_BETA;
|
|||||||
* faudrait que les gosses arretent de ma casser les oreilles avec leur
|
* faudrait que les gosses arretent de ma casser les oreilles avec leur
|
||||||
* machine a batailles. putain de gamecube... */
|
* machine a batailles. putain de gamecube... */
|
||||||
/* 23 aout 2022 : j'ai bien envie d'une SNES et d'un Trinitron */
|
/* 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 foo, sx, sy;
|
||||||
int x, y, r, g, b;
|
int x, y, r, g, b;
|
||||||
|
@ -11,7 +11,7 @@ int essai_show_t16x24( char *text)
|
|||||||
if (NULL != text)
|
if (NULL != text)
|
||||||
Image_t16x24_essai("16x24thin", text, "16x24.tga");
|
Image_t16x24_essai("16x24thin", text, "16x24.tga");
|
||||||
else
|
else
|
||||||
Image_t16x24_essai("16x24gruik", "0123456789abcdef", "16x24.tga");
|
Image_t16x24_essai("16x24thin", "0123456789abcdef", "16x24.tga");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* ============================== */
|
/* ============================== */
|
||||||
@ -66,9 +66,6 @@ int foo;
|
|||||||
Image_print_version(2);
|
Image_print_version(2);
|
||||||
Image_print_sizeof_structs("foo");
|
Image_print_sizeof_structs("foo");
|
||||||
|
|
||||||
foo = essai_show_t16x24(NULL);
|
|
||||||
fprintf(stderr, "essai show t16x24 --> %d\n", foo);
|
|
||||||
|
|
||||||
foo = essai_draw_paint_rect("foo.tga");
|
foo = essai_draw_paint_rect("foo.tga");
|
||||||
fprintf(stderr, "essai draw rect --> %d\n", foo);
|
fprintf(stderr, "essai draw rect --> %d\n", foo);
|
||||||
|
|
||||||
|
53
Lib/morpho.c
53
Lib/morpho.c
@ -27,24 +27,33 @@ static struct
|
|||||||
* =============================
|
* =============================
|
||||||
* 23 avril 2007: switched to direct pixel access.
|
* 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 foo, x, y, maxr, maxg, maxb;
|
||||||
int r, g, b;
|
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;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 != factor ) {
|
if ( 0 != factor )
|
||||||
|
{
|
||||||
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=1; y<src->height-1; y++) {
|
#if DEBUG_LEVEL
|
||||||
for (x=1; x<src->width-1; x++) {
|
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++)
|
||||||
|
{
|
||||||
maxr = maxg = maxb = 0;
|
maxr = maxg = maxb = 0;
|
||||||
for (foo=0; foo<9; foo++) {
|
for (foo=0; foo<9; foo++)
|
||||||
|
{
|
||||||
/* XXX Faster pussy cat !
|
/* XXX Faster pussy cat !
|
||||||
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||||
&r, &g, &b);
|
&r, &g, &b);
|
||||||
@ -69,16 +78,19 @@ dst->modified = 1;
|
|||||||
return 0;
|
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 foo, x, y, minr, ming, minb;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
if ( (foo=Image_compare_desc(src, dst)) )
|
||||||
|
{
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 != factor ) {
|
if ( 0 != factor )
|
||||||
|
{
|
||||||
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
fprintf(stderr, "%s: factor (%d) must be 0\n", __func__, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +98,13 @@ if ( 0 != factor ) {
|
|||||||
fprintf(stderr, "expanding MIN %p to %p\n", src, dst);
|
fprintf(stderr, "expanding MIN %p to %p\n", src, dst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (y=1; y<src->height-1; y++) {
|
for (y=1; y<src->height-1; y++)
|
||||||
for (x=1; x<src->width-1; x++) {
|
{
|
||||||
|
for (x=1; x<src->width-1; x++)
|
||||||
|
{
|
||||||
minr = ming = minb = 1664;
|
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,
|
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||||
&r, &g, &b);
|
&r, &g, &b);
|
||||||
|
|
||||||
@ -118,7 +133,8 @@ Image_sortmat_display(FILE *ou, struct sort_pixel *table)
|
|||||||
fprintf(ou, "%s ( %p )\n", __func__, 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 x, y, r, g, b;
|
||||||
int foo, gris;
|
int foo, gris;
|
||||||
@ -129,10 +145,13 @@ struct sort_pixel pixels[9];
|
|||||||
fprintf(stderr, "Image Gray Sorted Points: %p -> %p\n", src, dst);
|
fprintf(stderr, "Image Gray Sorted Points: %p -> %p\n", src, dst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (y=1; y<src->height-1; y++) {
|
for (y=1; y<src->height-1; y++)
|
||||||
for (x=1; x<src->width-1; x++) {
|
{
|
||||||
|
for (x=1; x<src->width-1; x++)
|
||||||
|
{
|
||||||
/* collecte des infos sur les voisins. */
|
/* 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,
|
Image_getRGB(src, x+deltas[foo].x, y+deltas[foo].y,
|
||||||
&r, &g, &b);
|
&r, &g, &b);
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
25 Aout 1999: certaines fonctions utilisent 'alloca'.
|
25 Aout 1999: certaines fonctions utilisent 'alloca'.
|
||||||
|
|
||||||
4 Fevrier 2001: je me rend compte que certaines interfaces sont trop
|
4 Fevrier 2001: je me rend compte que certaines interfaces sont trop
|
||||||
simplistes, et que definir des structures contenant de multiples
|
simplistes, et que définir des structures contenant de multiples
|
||||||
parametres ne serait peut-etre pas une mauvaise idee...
|
paramètres ne serait peut-être pas une mauvaise idée...
|
||||||
|
|
||||||
16 Oct 2001: je deplace quelques fonctions dans d'autres modules.
|
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:
|
* p'taing, c'est tellement crade qu'il faut:
|
||||||
* 1) retrouver d'ou c,a vient
|
* 1) retrouver d'ou ça vient
|
||||||
* 2) la virer illico !...
|
* 2) la virer illico !...
|
||||||
*/
|
*/
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
110
Lib/plotteur.c
110
Lib/plotteur.c
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "../tthimage.h"
|
#include "../tthimage.h"
|
||||||
|
|
||||||
#define SOMBRE 26 /* pourquoi ces valeurs sont codees en */
|
#define SOMBRE 26 /* pourquoi ces valeurs sont codées en */
|
||||||
#define CLAIR 242 /* dur ? et ~/.tth/libimagerc alors ? */
|
#define CLAIR 242 /* dur ? et ~/.tth/libimagerc alors ? */
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
@ -30,16 +30,18 @@ for (foo=bas; foo<=haut; foo++)
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 20 mars 2002
|
/* 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;
|
Image_Desc *img;
|
||||||
int foo;
|
int foo;
|
||||||
RGBA paper, ink;
|
RGBA paper, ink;
|
||||||
int vr, vg, vb, ovr, ovg, ovb;
|
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
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, nomtga);
|
fprintf(stderr, "Plot Luts: alloc of img failed, file=%s\n", nomtga);
|
||||||
#endif
|
#endif
|
||||||
return IMAGE_NO_MEM;
|
return IMAGE_NO_MEM;
|
||||||
}
|
}
|
||||||
@ -136,13 +138,13 @@ fprintf(stderr, "taille txt %d\n", strlen(txt));
|
|||||||
|
|
||||||
Image_trace_chaine_1(img, txt, 5, 5, "libimage.fonte", &paper, &ink);
|
Image_trace_chaine_1(img, txt, 5, 5, "libimage.fonte", &paper, &ink);
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "[%s] drawed...\n", txt);
|
fprintf(stderr, "[%s] tracée...\n", txt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf(chaine, "max rgb = %ld", maxhisto);
|
sprintf(chaine, "max rgb = %ld", maxhisto);
|
||||||
Image_trace_chaine_1(img, chaine, 5, 15, NULL, &paper, &ink);
|
Image_trace_chaine_1(img, chaine, 5, 15, NULL, &paper, &ink);
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "[%s] drawed...\n", chaine);
|
fprintf(stderr, "[%s] tracée...\n", chaine);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Image_cadre_A(img);
|
Image_cadre_A(img);
|
||||||
@ -175,7 +177,8 @@ return FUNC_IS_BETA;
|
|||||||
* fabrique dans une image une petite bande a partir d'une palette
|
* fabrique dans une image une petite bande a partir d'une palette
|
||||||
* cette bande est horizontale.
|
* 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;
|
int x, y, v;
|
||||||
|
|
||||||
@ -209,12 +212,15 @@ return FUNC_IS_BETA;
|
|||||||
* fabrique dans une image une petite bande a partir d'une palette
|
* fabrique dans une image une petite bande a partir d'une palette
|
||||||
* cette bande est verticale.
|
* 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;
|
int x, y, v;
|
||||||
|
|
||||||
for (y=0; y<256; y++) {
|
for (y=0; y<256; y++)
|
||||||
for (x=0; x<l; x++) {
|
{
|
||||||
|
for (x=0; x<l; x++)
|
||||||
|
{
|
||||||
if ( ((y>>2)+(x>>2)) & 1) v = SOMBRE;
|
if ( ((y>>2)+(x>>2)) & 1) v = SOMBRE;
|
||||||
else v = CLAIR;
|
else v = CLAIR;
|
||||||
Image_plotRGB(img, x+xpos, y+ypos, v, v, v);
|
Image_plotRGB(img, x+xpos, y+ypos, v, v, v);
|
||||||
@ -241,7 +247,8 @@ return FUNC_IS_BETA;
|
|||||||
* fabrique une petite TGA horizontale avec une palette dedans
|
* fabrique une petite TGA horizontale avec une palette dedans
|
||||||
*/
|
*/
|
||||||
#define LITTLE_DIM 42
|
#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;
|
Image_Desc *img;
|
||||||
int foo;
|
int foo;
|
||||||
@ -269,10 +276,11 @@ return FUNC_IS_BETA;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* 20 Fevrier 2002.
|
* 20 Février 2002.
|
||||||
* fabrique une petite TGA verticale avec une palette dedans
|
* 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;
|
Image_Desc *img;
|
||||||
int foo;
|
int foo;
|
||||||
@ -298,7 +306,8 @@ return FUNC_IS_BETA;
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 2 decembre 2009 - ave St Exupery
|
/* 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 x, y, foo;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
@ -311,9 +320,10 @@ fprintf(stderr, "%s ( '%s' %p '%s' %d )\n", __func__,
|
|||||||
fname, map, texte, k);
|
fname, map, texte, k);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (img = Image_alloc(512, 512, 3)) == NULL ) {
|
if ( (img = Image_alloc(512, 512, 3)) == NULL )
|
||||||
|
{
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, fname);
|
fprintf(stderr, "Plot MAP: alloc of img failed, file=%s\n", fname);
|
||||||
#endif
|
#endif
|
||||||
return IMAGE_NO_MEM;
|
return IMAGE_NO_MEM;
|
||||||
}
|
}
|
||||||
@ -322,7 +332,8 @@ Image_clear(img, 0, 0, 0);
|
|||||||
|
|
||||||
rect.h = rect.w = 31;
|
rect.h = rect.w = 31;
|
||||||
|
|
||||||
for (foo=0; foo<256; foo++) {
|
for (foo=0; foo<256; foo++)
|
||||||
|
{
|
||||||
x = ( foo & 0x0f ) * 32;
|
x = ( foo & 0x0f ) * 32;
|
||||||
y = ( foo & 0xf0 ) * 2;
|
y = ( foo & 0xf0 ) * 2;
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
@ -332,7 +343,8 @@ for (foo=0; foo<256; foo++) {
|
|||||||
rect.x = x;
|
rect.x = x;
|
||||||
rect.y = y;
|
rect.y = y;
|
||||||
|
|
||||||
if (foo < map->nbre) {
|
if (foo < map->nbre)
|
||||||
|
{
|
||||||
r = map->red[foo];
|
r = map->red[foo];
|
||||||
g = map->green[foo];
|
g = map->green[foo];
|
||||||
b = map->blue[foo];
|
b = map->blue[foo];
|
||||||
@ -341,7 +353,11 @@ for (foo=0; foo<256; foo++) {
|
|||||||
#endif
|
#endif
|
||||||
Image_paint_rect(img, &rect, r, g, b);
|
Image_paint_rect(img, &rect, r, g, b);
|
||||||
}
|
}
|
||||||
else { /* on est au dela de la fin de la palette */
|
else /* on est au dela de la fin de la palette */
|
||||||
|
{
|
||||||
|
#if DEBUG_LEVEL > 1
|
||||||
|
printf(" xxx\n");
|
||||||
|
#endif
|
||||||
/* Image_gadrct_Hsweep_0(img, &rect, 0); */
|
/* Image_gadrct_Hsweep_0(img, &rect, 0); */
|
||||||
Image_gadrct_cross(img, &rect, 0);
|
Image_gadrct_cross(img, &rect, 0);
|
||||||
}
|
}
|
||||||
@ -370,14 +386,17 @@ Image_Rect rect;
|
|||||||
if ( (img = Image_alloc(400, 300, 3)) == NULL )
|
if ( (img = Image_alloc(400, 300, 3)) == NULL )
|
||||||
{
|
{
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "%s: alloc of img failed, file=%s\n", __func__, nomtga);
|
fprintf(stderr, "Plot MAP: alloc of img failed, file=%s\n", nomtga);
|
||||||
#endif
|
#endif
|
||||||
return IMAGE_NO_MEM;
|
return IMAGE_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Image_clear(img, SOMBRE, SOMBRE, SOMBRE);
|
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, 120, 255, 255, 255);
|
||||||
Image_plotRGB(img, foo+90, 200, 255, 255, 255);
|
Image_plotRGB(img, foo+90, 200, 255, 255, 255);
|
||||||
Image_plotRGB(img, foo+90, 280, 255, 255, 255);
|
Image_plotRGB(img, foo+90, 280, 255, 255, 255);
|
||||||
@ -395,8 +414,10 @@ Image_draw_rect(img, &rect, CLAIR/2, CLAIR/2, CLAIR/2);
|
|||||||
fprintf(stderr, "Plot MAP: the text is '%s'\n", txt);
|
fprintf(stderr, "Plot MAP: the text is '%s'\n", txt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (foo=0; foo<map->nbre; foo++) {
|
for (foo=0; foo<map->nbre; foo++)
|
||||||
for (x=21; x<50; x++) {
|
{
|
||||||
|
for (x=21; x<50; x++)
|
||||||
|
{
|
||||||
Image_plotRGB(img, x, foo+31,
|
Image_plotRGB(img, x, foo+31,
|
||||||
map->red[foo], map->green[foo], map->blue[foo]);
|
map->red[foo], map->green[foo], map->blue[foo]);
|
||||||
}
|
}
|
||||||
@ -406,7 +427,7 @@ paper.r = paper.b = paper.g = SOMBRE; paper.a = 0;
|
|||||||
ink.r = ink.b = ink.g = CLAIR; ink.a = 255;
|
ink.r = ink.b = ink.g = CLAIR; ink.a = 255;
|
||||||
foo = Image_trace_chaine_1(img, txt, 15, 7, "8x8thin", &paper, &ink);
|
foo = Image_trace_chaine_1(img, txt, 15, 7, "8x8thin", &paper, &ink);
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "%s: retour trace chaine = %d\n", __func__, foo);
|
fprintf(stderr, "Plot MAP: retour trace chaine = %d\n", foo);
|
||||||
#endif
|
#endif
|
||||||
Image_cadre_A(img);
|
Image_cadre_A(img);
|
||||||
|
|
||||||
@ -425,7 +446,8 @@ return OLL_KORRECT;
|
|||||||
* new 23 oct 2001
|
* new 23 oct 2001
|
||||||
* parameters 'p1' and 'p2' are not used, and must be 0 !
|
* 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;
|
Image_Desc *plot;
|
||||||
long *histo, maximum;
|
long *histo, maximum;
|
||||||
@ -438,41 +460,49 @@ char chaine[200];
|
|||||||
fprintf(stderr, "%s: img %p ! work in progress !\n", __func__, img);
|
fprintf(stderr, "%s: img %p ! work in progress !\n", __func__, img);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (histo=alloca(sizeof(long)*32768)) == NULL) {
|
if ( (histo=alloca(sizeof(long)*32768)) == NULL)
|
||||||
fprintf(stderr, "%s: no mem for buffer\n", __func__);
|
{
|
||||||
|
fprintf(stderr, "Plot histo hf15: no mem for buffer\n");
|
||||||
#if FORCE_ABORT
|
#if FORCE_ABORT
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
return BUFFER_NO_MEM;
|
return BUFFER_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (plot = Image_alloc(800, 600, 3)) == NULL ) {
|
if ( (plot = Image_alloc(800, 600, 3)) == NULL )
|
||||||
|
{
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "Plot histo hf15: alloc img failed\n");
|
fprintf(stderr, "Plot histo hf15: alloc img failed\n");
|
||||||
#endif
|
#endif
|
||||||
free(histo);
|
|
||||||
return IMAGE_NO_MEM;
|
return IMAGE_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Image_clear(plot, SOMBRE, SOMBRE, SOMBRE);
|
Image_clear(plot, SOMBRE, SOMBRE, SOMBRE);
|
||||||
for (foo=0; foo<32768; foo++) histo[foo] = 0L;
|
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;
|
epic_fail = 0;
|
||||||
for (y=0; y<img->height; y++) {
|
for (y=0; y<img->height; y++)
|
||||||
for (x=0; x<img->width; x++) {
|
{
|
||||||
|
for (x=0; x<img->width; x++)
|
||||||
|
{
|
||||||
h = Image_hf15_height(img, x, y);
|
h = Image_hf15_height(img, x, y);
|
||||||
if (h<0 || h>32767) epic_fail++;
|
if (h<0 || h>32767)
|
||||||
else histo[h]++;
|
epic_fail++;
|
||||||
|
else
|
||||||
|
histo[h]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (epic_fail) {
|
if (epic_fail)
|
||||||
fprintf(stderr, "%s: %d epic fail(s) is epic\n", __func__, epic_fail);
|
{
|
||||||
|
fprintf(stderr, "%s : %d epic fail is epic\n", __func__, epic_fail);
|
||||||
#if FORCE_ABORT
|
#if FORCE_ABORT
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
free(histo);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* recherche du maximum de l'histogramme, pour faire la mise a l'echelle */
|
/* recherche du maximum de l'histogramme, pour faire la mise a l'echelle */
|
||||||
@ -488,10 +518,12 @@ fprintf(stderr, "%s: maximum = %ld, diviseur = %g\n", __func__,
|
|||||||
maximum, diviseur);
|
maximum, diviseur);
|
||||||
|
|
||||||
h2 = 0;
|
h2 = 0;
|
||||||
for (foo=0; foo<32768; foo+=4) {
|
for (foo=0; foo<32768; foo+=4)
|
||||||
|
{
|
||||||
h = (int)((double)histo[foo] / diviseur);
|
h = (int)((double)histo[foo] / diviseur);
|
||||||
x = (foo/64)+60;
|
x = (foo/64)+60;
|
||||||
if (foo) { /* pourquoi ? */
|
if (foo) /* pourquoi ? */
|
||||||
|
{
|
||||||
vline(plot, x, 590-h, 290-h2, 'g', CLAIR);
|
vline(plot, x, 590-h, 290-h2, 'g', CLAIR);
|
||||||
h2 = h;
|
h2 = h;
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,6 @@ return FUNC_IS_ALPHA;
|
|||||||
some approximations\dots
|
some approximations\dots
|
||||||
|
|
||||||
this function is PRIVATE, see 'Image_getpix_bilin' for public interface
|
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,
|
static int getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||||
int *pr, int *pg, int *pb)
|
int *pr, int *pg, int *pb)
|
||||||
@ -128,7 +125,6 @@ if (rbb < 0.0) abort();
|
|||||||
if (gbb < 0.0) abort();
|
if (gbb < 0.0) abort();
|
||||||
if (bbb < 0.0) abort();
|
if (bbb < 0.0) abort();
|
||||||
|
|
||||||
/* hu ho ? */
|
|
||||||
rcc = (raa * (1.0-drh)) + (rbb * drh);
|
rcc = (raa * (1.0-drh)) + (rbb * drh);
|
||||||
gcc = (gaa * (1.0-drh)) + (gbb * drh);
|
gcc = (gaa * (1.0-drh)) + (gbb * drh);
|
||||||
bcc = (baa * (1.0-drh)) + (bbb * drh);
|
bcc = (baa * (1.0-drh)) + (bbb * drh);
|
||||||
|
13
Lib/stereo.c
13
Lib/stereo.c
@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* premiere fonction, assez primitive, mais qui marche.
|
* première fonction, assez primitive, mais qui marche.
|
||||||
*/
|
*/
|
||||||
int Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
|
int
|
||||||
|
Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
|
||||||
Image_Desc *stereo)
|
Image_Desc *stereo)
|
||||||
{
|
{
|
||||||
int x, y, foo;
|
int x, y, foo;
|
||||||
@ -56,7 +57,8 @@ return OLL_KORRECT;
|
|||||||
* En fait (30 janv 2008, ave StEx) au lieu de faire du Rouge/Vert
|
* 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.
|
* 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 kr, int kg, int kb)
|
||||||
{
|
{
|
||||||
int x, y, foo, cumul;
|
int x, y, foo, cumul;
|
||||||
@ -97,7 +99,7 @@ return FUNC_IS_BETA;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* Et pour celui-ci, il faudrait trouver une maniere de definir
|
* Et pour celui-ci, il faudrait trouver une façon de définir
|
||||||
* les composantes pour l'image destination, afin de tenir
|
* les composantes pour l'image destination, afin de tenir
|
||||||
* compte des filtres qui seront dans les lunettes...
|
* compte des filtres qui seront dans les lunettes...
|
||||||
*/
|
*/
|
||||||
@ -110,9 +112,6 @@ int x, y, foo;
|
|||||||
int rouge, vert, bleu;
|
int rouge, vert, bleu;
|
||||||
XXX */
|
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__);
|
fprintf(stderr, "%s: %s missing, sorry.\n", __FILE__, __func__);
|
||||||
|
|
||||||
return FULL_NUCKED;
|
return FULL_NUCKED;
|
||||||
|
@ -77,7 +77,7 @@ return FUNC_IS_BETA;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 8 jan 2002
|
/* new 8 jan 2002
|
||||||
* le parametre 'yo' ne sert a rien et doit etre mis a 0
|
* le paramètre 'yo' ne sert à rien et doit être mis à 0
|
||||||
*/
|
*/
|
||||||
int Image_TV_gruud(Image_Desc *src, Image_Desc *dst, int yo)
|
int Image_TV_gruud(Image_Desc *src, Image_Desc *dst, int yo)
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ return FUNC_IS_BETA;
|
|||||||
#define GRIIIZ_SIZE 20
|
#define GRIIIZ_SIZE 20
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* le parametre 'yo' ne sert e rien et doit etre mis a 0
|
* le paramètre 'yo' ne sert à rien et doit être mis à 0
|
||||||
*/
|
*/
|
||||||
int Image_TV_griiiz(Image_Desc *src, Image_Desc *dst, int yo)
|
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;
|
return NOT_AN_IMAGE_DESC;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* mais c,a marche pas a tous les coups. il faudrait pouvoir tester si
|
* mais ça marche pas a tous les coups. il faudrait pouvoir tester si
|
||||||
* le pointeur 'img' est coherent, mais je sais pas comment faire...
|
* le pointeur 'img' est coherent, mais je sais pas comment faire...
|
||||||
*/
|
*/
|
||||||
if (compress != 0) {
|
if (compress != 0) {
|
||||||
|
134
Lib/zoom.c
134
Lib/zoom.c
@ -26,37 +26,35 @@ long hit, mess;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %p %f %f 0x%x )\n", __func__,
|
fprintf(stderr, "%s : %p -> %p %f %f 0x%x\n", __func__,
|
||||||
src, dst, kx, ky, flags);
|
src, dst, kx, ky, flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (flags) {
|
/* initilaisation de variables de debug/comptage */
|
||||||
fprintf(stderr, "in %s, flags muste be 0x0000\n", __func__);
|
|
||||||
return WRONG_FLAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialisation de variables de debug/comptage */
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
hit = mess = 0L;
|
hit = mess = 0L;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (xd=0; xd<dst->width; xd++) {
|
for (xd=0; xd<dst->width; xd++)
|
||||||
|
{
|
||||||
dxs = (double)xd * kx;
|
dxs = (double)xd * kx;
|
||||||
for (yd=0; yd<dst->height; yd++) {
|
for (yd=0; yd<dst->height; yd++)
|
||||||
|
{
|
||||||
rd = gd = bd = 42;
|
rd = gd = bd = 42;
|
||||||
|
|
||||||
dys = (double)yd * ky; /* kikoo lol */
|
dys = (double)yd * ky; /* kikoo lol */
|
||||||
xs = (int)dxs;
|
xs = (int)dxs;
|
||||||
ys = (int)dys;
|
ys = (int)dys;
|
||||||
|
|
||||||
if ( Image_xy_inside(src, xs, ys) ) {
|
if ( Image_xy_inside(src, xs, ys) )
|
||||||
|
{
|
||||||
Image_getRGB(src, xs, ys, &rd, &gd, &bd);
|
Image_getRGB(src, xs, ys, &rd, &gd, &bd);
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
hit++;
|
hit++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
else { mess++; }
|
else mess++;
|
||||||
#endif
|
#endif
|
||||||
Image_plotRGB(dst, xd, yd, rd, gd, bd);
|
Image_plotRGB(dst, xd, yd, rd, gd, bd);
|
||||||
}
|
}
|
||||||
@ -69,117 +67,25 @@ fprintf(stderr, "%s -> hit=%ld mess=%ld\n", __func__, hit, mess);
|
|||||||
return BAD_ZOOM;
|
return BAD_ZOOM;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
int Image_zoom_000(Image_Desc *src, Image_Desc *dst, Image_Rect *rect)
|
||||||
* Very old non-working code get an update on Thu 24 Sep 2022
|
|
||||||
*
|
|
||||||
* We have two versions:
|
|
||||||
* zoom_000 without interpolation
|
|
||||||
* zoom_001 with a pseudo bi-linear interpolation
|
|
||||||
* Public intercace:
|
|
||||||
* Image_zoom_extract(src, dst, rect, flags)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* this is a semi-private function */
|
|
||||||
|
|
||||||
int Image_zoom_000(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
|
||||||
float kx, float ky)
|
|
||||||
{
|
{
|
||||||
int xd, yd, xs, ys, r, g, b;
|
int xd, yd, r, g, b;
|
||||||
float ftmp;
|
double fxd, fyd;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, src, dst, rect);
|
fprintf(stderr, "%s ( %p %p %p )\n", __func__, src, dst, rect);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (yd=0; yd<dst->height; yd++) {
|
for (yd=0; yd<dst->height; yd++)
|
||||||
ftmp = ((float)yd) / ky;
|
|
||||||
ys = (int) (ftmp);
|
|
||||||
ys += rect->y;
|
|
||||||
/*
|
|
||||||
fprintf(stderr, " yd %5d -> %8.3f ys %5d\n", yd, ftmp, ys);
|
|
||||||
*/
|
|
||||||
for (xd=0; xd<dst->width; xd++) {
|
|
||||||
xs = (int) ((float)xd / kx);
|
|
||||||
xs += rect->x;
|
|
||||||
|
|
||||||
if ( Image_xy_inside(src, xs, ys) )
|
|
||||||
{ Image_getRGB(src, xs, ys, &r, &g, &b); }
|
|
||||||
else
|
|
||||||
{ r = g = b = 127; }
|
|
||||||
Image_plotRGB(dst, xd, yd, r, g, b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FUNC_IS_BETA;
|
|
||||||
}
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
||||||
/* */
|
|
||||||
/* nouveau Fri 23 Sep 2022 02:27:00 PM CEST */
|
|
||||||
/* this is a semi-private function */
|
|
||||||
/* */
|
|
||||||
|
|
||||||
int Image_zoom_001(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
|
||||||
float kx, float ky)
|
|
||||||
{
|
|
||||||
int xd, yd, xs, ys, r, g, b;
|
|
||||||
double dxs, dys;
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
|
||||||
fprintf(stderr, ">>> %s ( %p %p %p %.3f %.3f)\n", __func__,
|
|
||||||
src, dst, rect, kx, ky);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (yd=0; yd<dst->height; yd++) {
|
|
||||||
dys = (double)rect->y + (((double)yd) / ky);
|
|
||||||
ys = (int)dys;
|
|
||||||
for (xd=0; xd<dst->width; xd++) {
|
|
||||||
dxs = (double)rect->x + ((double)xd / kx);
|
|
||||||
xs = (int)dxs;
|
|
||||||
if ( Image_xy_inside(src, xs, ys) )
|
|
||||||
{
|
{
|
||||||
/* see 'scale.c' for this func */
|
fyd = (double)yd;
|
||||||
Image_getpix_bilin(src, dxs, dys, &r, &g, &b);
|
for (xd=0; xd<dst->height; xd++)
|
||||||
}
|
{
|
||||||
else
|
fxd = (double)xd;
|
||||||
{ r = g = b = 127; }
|
|
||||||
Image_plotRGB(dst, xd, yd, r, g, b);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FUNC_IS_BETA;
|
return FULL_NUCKED;
|
||||||
}
|
|
||||||
/*::------------------------------------------------------------------::*/
|
|
||||||
/* */
|
|
||||||
/* nouveau Fri 23 Sep 2022 02:16:55 PM CEST */
|
|
||||||
/* */
|
|
||||||
int Image_zoom_extract(Image_Desc *src, Image_Desc *dst, Image_Rect *rect,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
int foo;
|
|
||||||
float kx, ky;
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
|
||||||
fprintf(stderr, ">>> %s ( %p %p %p 0x%x)\n", __func__, src, dst, rect, flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
kx = (float)dst->width / (float)rect->w;
|
|
||||||
ky = (float)dst->height / (float)rect->h;
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
|
||||||
fprintf(stderr, " kx %8.3f ky %8.3f\n", kx, ky);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* this is ugly code ! */
|
|
||||||
if (flags)
|
|
||||||
{ foo = Image_zoom_001(src, dst, rect, kx, ky); }
|
|
||||||
else
|
|
||||||
{ foo = Image_zoom_000(src, dst, rect, kx, ky); }
|
|
||||||
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "got %d in %s\n", foo, __func__);
|
|
||||||
return foo;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FUNC_IS_ALPHA;
|
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
11
tthimage.h
11
tthimage.h
@ -4,7 +4,7 @@
|
|||||||
http:///la.buvette.org/devel/libimage/
|
http:///la.buvette.org/devel/libimage/
|
||||||
*/
|
*/
|
||||||
#ifndef IMAGE_VERSION_STRING
|
#ifndef IMAGE_VERSION_STRING
|
||||||
#define IMAGE_VERSION_STRING "0.4.51 pl 39"
|
#define IMAGE_VERSION_STRING "0.4.51 pl 32"
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
@ -1356,17 +1356,8 @@ int Image_Pool_destroy(void *ptr, char *text, int flags);
|
|||||||
int Image_quadsym_simple(Image_Desc *src, Image_Desc *dst, int mode);
|
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,
|
int Image_essai_zoom(Image_Desc *src, Image_Desc *dst,
|
||||||
double kx, double ky, int flags);
|
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 */
|
/* imprime.c */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user