.4.51 pl 28
This commit is contained in:
parent
20754c17e9
commit
dec52079cd
@ -1,9 +1,28 @@
|
|||||||
# libtthimage
|
# libtthimage
|
||||||
|
|
||||||
Les fichiers HTML que vous avez ici sont des versions historiques,
|
Les fichiers [HTML](html/) que vous avez ici sont des versions historiques,
|
||||||
qui seront peut-être mise à jour au prochain grand refactoring.
|
qui seront peut-être mise à jour au prochain grand refactoring.
|
||||||
Leur contenu est donc à prendre avec des pincettes, ymmv.
|
Leur contenu est donc à prendre avec des pincettes, ymmv.
|
||||||
|
|
||||||
Ceci dit, les principes généraux sont encore bons...
|
Ceci dit, les principes généraux sont encore bons. Mais il y a quelques
|
||||||
|
points à préciser.
|
||||||
|
|
||||||
|
## Compilation
|
||||||
|
|
||||||
|
Certaines options de compilation sont dans le fichier de
|
||||||
|
[paramètres](../Paramakes.mk) pour les différents fichiers make.
|
||||||
|
|
||||||
|
Le script [build.sh](../build.sh) tente d'automatiser les
|
||||||
|
compilations de la bibilothèque, des tests et des outils
|
||||||
|
en ligne de commande.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Le script [install.sh](../install.sh) va installer divers fichiers
|
||||||
|
aux bonnes places là où on lui dit avec la variable `DESTDIR`.
|
||||||
|
Attention, celle-ci doit être cohérente avec les valeurs déclarée
|
||||||
|
dans le fichier Paramakes.mk !
|
||||||
|
|
||||||
|
## Utilisation
|
||||||
|
|
||||||
|
???
|
||||||
|
0
Docs/html/README.md
Normal file
0
Docs/html/README.md
Normal file
@ -124,6 +124,7 @@ text1.o: text1.c $(DEPS)
|
|||||||
text16x24.o: text16x24.c $(DEPS)
|
text16x24.o: text16x24.c $(DEPS)
|
||||||
tga.o: tga.c $(DEPS)
|
tga.o: tga.c $(DEPS)
|
||||||
tools.o: tools.c $(DEPS)
|
tools.o: tools.c $(DEPS)
|
||||||
|
trigo.o: trigo.c $(DEPS)
|
||||||
turtle.o: turtle.c $(DEPS)
|
turtle.o: turtle.c $(DEPS)
|
||||||
|
|
||||||
vignetize.o: vignetize.c $(DEPS)
|
vignetize.o: vignetize.c $(DEPS)
|
||||||
@ -172,7 +173,7 @@ OBJECTS = 7seg.o \
|
|||||||
scale.o sobel4.o stereo.o \
|
scale.o sobel4.o stereo.o \
|
||||||
tamppool.o tele_2.o television.o \
|
tamppool.o tele_2.o television.o \
|
||||||
text0.o text1.o text16x24.o \
|
text0.o text1.o text16x24.o \
|
||||||
tga.o tools.o turtle.o \
|
tga.o tools.o trigo.o turtle.o \
|
||||||
vignetize.o \
|
vignetize.o \
|
||||||
warp0.o warp1.o warp2.o warp3.o \
|
warp0.o warp1.o warp2.o warp3.o \
|
||||||
zoom.o
|
zoom.o
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
/*
|
/*
|
||||||
* le paramètre 'zak' n'est pas utilisé et doit être mis à 0
|
* le paramètre 'zak' n'est pas utilisé et doit être mis à 0
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_lines(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||||
Image_combine_lines(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
|
||||||
int sy, int oy, int zak)
|
int sy, int oy, int zak)
|
||||||
{
|
{
|
||||||
int foo, x, y, my, r, g, b;
|
int foo, x, y, my, r, g, b;
|
||||||
@ -67,8 +66,7 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* le paramètre 'zak' n'est pas utilisé et doit être mis à 0
|
* le paramètre 'zak' n'est pas utilisé et doit être mis à 0
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_columns(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||||
Image_combine_columns(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
|
||||||
int sx, int ox, int zak)
|
int sx, int ox, int zak)
|
||||||
{
|
{
|
||||||
int foo, x, y, mx, r, g, b;
|
int foo, x, y, mx, r, g, b;
|
||||||
@ -116,8 +114,7 @@ return OLL_KORRECT;
|
|||||||
*
|
*
|
||||||
* 'zak' parameter is not used, and must be 0.
|
* 'zak' parameter is not used, and must be 0.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_checker(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||||
Image_combine_checker(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
|
||||||
int sx, int sy, int ox, int oy, int zak)
|
int sx, int sy, int ox, int oy, int zak)
|
||||||
{
|
{
|
||||||
int foo, r, g, b;
|
int foo, r, g, b;
|
||||||
@ -176,8 +173,7 @@ return 0;
|
|||||||
*
|
*
|
||||||
* Tiens, le parametre 'yo' ne sert a rien ?
|
* Tiens, le parametre 'yo' ne sert a rien ?
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_cercle_flou(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int yo)
|
||||||
Image_combine_cercle_flou(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int yo)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
int xcenter, ycenter;
|
int xcenter, ycenter;
|
||||||
@ -243,8 +239,7 @@ return OLL_KORRECT;
|
|||||||
* le flag 'yo' decide quelle image sera en haut à droite.
|
* le flag 'yo' decide quelle image sera en haut à droite.
|
||||||
* les paramètres p1 & p2 ne sont pas utilisés.
|
* les paramètres p1 & p2 ne sont pas utilisés.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_diagonale(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||||
Image_combine_diagonale(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
|
||||||
int yo, int p1, int p2)
|
int yo, int p1, int p2)
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
@ -305,8 +300,7 @@ return OLL_KORRECT;
|
|||||||
we put in the destination image the min/max value
|
we put in the destination image the min/max value
|
||||||
of the RGB componants.
|
of the RGB componants.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_minmax(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int flg)
|
||||||
Image_combine_minmax(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int flg)
|
|
||||||
{
|
{
|
||||||
int foo, x, y, r, g, b;
|
int foo, x, y, r, g, b;
|
||||||
int r1, r2, g1, g2, b1, b2;
|
int r1, r2, g1, g2, b1, b2;
|
||||||
@ -352,8 +346,7 @@ return OLL_KORRECT;
|
|||||||
* 6 oct 2001: une version qui permettrait de spécifier les
|
* 6 oct 2001: une version qui permettrait de spécifier les
|
||||||
* seuils en r,g et b serait assez pratique aussi.
|
* seuils en r,g et b serait assez pratique aussi.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_combine_if_not_black(Image_Desc *s1, Image_Desc *s2, Image_Desc *d)
|
||||||
Image_combine_if_not_black(Image_Desc *s1, Image_Desc *s2, Image_Desc *d)
|
|
||||||
{
|
{
|
||||||
int foo, x, y, r, g, b;
|
int foo, x, y, r, g, b;
|
||||||
|
|
||||||
@ -389,10 +382,9 @@ return FUNC_IS_BETA; /* XXX c'est pas du OLL_KORRECT ? */
|
|||||||
/*
|
/*
|
||||||
* gni ?
|
* gni ?
|
||||||
*/
|
*/
|
||||||
int
|
int Image_poke_2zones(Image_Desc *src, Image_Desc *ia, Image_Desc *ib,
|
||||||
Image_poke_2zones(Image_Desc *src, Image_Desc *ia, Image_Desc *ib,
|
|
||||||
Image_Rect *za, Image_Rect *zb,
|
Image_Rect *za, Image_Rect *zb,
|
||||||
Image_Desc *dst)
|
Image_Desc *dst)
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
/* Image_Rect rect; */
|
/* Image_Rect rect; */
|
||||||
|
102
Lib/effects.c
102
Lib/effects.c
@ -32,20 +32,17 @@ int x, y, nx, ny, r, g, b, foo;
|
|||||||
int retry;
|
int retry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(source, but)) )
|
if ( (foo=Image_compare_desc(source, but)) ) {
|
||||||
{
|
|
||||||
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 (intensite < 1)
|
if (intensite < 1) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s : bad intensity %d\n", __func__, intensite);
|
fprintf(stderr, "%s : bad intensity %d\n", __func__, intensite);
|
||||||
intensite = 1;
|
intensite = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source == but)
|
if (source == but) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s : Source & Target are the same image, bad effect expected...\n", __func__ );
|
fprintf(stderr, "%s : Source & Target are the same image, bad effect expected...\n", __func__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,13 +50,10 @@ if (source == but)
|
|||||||
retry = 0;
|
retry = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<source->width; x++)
|
for (x=0; x<source->width; x++) {
|
||||||
{
|
for (y=0; y<source->height; y++) {
|
||||||
for (y=0; y<source->height; y++)
|
|
||||||
{
|
|
||||||
foo = -1;
|
foo = -1;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
nx = x+(rand()%intensite)-(intensite/2);
|
nx = x+(rand()%intensite)-(intensite/2);
|
||||||
ny = y+(rand()%intensite)-(intensite/2);
|
ny = y+(rand()%intensite)-(intensite/2);
|
||||||
foo++;
|
foo++;
|
||||||
@ -135,54 +129,46 @@ return OLL_KORRECT;
|
|||||||
j'ai rapidement besoin de cette fonction alors je code
|
j'ai rapidement besoin de cette fonction alors je code
|
||||||
a la rache :-[ (on appelle aussi c,a le codage 123momo)
|
a la rache :-[ (on appelle aussi c,a le codage 123momo)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_mirror(Image_Desc *src, Image_Desc *dst, int reserved)
|
||||||
Image_mirror(Image_Desc *src, Image_Desc *dst, int reserved)
|
|
||||||
{
|
{
|
||||||
register int x;
|
register int x;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
int foo, largeur, y;
|
int foo, largeur, y;
|
||||||
|
|
||||||
if (reserved != 0)
|
if (reserved != 0)
|
||||||
fprintf(stderr, "Image_Mirror: reserved must be zero !\n");
|
fprintf(stderr, "%s: reserved must be zero !\n", __func__);
|
||||||
|
|
||||||
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, "Image_Mirror: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
largeur = src->width;
|
largeur = src->width;
|
||||||
|
|
||||||
if ((buffer = (uint8_t *)malloc(largeur)) == NULL)
|
if ((buffer = (uint8_t *)malloc(largeur)) == NULL) {
|
||||||
{
|
fprintf(stderr, "%s: no memory for buffer\n", __func__);
|
||||||
fprintf(stderr, "Image_Mirror: no memory for buffer");
|
|
||||||
return BUFFER_NO_MEM;
|
return BUFFER_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<src->height; y++)
|
for (y=0; y<src->height; y++) {
|
||||||
{
|
if (src->Rpix != NULL) {
|
||||||
if (src->Rpix != NULL)
|
|
||||||
{
|
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
buffer[x] = (src->Rpix[y])[x];
|
buffer[x] = (src->Rpix[y])[x];
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
(dst->Rpix[y])[x] = buffer[largeur-x-1];
|
(dst->Rpix[y])[x] = buffer[largeur-x-1];
|
||||||
}
|
}
|
||||||
if (src->Gpix != NULL)
|
if (src->Gpix != NULL) {
|
||||||
{
|
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
buffer[x] = (src->Gpix[y])[x];
|
buffer[x] = (src->Gpix[y])[x];
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
(dst->Gpix[y])[x] = buffer[largeur-x-1];
|
(dst->Gpix[y])[x] = buffer[largeur-x-1];
|
||||||
}
|
}
|
||||||
if (src->Bpix != NULL)
|
if (src->Bpix != NULL) {
|
||||||
{
|
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
buffer[x] = (src->Bpix[y])[x];
|
buffer[x] = (src->Bpix[y])[x];
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
(dst->Bpix[y])[x] = buffer[largeur-x-1];
|
(dst->Bpix[y])[x] = buffer[largeur-x-1];
|
||||||
}
|
}
|
||||||
if (src->Apix != NULL)
|
if (src->Apix != NULL) {
|
||||||
{
|
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
buffer[x] = (src->Apix[y])[x];
|
buffer[x] = (src->Apix[y])[x];
|
||||||
for (x=0; x<largeur; x++)
|
for (x=0; x<largeur; x++)
|
||||||
@ -202,19 +188,16 @@ Image_upside_down(Image_Desc *src, Image_Desc *dst, int reserved)
|
|||||||
{
|
{
|
||||||
int foo, y;
|
int foo, y;
|
||||||
|
|
||||||
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, "Image_UpsideDown: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != reserved)
|
if (0 != reserved) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s gni ?\n", __func__);
|
fprintf(stderr, "%s gni ?\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<src->height; y++)
|
for (y=0; y<src->height; y++) {
|
||||||
{
|
|
||||||
memcpy(dst->Rpix[y], src->Rpix[src->height-(y+1)], src->width);
|
memcpy(dst->Rpix[y], src->Rpix[src->height-(y+1)], src->width);
|
||||||
memcpy(dst->Gpix[y], src->Gpix[src->height-(y+1)], src->width);
|
memcpy(dst->Gpix[y], src->Gpix[src->height-(y+1)], src->width);
|
||||||
memcpy(dst->Bpix[y], src->Bpix[src->height-(y+1)], src->width);
|
memcpy(dst->Bpix[y], src->Bpix[src->height-(y+1)], src->width);
|
||||||
@ -240,8 +223,7 @@ fprintf(stderr, "Scratching %ld times %p to %p\n", nombre, source, but);
|
|||||||
|
|
||||||
Image_copy(source, but);
|
Image_copy(source, but);
|
||||||
|
|
||||||
while (nombre--)
|
while (nombre--) {
|
||||||
{
|
|
||||||
xs = rand() % source->width;
|
xs = rand() % source->width;
|
||||||
ys = rand() % source->height;
|
ys = rand() % source->height;
|
||||||
xd = rand() % source->width;
|
xd = rand() % source->width;
|
||||||
@ -261,21 +243,18 @@ Image_swap_lines( Image_Desc *src, Image_Desc * dst )
|
|||||||
{
|
{
|
||||||
int foo, line;
|
int foo, line;
|
||||||
|
|
||||||
if (src == dst)
|
if (src == dst) {
|
||||||
{
|
fprintf(stderr, "%s: SRC & DST must be different\n", __func__);
|
||||||
fprintf(stderr, "Image swap lines: SRC & DST must be different\n");
|
|
||||||
return IMG_OVERWRITE;
|
return IMG_OVERWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "%s: images have differents sizes. %d\n",
|
||||||
fprintf(stderr, "Image swap lines: images have differents sizes. %d\n",
|
__func__, foo);
|
||||||
foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (line=0; line<(src->height-1); line+=2)
|
for (line=0; line<(src->height-1); line+=2) {
|
||||||
{
|
|
||||||
memcpy(dst->Rpix[line+1], src->Rpix[line], src->width);
|
memcpy(dst->Rpix[line+1], src->Rpix[line], src->width);
|
||||||
memcpy(dst->Rpix[line], src->Rpix[line+1], src->width);
|
memcpy(dst->Rpix[line], src->Rpix[line+1], src->width);
|
||||||
memcpy(dst->Gpix[line+1], src->Gpix[line], src->width);
|
memcpy(dst->Gpix[line+1], src->Gpix[line], src->width);
|
||||||
@ -294,15 +273,13 @@ Image_swap_cols( Image_Desc *src, Image_Desc * dst )
|
|||||||
{
|
{
|
||||||
int foo, line, col, tmp, wmax;
|
int foo, line, col, tmp, wmax;
|
||||||
|
|
||||||
if (src == dst)
|
if (src == dst) {
|
||||||
{
|
fprintf(stderr, "%s: SRC & DST must be different\n", __func__);
|
||||||
fprintf(stderr, "Image_SwapCols: SRC & DST must be different\n");
|
|
||||||
return IMG_OVERWRITE;
|
return IMG_OVERWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, "Image_SwapCols: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,10 +289,8 @@ else
|
|||||||
wmax = src->width;
|
wmax = src->width;
|
||||||
fprintf(stderr, "swap cols %d %d\n", src->width, wmax);
|
fprintf(stderr, "swap cols %d %d\n", src->width, wmax);
|
||||||
|
|
||||||
for (line=0; line<src->height; line++)
|
for (line=0; line<src->height; line++) {
|
||||||
{
|
for (col=0; col<wmax; col+=2) {
|
||||||
for (col=0; col<wmax; col+=2)
|
|
||||||
{
|
|
||||||
tmp = src->Rpix[line][col];
|
tmp = src->Rpix[line][col];
|
||||||
dst->Rpix[line][col] = src->Rpix[line][col+1];
|
dst->Rpix[line][col] = src->Rpix[line][col+1];
|
||||||
dst->Rpix[line][col+1] = tmp;
|
dst->Rpix[line][col+1] = tmp;
|
||||||
@ -343,16 +318,13 @@ Image_swap_nibbles( Image_Desc *src, Image_Desc * dst )
|
|||||||
int foo;
|
int foo;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x=0; x<src->width; x++)
|
for (x=0; x<src->width; x++) {
|
||||||
{
|
for (y=0; y<src->height; y++) {
|
||||||
for (y=0; y<src->height; y++)
|
|
||||||
{
|
|
||||||
dst->Rpix[y][x] = ((src->Rpix[y][x] & 0xf0) >> 4) |
|
dst->Rpix[y][x] = ((src->Rpix[y][x] & 0xf0) >> 4) |
|
||||||
((src->Rpix[y][x] & 0x0f) << 4);
|
((src->Rpix[y][x] & 0x0f) << 4);
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
* la parametre 'table' est un tableau de 6 double. d'accord,
|
* la parametre 'table' est un tableau de 6 double. d'accord,
|
||||||
* mais quel est donc son contenu ?
|
* mais quel est donc son contenu ?
|
||||||
*/
|
*/
|
||||||
int
|
int Image_sinwave_0( Image_Desc *source, Image_Desc * but, double *table )
|
||||||
Image_sinwave_0( Image_Desc *source, Image_Desc * but, double *table )
|
|
||||||
{
|
{
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
int foo;
|
int foo;
|
||||||
@ -41,18 +40,15 @@ for (foo=0; foo<6; foo++)
|
|||||||
cx = (2.0 * M_PI) / (double)source->width;
|
cx = (2.0 * M_PI) / (double)source->width;
|
||||||
cy = (2.0 * M_PI) / (double)source->height;
|
cy = (2.0 * M_PI) / (double)source->height;
|
||||||
|
|
||||||
for (x=0; x<source->width; x++)
|
for (x=0; x<source->width; x++) {
|
||||||
{
|
|
||||||
fx = (double)x + (table[1] * sin(table[4] + (cx * table[0] * (double)x)));
|
fx = (double)x + (table[1] * sin(table[4] + (cx * table[0] * (double)x)));
|
||||||
xb = floor(fx + 0.5);
|
xb = floor(fx + 0.5);
|
||||||
|
|
||||||
for (y=0; y<source->height; y++)
|
for (y=0; y<source->height; y++) {
|
||||||
{
|
|
||||||
fy = (double)y + (table[3] * sin(table[5] + cy * table[2] * (double)y));
|
fy = (double)y + (table[3] * sin(table[5] + cy * table[2] * (double)y));
|
||||||
yb = floor(fy + 0.5);
|
yb = floor(fy + 0.5);
|
||||||
|
|
||||||
if ( xb>0 && yb>0 && xb<but->width && yb<but->height )
|
if ( xb>0 && yb>0 && xb<but->width && yb<but->height ) {
|
||||||
{
|
|
||||||
r = (source->Rpix[yb])[xb];
|
r = (source->Rpix[yb])[xb];
|
||||||
g = (source->Gpix[yb])[xb];
|
g = (source->Gpix[yb])[xb];
|
||||||
b = (source->Bpix[yb])[xb];
|
b = (source->Bpix[yb])[xb];
|
||||||
@ -61,11 +57,7 @@ for (x=0; x<source->width; x++)
|
|||||||
(but->Gpix[y])[x] = g;
|
(but->Gpix[y])[x] = g;
|
||||||
(but->Bpix[y])[x] = b;
|
(but->Bpix[y])[x] = b;
|
||||||
}
|
}
|
||||||
else
|
else { outside++; }
|
||||||
{
|
|
||||||
outside++;
|
|
||||||
/* ??? foo = Image_plotRGB(but, x, y, 0, 0, 0); */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +77,7 @@ return OLL_KORRECT;
|
|||||||
* Les parametres sont en deux groupes de 3 dans la table.
|
* Les parametres sont en deux groupes de 3 dans la table.
|
||||||
* mais franchement, j'arrive plus a savoir a quoi ils servent.
|
* mais franchement, j'arrive plus a savoir a quoi ils servent.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_sinwave_1( Image_Desc *source, Image_Desc * but, double *table )
|
||||||
Image_sinwave_1( Image_Desc *source, Image_Desc * but, double *table )
|
|
||||||
{
|
{
|
||||||
int foo, x, y, xb, yb, r, g, b;
|
int foo, x, y, xb, yb, r, g, b;
|
||||||
long outside = 0;
|
long outside = 0;
|
||||||
@ -197,7 +188,7 @@ fprintf(stderr, ">> %s ( %p %p %d %d )\n", __func__, source, but, k1, k2);
|
|||||||
fprintf(stderr, "Degouline %d %d\n", k1, k2);
|
fprintf(stderr, "Degouline %d %d\n", k1, k2);
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(source, but)) ) {
|
if ( (foo=Image_compare_desc(source, but)) ) {
|
||||||
fprintf(stderr, "Image Degouline 2: images are differents %d\n", foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
* 11 Fev 2003: que vais-je mettre ici ?
|
* 11 Fev 2003: que vais-je mettre ici ?
|
||||||
* 5 avr 2007: je commence a en avoir une idee plus precise.
|
* 5 avr 2007: je commence a en avoir une idee plus precise.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_effect_x_0(Image_Desc *src, Image_Desc *dst, int kr, int kg, int kb)
|
||||||
Image_effect_x_0(Image_Desc *src, Image_Desc *dst, int kr, int kg, int kb)
|
|
||||||
{
|
{
|
||||||
int foo, x, y, r, g, b;
|
int foo, x, y, r, g, b;
|
||||||
int cr, cg, cb;
|
int cr, cg, cb;
|
||||||
@ -30,9 +29,8 @@ int cr, cg, cb;
|
|||||||
fprintf(stderr, "*** Effect X_0: coeffs: %d %d %d\n", kr, kg, kb);
|
fprintf(stderr, "*** Effect X_0: coeffs: %d %d %d\n", kr, kg, kb);
|
||||||
#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, "Image effect x 0: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +38,10 @@ cr = cg = cb = 0; /* raz des compteurs */
|
|||||||
|
|
||||||
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++) {
|
||||||
Image_getRGB(src, x, y, &r, &g, &b);
|
/* Image_getRGB(src, x, y, &r, &g, &b); */
|
||||||
|
r = src->Rpix[y][x];
|
||||||
|
g = src->Gpix[y][x];
|
||||||
|
b = src->Bpix[y][x];
|
||||||
if (r > kr) {
|
if (r > kr) {
|
||||||
foo = g; g = b; b = foo;
|
foo = g; g = b; b = foo;
|
||||||
cr ++;
|
cr ++;
|
||||||
@ -53,11 +54,14 @@ for (y=0; y<dst->height; y++) {
|
|||||||
foo = g; g = r; r = foo;
|
foo = g; g = r; r = foo;
|
||||||
cb ++;
|
cb ++;
|
||||||
}
|
}
|
||||||
Image_plotRGB(dst, x, y, r, g, b);
|
/* Image_plotRGB(dst, x, y, r, g, b); */
|
||||||
|
dst->Rpix[y][x] = r;
|
||||||
|
dst->Gpix[y][x] = g;
|
||||||
|
dst->Bpix[y][x] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "* %s : counts: %d %d %d\n", __func__, cr, cg, cb);
|
/* fprintf(stderr, "* %s : counts: %d %d %d\n", __func__, cr, cg, cb); */
|
||||||
|
|
||||||
return FUNC_IS_BETA;
|
return FUNC_IS_BETA;
|
||||||
}
|
}
|
||||||
@ -71,16 +75,13 @@ Image_effect_x_1(Image_Desc *src, Image_Desc *dst)
|
|||||||
{
|
{
|
||||||
int foo, x, y, r, g, b;
|
int foo, x, y, r, g, b;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "I%s: images are differents %d\n", __func__, foo);
|
||||||
fprintf(stderr, "Image effect x 1: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
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];
|
||||||
@ -105,9 +106,8 @@ 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;
|
||||||
|
|
||||||
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, "Image effect x 2: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ fprintf(stderr, "*** effect x4 is not ready for prime time ***\n");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "Image effect x 4: images are differents %d\n", foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,16 +299,13 @@ fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__, src, dst,
|
|||||||
kx, ky, kz);
|
kx, ky, kz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Image effect x 5: images are differents %d\n", foo);
|
fprintf(stderr, "Image effect x 5: images are differents %d\n", foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
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];
|
||||||
@ -322,8 +319,7 @@ for (y=0; y<src->height; y++)
|
|||||||
g2 = (int)(dg2 * 255.0);
|
g2 = (int)(dg2 * 255.0);
|
||||||
b2 = (int)(db2 * 255.0);
|
b2 = (int)(db2 * 255.0);
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
if (x==42 && y==42)
|
if (x==42 && y==42) {
|
||||||
{
|
|
||||||
printf("{{{ pixels %3d %3d %3d }}}\n", r, g, b);
|
printf("{{{ pixels %3d %3d %3d }}}\n", r, g, b);
|
||||||
printf("{{{ result %3d %3d %3d }}}\n", r2, g2, b2);
|
printf("{{{ result %3d %3d %3d }}}\n", r2, g2, b2);
|
||||||
}
|
}
|
||||||
|
131
Lib/filtres.c
131
Lib/filtres.c
@ -28,8 +28,7 @@ fprintf(ou, "\t+--------------------+------------------+\n");
|
|||||||
fflush(ou);
|
fflush(ou);
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
void
|
void Image_rotate_filtre(int *m)
|
||||||
Image_rotate_filtre(int *m)
|
|
||||||
{
|
{
|
||||||
register int foo;
|
register int foo;
|
||||||
|
|
||||||
@ -44,8 +43,7 @@ m[2] = m[1];
|
|||||||
m[1] = foo;
|
m[1] = foo;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
int
|
int Image_convolueur3(Image_Desc *in, Image_Desc *out, int *mat)
|
||||||
Image_convolueur3(Image_Desc *in, Image_Desc *out, int *mat)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
@ -57,22 +55,19 @@ foo = Image_convolueur_2(in, out, mat, "rgb");
|
|||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
int
|
int Image_convolueur_2(Image_Desc *in, Image_Desc *out, int *mat, char *planes)
|
||||||
Image_convolueur_2(Image_Desc *in, Image_Desc *out, int *mat, char *planes)
|
|
||||||
{
|
{
|
||||||
int foo, x, y;
|
int foo, x, y;
|
||||||
long lval;
|
long lval;
|
||||||
int masque = 0;
|
int masque = 0;
|
||||||
|
|
||||||
if (in == out)
|
if (in == out) {
|
||||||
{
|
fprintf(stderr, "%s: out overwrite in.\n", __func__);
|
||||||
fprintf(stderr, "convolueur 2: out overwrite in.\n");
|
|
||||||
return IMG_OVERWRITE;
|
return IMG_OVERWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(in, out)) )
|
if ( (foo=Image_compare_desc(in, out)) ) {
|
||||||
{
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
fprintf(stderr, "Convolueur: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,9 +80,8 @@ Image_dump_descriptor(out, "image de sortie convolueur");
|
|||||||
Image_filtre_display(stdout, mat);
|
Image_filtre_display(stdout, mat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mat[9] == 0)
|
if (mat[9] == 0) {
|
||||||
{
|
fprintf(stderr, "%s: fsck, divisor is ZERO !\n", __func__);
|
||||||
fprintf(stderr, "Convolueur: fuck, divisor is ZERO !\n");
|
|
||||||
/*
|
/*
|
||||||
! c'est sur, avec un message comme c,a je vais pas
|
! c'est sur, avec un message comme c,a je vais pas
|
||||||
! pouvoir transmettre mon code aux australiens
|
! pouvoir transmettre mon code aux australiens
|
||||||
@ -99,10 +93,8 @@ if (mat[9] == 0)
|
|||||||
/*
|
/*
|
||||||
* preparation of the binary mask from the parameter string
|
* preparation of the binary mask from the parameter string
|
||||||
*/
|
*/
|
||||||
for (foo=0; foo<(int)strlen(planes); foo++)
|
for (foo=0; foo<(int)strlen(planes); foo++) {
|
||||||
{
|
switch (planes[foo]) {
|
||||||
switch (planes[foo])
|
|
||||||
{
|
|
||||||
case 'r': case 'R':
|
case 'r': case 'R':
|
||||||
masque |= 8;
|
masque |= 8;
|
||||||
break;
|
break;
|
||||||
@ -122,18 +114,14 @@ for (foo=0; foo<(int)strlen(planes); foo++)
|
|||||||
printf("masque convolueur = %02x\n", masque);
|
printf("masque convolueur = %02x\n", masque);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (masque & 1) && (in->Apix == NULL) )
|
if ( (masque & 1) && (in->Apix == NULL) ) {
|
||||||
{
|
fprintf(stderr, "%s: filtering NULL alpha plane is _bad_\n", __func__);
|
||||||
fprintf(stderr, "Convolueur2: filtering NULL alpha plane is _bad_\n");
|
|
||||||
return WRONG_CHANNEL;
|
return WRONG_CHANNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=1; y<((in->height)-1); y++)
|
for (y=1; y<((in->height)-1); y++) {
|
||||||
{
|
for (x=1; x<((in->width)-1); x++) {
|
||||||
for (x=1; x<((in->width)-1); x++)
|
if (masque & 8) {
|
||||||
{
|
|
||||||
if (masque & 8)
|
|
||||||
{
|
|
||||||
lval = mat[0] * in->Rpix[y-1][x-1] +
|
lval = mat[0] * in->Rpix[y-1][x-1] +
|
||||||
mat[1] * in->Rpix[y-1][x] +
|
mat[1] * in->Rpix[y-1][x] +
|
||||||
mat[2] * in->Rpix[y-1][x+1] +
|
mat[2] * in->Rpix[y-1][x+1] +
|
||||||
@ -150,8 +138,7 @@ for (y=1; y<((in->height)-1); y++)
|
|||||||
out->Rpix[y][x] = (uint8_t)lval;
|
out->Rpix[y][x] = (uint8_t)lval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masque & 4)
|
if (masque & 4) {
|
||||||
{
|
|
||||||
lval = mat[0] * in->Gpix[y-1][x-1] +
|
lval = mat[0] * in->Gpix[y-1][x-1] +
|
||||||
mat[1] * in->Gpix[y-1][x] +
|
mat[1] * in->Gpix[y-1][x] +
|
||||||
mat[2] * in->Gpix[y-1][x+1] +
|
mat[2] * in->Gpix[y-1][x+1] +
|
||||||
@ -168,8 +155,7 @@ for (y=1; y<((in->height)-1); y++)
|
|||||||
out->Gpix[y][x] = (uint8_t)lval;
|
out->Gpix[y][x] = (uint8_t)lval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masque & 2)
|
if (masque & 2) {
|
||||||
{
|
|
||||||
lval = mat[0] * in->Bpix[y-1][x-1] +
|
lval = mat[0] * in->Bpix[y-1][x-1] +
|
||||||
mat[1] * in->Bpix[y-1][x] +
|
mat[1] * in->Bpix[y-1][x] +
|
||||||
mat[2] * in->Bpix[y-1][x+1] +
|
mat[2] * in->Bpix[y-1][x+1] +
|
||||||
@ -186,8 +172,7 @@ for (y=1; y<((in->height)-1); y++)
|
|||||||
out->Bpix[y][x] = (uint8_t)lval;
|
out->Bpix[y][x] = (uint8_t)lval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masque & 1)
|
if (masque & 1) {
|
||||||
{
|
|
||||||
lval = mat[0] * in->Apix[y-1][x-1] +
|
lval = mat[0] * in->Apix[y-1][x-1] +
|
||||||
mat[1] * in->Apix[y-1][x] +
|
mat[1] * in->Apix[y-1][x] +
|
||||||
mat[2] * in->Apix[y-1][x+1] +
|
mat[2] * in->Apix[y-1][x+1] +
|
||||||
@ -211,13 +196,11 @@ out->modified = 1;
|
|||||||
return OLL_KORRECT;
|
return OLL_KORRECT;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
int
|
int Image_raz_sides(Image_Desc *im)
|
||||||
Image_raz_sides(Image_Desc *im)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
for (foo=0; foo<im->width; foo++)
|
for (foo=0; foo<im->width; foo++) {
|
||||||
{
|
|
||||||
(im->Rpix[0])[foo] = 0;
|
(im->Rpix[0])[foo] = 0;
|
||||||
(im->Gpix[0])[foo] = 0;
|
(im->Gpix[0])[foo] = 0;
|
||||||
(im->Bpix[0])[foo] = 0;
|
(im->Bpix[0])[foo] = 0;
|
||||||
@ -226,8 +209,7 @@ for (foo=0; foo<im->width; foo++)
|
|||||||
(im->Bpix[im->height-1])[foo] = 0;
|
(im->Bpix[im->height-1])[foo] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (foo=0; foo<im->height; foo++)
|
for (foo=0; foo<im->height; foo++) {
|
||||||
{
|
|
||||||
(im->Rpix[foo])[0] = 0;
|
(im->Rpix[foo])[0] = 0;
|
||||||
(im->Gpix[foo])[0] = 0;
|
(im->Gpix[foo])[0] = 0;
|
||||||
(im->Bpix[foo])[0] = 0;
|
(im->Bpix[foo])[0] = 0;
|
||||||
@ -243,27 +225,22 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* Arf, le grand classique :)
|
* Arf, le grand classique :)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_lissage_3x3(Image_Desc *in, Image_Desc *out)
|
||||||
Image_lissage_3x3(Image_Desc *in, Image_Desc *out)
|
|
||||||
{
|
{
|
||||||
int foo, x, y;
|
int foo, x, y;
|
||||||
|
|
||||||
if (in == out)
|
if (in == out) {
|
||||||
{
|
fprintf(stderr, "%s: out overwrite in\n", __func__);
|
||||||
fprintf(stderr, "Lissage 3x3: out overwrite in\n");
|
|
||||||
return IMG_OVERWRITE;
|
return IMG_OVERWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(in, out)) )
|
if ( (foo=Image_compare_desc(in, out)) ) {
|
||||||
{
|
fprintf(stderr, "%s: images have differents size, %d\n", __func__, foo);
|
||||||
fprintf(stderr, "Lissage 3x3: images have differents size, %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=1; y<((in->height)-1); y++)
|
for (y=1; y<((in->height)-1); y++) {
|
||||||
{
|
for (x=1; x<((in->width)-1); x++) {
|
||||||
for (x=1; x<((in->width)-1); x++)
|
|
||||||
{
|
|
||||||
|
|
||||||
foo = in->Rpix[y-1][x-1] + in->Rpix[y-1][x] + in->Rpix[y-1][x+1] +
|
foo = in->Rpix[y-1][x-1] + in->Rpix[y-1][x] + in->Rpix[y-1][x+1] +
|
||||||
in->Rpix[y] [x-1] + in->Rpix[y] [x] + in->Rpix[y] [x+1] +
|
in->Rpix[y] [x-1] + in->Rpix[y] [x] + in->Rpix[y] [x+1] +
|
||||||
@ -292,11 +269,9 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* new 14 Jan 2000
|
* new 14 Jan 2000
|
||||||
*/
|
*/
|
||||||
int
|
int Image_filtre_Prewitt(Image_Desc *src, Image_Desc *dst, int rotation)
|
||||||
Image_filtre_Prewitt(Image_Desc *src, Image_Desc *dst, int rotation)
|
|
||||||
{
|
{
|
||||||
static int Prewitt[] =
|
static int Prewitt[] = {
|
||||||
{
|
|
||||||
1, 1, 1,
|
1, 1, 1,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
-1, -1, -1,
|
-1, -1, -1,
|
||||||
@ -318,11 +293,9 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* XXX cette fonction est incorrecte XXX
|
* XXX cette fonction est incorrecte XXX
|
||||||
*/
|
*/
|
||||||
int
|
int Image_filtre_Sobel(Image_Desc *src, Image_Desc *dst, int rotation)
|
||||||
Image_filtre_Sobel(Image_Desc *src, Image_Desc *dst, int rotation)
|
|
||||||
{
|
{
|
||||||
static int Sobel[] =
|
static int Sobel[] = {
|
||||||
{
|
|
||||||
1, 2, 1,
|
1, 2, 1,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
-1, -2, -1,
|
-1, -2, -1,
|
||||||
@ -343,13 +316,11 @@ return OLL_KORRECT;
|
|||||||
* Voir aussi 'sobel4.c' */
|
* Voir aussi 'sobel4.c' */
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 15 Jan 2000 */
|
/* new 15 Jan 2000 */
|
||||||
int
|
int Image_filtre_passe_bas(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_filtre_passe_bas(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
static int PasseBas[] =
|
static int PasseBas[] = {
|
||||||
{
|
|
||||||
1, 2, 1,
|
1, 2, 1,
|
||||||
2, 4, 2,
|
2, 4, 2,
|
||||||
1, 2, 1,
|
1, 2, 1,
|
||||||
@ -363,14 +334,12 @@ return foo;
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* nouveau: 18 Janvier 2001
|
/* nouveau: 18 Janvier 2001
|
||||||
moral à zéro, il faut que je fasse pédaler le 486 ! */
|
moral à zéro, il faut que je fasse pédaler le 486 ! */
|
||||||
int
|
int Image_filtre_random(Image_Desc *src, Image_Desc *dst, int p1, int p2)
|
||||||
Image_filtre_random(Image_Desc *src, Image_Desc *dst, int p1, int p2)
|
|
||||||
{
|
{
|
||||||
int filtre[11];
|
int filtre[11];
|
||||||
int foo, somme, v, delta;
|
int foo, somme, v, delta;
|
||||||
|
|
||||||
if (p1 == p2)
|
if (p1 == p2) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: p1=%d must be different from p2=%d\n",
|
fprintf(stderr, "%s: p1=%d must be different from p2=%d\n",
|
||||||
__func__, p1, p2);
|
__func__, p1, p2);
|
||||||
return INVALID_PARAM;
|
return INVALID_PARAM;
|
||||||
@ -383,8 +352,7 @@ delta = abs(p2 - p1);
|
|||||||
fprintf(stderr, "%s: delta is %d\n", __func__, delta);
|
fprintf(stderr, "%s: delta is %d\n", __func__, delta);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (foo=0; foo<9; foo++)
|
for (foo=0; foo<9; foo++) {
|
||||||
{
|
|
||||||
v = (rand()%delta)+p1;
|
v = (rand()%delta)+p1;
|
||||||
filtre[foo] = v;
|
filtre[foo] = v;
|
||||||
somme += v;
|
somme += v;
|
||||||
@ -405,15 +373,14 @@ return FUNC_IS_BETA;
|
|||||||
/* nouveau: 3 Fevrier 2001
|
/* nouveau: 3 Fevrier 2001
|
||||||
on s'inspire de la precedente.
|
on s'inspire de la precedente.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_filtre_random_2(Image_Desc *src, Image_Desc *dst,
|
||||||
Image_filtre_random_2(Image_Desc *src, Image_Desc *dst,
|
|
||||||
int p1, int p2, int p3, int p4)
|
int p1, int p2, int p3, int p4)
|
||||||
{
|
{
|
||||||
int filtre[11];
|
int filtre[11];
|
||||||
int foo, somme, v, delta, deltb;
|
int foo, somme, v, delta, deltb;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "Filtre Random 2: %d %d / %d %d\n", p1, p2, p3, p4);
|
fprintf(stderr, "%s: %d %d / %d %d\n", __func__, p1, p2, p3, p4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delta = abs(p2 - p1);
|
delta = abs(p2 - p1);
|
||||||
@ -423,22 +390,18 @@ fprintf(stderr, "Filtre Random 2: delta are %d %d\n", delta, deltb);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
somme = 0;
|
somme = 0;
|
||||||
for (foo=0; foo<9; foo++)
|
for (foo=0; foo<9; foo++) {
|
||||||
{
|
if (foo != 4) {
|
||||||
if (foo != 4)
|
|
||||||
{
|
|
||||||
v = (rand()%delta)+p1;
|
v = (rand()%delta)+p1;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
v = (rand()%deltb)+p3;
|
v = (rand()%deltb)+p3;
|
||||||
}
|
}
|
||||||
filtre[foo] = v;
|
filtre[foo] = v;
|
||||||
|
|
||||||
somme += v;
|
somme += v;
|
||||||
}
|
}
|
||||||
|
|
||||||
filtre[9] = somme;
|
filtre[9] = somme;
|
||||||
filtre[10] = 0; /* XXX calcul automatique a faire ! */
|
filtre[10] = 0; /* XXX calcul automatique a faire ! */
|
||||||
|
|
||||||
Image_filtre_display(stdout, filtre);
|
Image_filtre_display(stdout, filtre);
|
||||||
@ -448,12 +411,10 @@ foo = Image_convolueur_2(src, dst, filtre, "rgb");
|
|||||||
return FUNC_IS_BETA;
|
return FUNC_IS_BETA;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
int
|
int Image_filtre_passe_haut(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_filtre_passe_haut(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
static int PasseHaut[] =
|
static int PasseHaut[] = {
|
||||||
{
|
|
||||||
-1, -1, -1,
|
-1, -1, -1,
|
||||||
-1, 8, -1,
|
-1, 8, -1,
|
||||||
-1, -1, -1,
|
-1, -1, -1,
|
||||||
|
@ -124,6 +124,9 @@ for (nbre=0; nbre<k; nbre++)
|
|||||||
for (v=y; v<src->height; v++)
|
for (v=y; v<src->height; v++)
|
||||||
Image_plotRGB(dst, x, v, r, g, b);
|
Image_plotRGB(dst, x, v, r, g, b);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "blurg in %s\n", __func__);
|
||||||
|
return PASTIS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
Lib/image.c
17
Lib/image.c
@ -487,19 +487,16 @@ return (int)((img->Apix[y])[x]);
|
|||||||
cette fonction ne marche que si les deux images
|
cette fonction ne marche que si les deux images
|
||||||
sont allouees et de meme dimensions.
|
sont allouees et de meme dimensions.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_copy(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_copy(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
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, "Image_Copy: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (foo=0; foo<src->height; foo++)
|
for (foo=0; foo<src->height; foo++) {
|
||||||
{
|
|
||||||
memcpy(dst->Rpix[foo], src->Rpix[foo], src->width);
|
memcpy(dst->Rpix[foo], src->Rpix[foo], src->width);
|
||||||
memcpy(dst->Gpix[foo], src->Gpix[foo], src->width);
|
memcpy(dst->Gpix[foo], src->Gpix[foo], src->width);
|
||||||
memcpy(dst->Bpix[foo], src->Bpix[foo], src->width);
|
memcpy(dst->Bpix[foo], src->Bpix[foo], src->width);
|
||||||
@ -523,8 +520,7 @@ return 0;
|
|||||||
/*
|
/*
|
||||||
* no boundary control ?
|
* no boundary control ?
|
||||||
*/
|
*/
|
||||||
int
|
int Image_pixel_copy(Image_Desc *s, int x, int y, Image_Desc *d, int i, int j)
|
||||||
Image_pixel_copy(Image_Desc *s, int x, int y, Image_Desc *d, int i, int j)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
(d->Rpix[j])[i] = (s->Rpix[y])[x];
|
(d->Rpix[j])[i] = (s->Rpix[y])[x];
|
||||||
@ -538,8 +534,7 @@ return OLL_KORRECT;
|
|||||||
* Le nom de cette fonction n'a pas trop de rapport avec ce qu'elle fait,
|
* Le nom de cette fonction n'a pas trop de rapport avec ce qu'elle fait,
|
||||||
* mais elle permet de faire reculer Crash Coredump.
|
* mais elle permet de faire reculer Crash Coredump.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_compare_desc(Image_Desc *a, Image_Desc *b)
|
||||||
Image_compare_desc(Image_Desc *a, Image_Desc *b)
|
|
||||||
{
|
{
|
||||||
char *fmt = "Image at %p have no 'Dead Beef' in it\n";
|
char *fmt = "Image at %p have no 'Dead Beef' in it\n";
|
||||||
|
|
||||||
|
19
Lib/msglib.c
19
Lib/msglib.c
@ -9,13 +9,11 @@
|
|||||||
#include "../tthimage.h"
|
#include "../tthimage.h"
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
char *
|
char * Image_type2str(int type)
|
||||||
Image_type2str(int type)
|
|
||||||
{
|
{
|
||||||
char *pstr;
|
char *pstr;
|
||||||
|
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case IMAGE_RGB: pstr = "RGB"; break;
|
case IMAGE_RGB: pstr = "RGB"; break;
|
||||||
case IMAGE_RGBA: pstr = "RGBA"; break;
|
case IMAGE_RGBA: pstr = "RGBA"; break;
|
||||||
case IMAGE_GRAY: pstr = "Gray"; break;
|
case IMAGE_GRAY: pstr = "Gray"; break;
|
||||||
@ -29,14 +27,12 @@ switch (type)
|
|||||||
return pstr;
|
return pstr;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
char *
|
char * Image_err2str(int codeerr)
|
||||||
Image_err2str(int codeerr)
|
|
||||||
{
|
{
|
||||||
char *pstr;
|
char *pstr;
|
||||||
static char chaine[100];
|
static char chaine[100];
|
||||||
|
|
||||||
switch (codeerr)
|
switch (codeerr) {
|
||||||
{
|
|
||||||
case -1: pstr = "error: invalid error"; break;
|
case -1: pstr = "error: invalid error"; break;
|
||||||
case OLL_KORRECT: pstr = "no error"; break;
|
case OLL_KORRECT: pstr = "no error"; break;
|
||||||
case 42: pstr = "Universal answer"; break;
|
case 42: pstr = "Universal answer"; break;
|
||||||
@ -114,7 +110,8 @@ switch (codeerr)
|
|||||||
sprintf(chaine, "error code %d is unknow", codeerr);
|
sprintf(chaine, "error code %d is unknow", codeerr);
|
||||||
pstr = chaine;
|
pstr = chaine;
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "* WTF ? Error %d unknow ?\n", codeerr);
|
fprintf(stderr, "%s: WTF ? Error %d unknow ?\n",
|
||||||
|
__func__, codeerr);
|
||||||
#if FORCE_ABORT
|
#if FORCE_ABORT
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
@ -125,8 +122,7 @@ return pstr;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 14 Feb 2000 */
|
/* new 14 Feb 2000 */
|
||||||
void
|
void Image_print_error(char * texte, int err)
|
||||||
Image_print_error(char * texte, int err)
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *errtxt;
|
char *errtxt;
|
||||||
@ -145,4 +141,3 @@ fprintf(fp, "%s '%s': %d, %s\n", err ? "Error :" : "Waouh !",
|
|||||||
fflush(fp);
|
fflush(fp);
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
|
||||||
|
73
Lib/op2x2.c
73
Lib/op2x2.c
@ -13,12 +13,10 @@
|
|||||||
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
||||||
* 27 Juillet 2008: on attend toujours...
|
* 27 Juillet 2008: on attend toujours...
|
||||||
*/
|
*/
|
||||||
int
|
int Image_2x2_contours_0(Image_Desc *im)
|
||||||
Image_2x2_contours_0(Image_Desc *im)
|
|
||||||
{
|
{
|
||||||
int x, y, q;
|
int x, y, q;
|
||||||
int tbl[] =
|
int tbl[] = {
|
||||||
{
|
|
||||||
0, 1, 1, 1,
|
0, 1, 1, 1,
|
||||||
1, 1, 0, 1,
|
1, 1, 0, 1,
|
||||||
1, 0, 1, 1,
|
1, 0, 1, 1,
|
||||||
@ -29,10 +27,8 @@ int tbl[] =
|
|||||||
fprintf(stderr, "%s : w=%d h=%d\n", __func__, im->width, im->height);
|
fprintf(stderr, "%s : w=%d h=%d\n", __func__, im->width, im->height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (x=0; x<(im->width-1); x++)
|
for (x=0; x<(im->width-1); x++) {
|
||||||
{
|
for (y=0; y<(im->height-1); y++) {
|
||||||
for (y=0; y<(im->height-1); y++)
|
|
||||||
{
|
|
||||||
q = ((im->Rpix[y] [x] ? 0 : 1) << 3 ) |
|
q = ((im->Rpix[y] [x] ? 0 : 1) << 3 ) |
|
||||||
((im->Rpix[y] [x+1] ? 0 : 1) << 2 ) |
|
((im->Rpix[y] [x+1] ? 0 : 1) << 2 ) |
|
||||||
((im->Rpix[y+1][x] ? 0 : 1) << 1 ) |
|
((im->Rpix[y+1][x] ? 0 : 1) << 1 ) |
|
||||||
@ -58,14 +54,13 @@ return OLL_KORRECT;
|
|||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* updated 31 august 2008 */
|
/* updated 31 august 2008 */
|
||||||
/* le seul bit utilise dans l'image source est le bit 7 */
|
/* le seul bit utilise dans l'image source est le bit 7 */
|
||||||
int
|
int Image_2x2_contours_1(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_2x2_contours_1(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
int x, y, q;
|
int x, y, q;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "%s: err compare %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
@ -73,10 +68,8 @@ fprintf(stderr, "*** %s *** catastrophic function :)\n", __func__);
|
|||||||
#endif
|
#endif
|
||||||
Image_clear(dst, 0, 0, 0);
|
Image_clear(dst, 0, 0, 0);
|
||||||
|
|
||||||
for (x=0; x<(src->width-1); x++)
|
for (x=0; x<(src->width-1); x++) {
|
||||||
{
|
for (y=0; y<(src->height-1); y++) {
|
||||||
for (y=0; y<(src->height-1); y++)
|
|
||||||
{
|
|
||||||
q = ((0x80 & (src->Rpix[y] [x] ) ? 0 : 1) << 3 ) |
|
q = ((0x80 & (src->Rpix[y] [x] ) ? 0 : 1) << 3 ) |
|
||||||
((0x80 & (src->Rpix[y] [x+1]) ? 0 : 1) << 2 ) |
|
((0x80 & (src->Rpix[y] [x+1]) ? 0 : 1) << 2 ) |
|
||||||
((0x80 & (src->Rpix[y+1][x] ) ? 0 : 1) << 1 ) |
|
((0x80 & (src->Rpix[y+1][x] ) ? 0 : 1) << 1 ) |
|
||||||
@ -101,8 +94,7 @@ return FUNC_IS_BETA;
|
|||||||
/*
|
/*
|
||||||
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
||||||
*/
|
*/
|
||||||
int
|
int Image_2x2_contrast(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_2x2_contrast(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo, x, y, r, g, b;
|
int foo, x, y, r, g, b;
|
||||||
int mir, mig, mib, mar, mag, mab;
|
int mir, mig, mib, mar, mag, mab;
|
||||||
@ -110,19 +102,16 @@ int mir, mig, mib, mar, mag, mab;
|
|||||||
int dx[4] = { 0, 1, 0, 1 };
|
int dx[4] = { 0, 1, 0, 1 };
|
||||||
int dy[4] = { 0, 0, 1, 1 };
|
int dy[4] = { 0, 0, 1, 1 };
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "%s: err compare %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<src->height-1; y++)
|
for (y=0; y<src->height-1; y++) {
|
||||||
{
|
for (x=0; x<src->width-1; x++) {
|
||||||
for (x=0; x<src->width-1; x++)
|
|
||||||
{
|
|
||||||
mir = mig = mib = 342;
|
mir = mig = mib = 342;
|
||||||
mar = mag = mab = -42;
|
mar = mag = mab = -42;
|
||||||
for (foo=0; foo<4; foo++)
|
for (foo=0; foo<4; foo++) {
|
||||||
{
|
|
||||||
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
||||||
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
||||||
b = (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
b = (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
||||||
@ -148,8 +137,7 @@ return FUNC_IS_BETA;
|
|||||||
/*
|
/*
|
||||||
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
* 6 Fev 2001: on aimerait bien avoir la doc de cette fonction
|
||||||
*/
|
*/
|
||||||
int
|
int Image_2x2_lissage(Image_Desc *src, Image_Desc *dst)
|
||||||
Image_2x2_lissage(Image_Desc *src, Image_Desc *dst)
|
|
||||||
{
|
{
|
||||||
int foo, x, y;
|
int foo, x, y;
|
||||||
int tir, tig, tib;
|
int tir, tig, tib;
|
||||||
@ -157,8 +145,8 @@ int tir, tig, tib;
|
|||||||
int dx[4] = { 0, 1, 0, 1 };
|
int dx[4] = { 0, 1, 0, 1 };
|
||||||
int dy[4] = { 0, 0, 1, 1 };
|
int dy[4] = { 0, 0, 1, 1 };
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "%s: err compare %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,13 +154,10 @@ if ( (foo=Image_compare_desc(src, dst)) )
|
|||||||
* attention, il faut bien reflechir avant de tenter d'inverser l'ordre
|
* attention, il faut bien reflechir avant de tenter d'inverser l'ordre
|
||||||
* de parcours en ligne & colonne !
|
* de parcours en ligne & colonne !
|
||||||
*/
|
*/
|
||||||
for (y=0; y<src->height-1; y++)
|
for (y=0; y<src->height-1; y++) {
|
||||||
{
|
for (x=0; x<src->width-1; x++) {
|
||||||
for (x=0; x<src->width-1; x++)
|
|
||||||
{
|
|
||||||
tir = tig = tib = 0;
|
tir = tig = tib = 0;
|
||||||
for (foo=0; foo<4; foo++)
|
for (foo=0; foo<4; foo++) {
|
||||||
{
|
|
||||||
tir += (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
tir += (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
||||||
tig += (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
tig += (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
||||||
tib += (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
tib += (src->Bpix[y+dy[foo]])[x+dx[foo]];
|
||||||
@ -189,20 +174,16 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* 8 Feb 2001: another kludge (without doc)
|
* 8 Feb 2001: another kludge (without doc)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_2x2_rot4pix(Image_Desc *src, Image_Desc *dst, int rot)
|
||||||
Image_2x2_rot4pix(Image_Desc *src, Image_Desc *dst, int rot)
|
|
||||||
{
|
{
|
||||||
int x, y, foo, bar, r, g, b;
|
int x, y, foo, bar, r, g, b;
|
||||||
|
|
||||||
int dx[4] = { 0, 1, 0, 1 };
|
int dx[4] = { 0, 1, 0, 1 };
|
||||||
int dy[4] = { 0, 0, 1, 1 };
|
int dy[4] = { 0, 0, 1, 1 };
|
||||||
|
|
||||||
for (y=0; y<src->height-1; y+=2)
|
for (y=0; y<src->height-1; y+=2) {
|
||||||
{
|
for (x=0; x<src->width-1; x+=2) {
|
||||||
for (x=0; x<src->width-1; x+=2)
|
for (foo=0; foo<4; foo++) {
|
||||||
{
|
|
||||||
for (foo=0; foo<4; foo++)
|
|
||||||
{
|
|
||||||
bar = (foo+rot)%4;
|
bar = (foo+rot)%4;
|
||||||
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
r = (src->Rpix[y+dy[foo]])[x+dx[foo]];
|
||||||
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
g = (src->Gpix[y+dy[foo]])[x+dx[foo]];
|
||||||
@ -225,8 +206,8 @@ int foo;
|
|||||||
fprintf(stderr, "this func (%s) is a kluge\n", __func__);
|
fprintf(stderr, "this func (%s) is a kluge\n", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
fprintf(stderr, "%s: err compare %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
Lib/operat.c
83
Lib/operat.c
@ -26,8 +26,7 @@
|
|||||||
/*
|
/*
|
||||||
* XXX il y a un "Zero Divide" cache dans cette fonction !
|
* XXX il y a un "Zero Divide" cache dans cette fonction !
|
||||||
*/
|
*/
|
||||||
int
|
int Image_adjust_minmax_0(Image_Desc *src, Image_Desc *dst, int yo,
|
||||||
Image_adjust_minmax_0(Image_Desc *src, Image_Desc *dst, int yo,
|
|
||||||
int minstone, int maxstone)
|
int minstone, int maxstone)
|
||||||
{
|
{
|
||||||
long histR[256], histG[256], histB[256];
|
long histR[256], histG[256], histB[256];
|
||||||
@ -36,8 +35,7 @@ int foo;
|
|||||||
long mini, maxi, kmini, kmaxi, delta;
|
long mini, maxi, kmini, kmaxi, delta;
|
||||||
int idxmini, idxmaxi, val, lut[256], level;
|
int idxmini, idxmaxi, val, lut[256], level;
|
||||||
|
|
||||||
if (yo != 0)
|
if (yo != 0) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Yo is %d\n", yo);
|
fprintf(stderr, "Yo is %d\n", yo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +56,9 @@ fprintf(stderr, " K maxi = %ld\n", kmaxi);
|
|||||||
|
|
||||||
mini = 0;
|
mini = 0;
|
||||||
idxmini = 0;
|
idxmini = 0;
|
||||||
for (foo=0; foo<256; foo++)
|
for (foo=0; foo<256; foo++) {
|
||||||
{
|
|
||||||
mini += (histR[foo] + histG[foo] + histB[foo]);
|
mini += (histR[foo] + histG[foo] + histB[foo]);
|
||||||
if (mini > kmini)
|
if (mini > kmini) {
|
||||||
{
|
|
||||||
fprintf(stderr, "MINI %3d %ld\n", foo, mini);
|
fprintf(stderr, "MINI %3d %ld\n", foo, mini);
|
||||||
idxmini = foo;
|
idxmini = foo;
|
||||||
break;
|
break;
|
||||||
@ -71,11 +67,9 @@ for (foo=0; foo<256; foo++)
|
|||||||
|
|
||||||
maxi = 0;
|
maxi = 0;
|
||||||
idxmaxi = 255;
|
idxmaxi = 255;
|
||||||
for (foo=255; foo>=0; foo--)
|
for (foo=255; foo>=0; foo--) {
|
||||||
{
|
|
||||||
maxi += (histR[foo] + histG[foo] + histB[foo]);
|
maxi += (histR[foo] + histG[foo] + histB[foo]);
|
||||||
if (maxi > kmaxi)
|
if (maxi > kmaxi) {
|
||||||
{
|
|
||||||
fprintf(stderr, "MAXI %3d %ld\n", foo, maxi);
|
fprintf(stderr, "MAXI %3d %ld\n", foo, maxi);
|
||||||
idxmaxi = foo;
|
idxmaxi = foo;
|
||||||
break;
|
break;
|
||||||
@ -87,8 +81,7 @@ fprintf(stderr, "idxmini=%d idxmaxi=%d delta=%ld\n", idxmini, idxmaxi, delta);
|
|||||||
|
|
||||||
for (foo=0; foo<idxmini; foo++) lut[foo] = 0;
|
for (foo=0; foo<idxmini; foo++) lut[foo] = 0;
|
||||||
level = 0;
|
level = 0;
|
||||||
for (foo=idxmini; foo<=idxmaxi; foo++)
|
for (foo=idxmini; foo<=idxmaxi; foo++) {
|
||||||
{
|
|
||||||
val = (level*255) / delta;
|
val = (level*255) / delta;
|
||||||
lut[foo] = val;
|
lut[foo] = val;
|
||||||
level++;
|
level++;
|
||||||
@ -110,27 +103,24 @@ return FUNC_IS_BETA;
|
|||||||
* et une fonction de plus ecrite a la rache, avec un nom qui
|
* et une fonction de plus ecrite a la rache, avec un nom qui
|
||||||
* ne veut probablement rien dire :)
|
* ne veut probablement rien dire :)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_luminance(Image_Desc *src, Image_Desc *dst, int factor)
|
||||||
Image_luminance(Image_Desc *src, Image_Desc *dst, int factor)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "%s ( %p %p %d )\n", __func__, src, dst, factor);
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, factor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
|
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "Image Luminance: images are differents %d\n", foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
dst->Rpix[y][x] = (src->Rpix[y][x] * factor) / 256;
|
dst->Rpix[y][x] = (src->Rpix[y][x] * factor) / 256;
|
||||||
dst->Gpix[y][x] = (src->Gpix[y][x] * factor) / 256;
|
dst->Gpix[y][x] = (src->Gpix[y][x] * factor) / 256;
|
||||||
dst->Bpix[y][x] = (src->Bpix[y][x] * factor) / 256;
|
dst->Bpix[y][x] = (src->Bpix[y][x] * factor) / 256;
|
||||||
@ -156,8 +146,7 @@ return FUNC_IS_BETA;
|
|||||||
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
|
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
|
||||||
le parametre 'yoyo' n'est pas utilise actuellement.
|
le parametre 'yoyo' n'est pas utilise actuellement.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_egalise_RGB(Image_Desc *src, Image_Desc *dst, int yoyo)
|
||||||
Image_egalise_RGB(Image_Desc *src, Image_Desc *dst, int yoyo)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
long *histr, *histg, *histb;
|
long *histr, *histg, *histb;
|
||||||
@ -201,8 +190,7 @@ for (foo=0; foo<256; foo++) {
|
|||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "* histo RGB: cumuls: %d %d %d surface: %ld\n",
|
fprintf(stderr, "* histo RGB: cumuls: %d %d %d surface: %ld\n",
|
||||||
cumlr[255], cumlg[255], cumlb[255], s);
|
cumlr[255], cumlg[255], cumlb[255], s);
|
||||||
for (foo=0; foo<256; foo++)
|
for (foo=0; foo<256; foo++) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%3d | %7ld %7ld %7ld | %7d %7d %7d\n",
|
fprintf(stderr, "%3d | %7ld %7ld %7ld | %7d %7d %7d\n",
|
||||||
foo,
|
foo,
|
||||||
histr[foo], histg[foo], histb[foo],
|
histr[foo], histg[foo], histb[foo],
|
||||||
@ -223,17 +211,15 @@ return 0;
|
|||||||
|
|
||||||
le parametre 'yoyo' n'est pas utilise actuellement.
|
le parametre 'yoyo' n'est pas utilise actuellement.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_egalise_mono_0(Image_Desc *src, Image_Desc *dst, int yoyo)
|
||||||
Image_egalise_mono_0(Image_Desc *src, Image_Desc *dst, int yoyo)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
long c, cc, s3;
|
long c, cc, s3;
|
||||||
long *histr, *histg, *histb;
|
long *histr, *histg, *histb;
|
||||||
int cumul[256];
|
int cumul[256];
|
||||||
|
|
||||||
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, "Image_Egalise_Mono_0: images are differents %d\n", foo);
|
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,8 +238,7 @@ Image_histo_RGB(src, histr, histg, histb);
|
|||||||
s3 = (3 * src->width * src->height);
|
s3 = (3 * src->width * src->height);
|
||||||
|
|
||||||
cc = 0L;
|
cc = 0L;
|
||||||
for (foo=0; foo<256; foo++)
|
for (foo=0; foo<256; foo++) {
|
||||||
{
|
|
||||||
c = histr[foo] + histg[foo] + histb[foo];
|
c = histr[foo] + histg[foo] + histb[foo];
|
||||||
cc += c;
|
cc += c;
|
||||||
cumul[foo] = (int)((cc*255) / s3);
|
cumul[foo] = (int)((cc*255) / s3);
|
||||||
@ -268,17 +253,13 @@ return 0;
|
|||||||
complement d'une image complete (c.a.d tous
|
complement d'une image complete (c.a.d tous
|
||||||
les canaux contenus dans cette image)
|
les canaux contenus dans cette image)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_negate(Image_Desc *image, Image_Desc *resultat)
|
||||||
Image_negate(Image_Desc *image, Image_Desc *resultat)
|
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (image->type == 3)
|
if (image->type == 3) {
|
||||||
{
|
for (y=0; y<image->height; y++) {
|
||||||
for (y=0; y<image->height; y++)
|
for (x=0; x<image->width; x++) {
|
||||||
{
|
|
||||||
for (x=0; x<image->width; x++)
|
|
||||||
{
|
|
||||||
resultat->Rpix[y][x] = image->Rpix[y][x] ^ 0xff;
|
resultat->Rpix[y][x] = image->Rpix[y][x] ^ 0xff;
|
||||||
resultat->Gpix[y][x] = image->Gpix[y][x] ^ 0xff;
|
resultat->Gpix[y][x] = image->Gpix[y][x] ^ 0xff;
|
||||||
resultat->Bpix[y][x] = image->Bpix[y][x] ^ 0xff;
|
resultat->Bpix[y][x] = image->Bpix[y][x] ^ 0xff;
|
||||||
@ -287,8 +268,9 @@ if (image->type == 3)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Image Negate: unknow image type %d, %s\n",
|
fprintf(stderr, "%s: unknow image type %d, %s\n",
|
||||||
image->type, Image_type2str(image->type));
|
__func__, image->type, Image_type2str(image->type));
|
||||||
|
|
||||||
return IMAGE_BAD_TYPE;
|
return IMAGE_BAD_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,27 +550,22 @@ return retval;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
|
||||||
int
|
int Image_seuil_RGB(Image_Desc *s, Image_Desc *d, int r, int g, int b)
|
||||||
Image_seuil_RGB(Image_Desc *s, Image_Desc *d, int r, int g, int b)
|
|
||||||
{
|
{
|
||||||
int foo, x, y;
|
int foo, x, y;
|
||||||
|
|
||||||
if ( (s->type != 3) || (d->type != 3) )
|
if ( (s->type != 3) || (d->type != 3) ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Image Seuil RGB: an image is not of type 3\n");
|
fprintf(stderr, "Image Seuil RGB: an image is not of type 3\n");
|
||||||
return IMAGE_BAD_TYPE;
|
return IMAGE_BAD_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(s, d)) != 0 )
|
if ( (foo=Image_compare_desc(s, d)) != 0 ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Image Seuil RGB: images are differents %d\n", foo);
|
fprintf(stderr, "Image Seuil RGB: images are differents %d\n", foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<s->height; y++)
|
for (y=0; y<s->height; y++) {
|
||||||
{
|
for (x=0; x<s->width; x++) {
|
||||||
for (x=0; x<s->width; x++)
|
|
||||||
{
|
|
||||||
if(s->Rpix[y][x] > r) d->Rpix[y][x] = 255;
|
if(s->Rpix[y][x] > r) d->Rpix[y][x] = 255;
|
||||||
else d->Rpix[y][x] = 0;
|
else d->Rpix[y][x] = 0;
|
||||||
if(s->Gpix[y][x] > g) d->Gpix[y][x] = 255;
|
if(s->Gpix[y][x] > g) d->Gpix[y][x] = 255;
|
||||||
|
@ -19,12 +19,10 @@ static Image_Desc *S, *D;
|
|||||||
static int seuil;
|
static int seuil;
|
||||||
static int level, maxlevel;
|
static int level, maxlevel;
|
||||||
|
|
||||||
static int
|
static int recursion(Image_Rect *pRect)
|
||||||
recursion(Image_Rect *pRect)
|
|
||||||
{
|
{
|
||||||
Image_Rect rect;
|
Image_Rect rect;
|
||||||
int h1, h2, w1, w2, xx, yy, foo;
|
int h1, h2, w1, w2, xx, yy, foo;
|
||||||
|
|
||||||
int mr, mg, mb, dr, dg, db, s;
|
int mr, mg, mb, dr, dg, db, s;
|
||||||
|
|
||||||
level++;
|
level++;
|
||||||
@ -43,13 +41,11 @@ printf(" %7d V %3d %3d %3d D %3d %3d %3d S %3d (%d)\n",
|
|||||||
pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s, foo);
|
pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s, foo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) )
|
if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) ) {
|
||||||
{
|
|
||||||
Image_paint_rect(D, pRect, mr, mg, mb);
|
Image_paint_rect(D, pRect, mr, mg, mb);
|
||||||
/* printf(" paint %d %d %d\n", mr, mg, mb); */
|
/* printf(" paint %d %d %d\n", mr, mg, mb); */
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Image_paint_rect(D, pRect, 255, 0, 0);
|
Image_paint_rect(D, pRect, 255, 0, 0);
|
||||||
/* Image_dump_rect(pRect, "R", 0); */
|
/* Image_dump_rect(pRect, "R", 0); */
|
||||||
|
|
||||||
@ -113,10 +109,9 @@ return 0;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
* a quoi peut bien servir le parametre ?
|
* a quoi peut bien servir le parametre ?
|
||||||
*/
|
*/
|
||||||
int
|
int Image_call_recursion_0(Image_Desc *image, Image_Desc *dest, int param)
|
||||||
Image_call_recursion_0(Image_Desc *image, Image_Desc *dest, int param)
|
|
||||||
{
|
{
|
||||||
Image_Rect rect;
|
Image_Rect rect;
|
||||||
int foo;
|
int foo;
|
||||||
|
46
Lib/text0.c
46
Lib/text0.c
@ -30,13 +30,12 @@ static uint8_t priv_fonte[T_FONTE];
|
|||||||
/*
|
/*
|
||||||
* for now, parameter *ou must be NULL
|
* for now, parameter *ou must be NULL
|
||||||
*/
|
*/
|
||||||
int
|
int Image_load_fnt8x8(char *nomfnt, uint8_t *ou, int flags)
|
||||||
Image_load_fnt8x8(char *nomfnt, uint8_t *ou, int flags)
|
|
||||||
{
|
{
|
||||||
int fd, foo;
|
int fd, foo;
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > -1
|
||||||
fprintf(stderr, "%s: %s %p %d\n", __func__, nomfnt, ou, flags);
|
fprintf(stderr, ">>> %s ( '%s' %p %d )\n", __func__, nomfnt, ou, flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (NULL != ou)
|
if (NULL != ou)
|
||||||
@ -51,15 +50,13 @@ if (NULL == nomfnt) {
|
|||||||
}
|
}
|
||||||
/* on pourrait aussi mettre la fonte par ddefaut dans l'environ */
|
/* on pourrait aussi mettre la fonte par ddefaut dans l'environ */
|
||||||
|
|
||||||
if ( (fd=Image_must_open(nomfnt, O_RDONLY, 0)) < 0 )
|
if ( (fd=Image_must_open(nomfnt, O_RDONLY, 0)) < 0 ) {
|
||||||
{
|
|
||||||
perror (nomfnt);
|
perror (nomfnt);
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
foo = read(fd, priv_fonte, T_FONTE);
|
foo = read(fd, priv_fonte, T_FONTE);
|
||||||
if ( foo != T_FONTE )
|
if ( foo != T_FONTE ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: error when reading font datas\n", __func__);
|
fprintf(stderr, "%s: error when reading font datas\n", __func__);
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
@ -75,8 +72,7 @@ return OLL_KORRECT;
|
|||||||
/*
|
/*
|
||||||
* XXX nasty bug in the alpha channel gestion XXX
|
* XXX nasty bug in the alpha channel gestion XXX
|
||||||
*/
|
*/
|
||||||
int
|
int Image_trace_caractere_2(Image_Desc *im, uint8_t *fnt, int x, int y, int code,
|
||||||
Image_trace_caractere_2(Image_Desc *im, uint8_t *fnt, int x, int y, int code,
|
|
||||||
RGBA *paper, RGBA *ink)
|
RGBA *paper, RGBA *ink)
|
||||||
{
|
{
|
||||||
int foo, bar, xi, yi;
|
int foo, bar, xi, yi;
|
||||||
@ -88,17 +84,14 @@ fprintf(stderr, "trace car 2: xy= %4d %4d c= %c\n", x, y,
|
|||||||
isprint(code) ? code : ' ');
|
isprint(code) ? code : ' ');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (NULL==fnt)
|
if (NULL==fnt) {
|
||||||
{
|
|
||||||
fnt = priv_fonte; /* use local static storage */
|
fnt = priv_fonte; /* use local static storage */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (foo=0; foo<8; foo++)
|
for (foo=0; foo<8; foo++) {
|
||||||
{
|
|
||||||
yi = y+foo;
|
yi = y+foo;
|
||||||
octet = fnt[(code*8)+foo];
|
octet = fnt[(code*8)+foo];
|
||||||
for (bar=0; bar<8; bar++)
|
for (bar=0; bar<8; bar++) {
|
||||||
{
|
|
||||||
xi = x+7-bar;
|
xi = x+7-bar;
|
||||||
|
|
||||||
/* lecture contenu image */
|
/* lecture contenu image */
|
||||||
@ -106,14 +99,12 @@ for (foo=0; foo<8; foo++)
|
|||||||
gs = (im->Gpix[yi])[xi];
|
gs = (im->Gpix[yi])[xi];
|
||||||
bs = (im->Bpix[yi])[xi];
|
bs = (im->Bpix[yi])[xi];
|
||||||
|
|
||||||
if (octet & 1) /* ENCRE */
|
if (octet & 1) { /* ENCRE */
|
||||||
{
|
|
||||||
rp = ((rs*(255-ink->a))+(ink->r*ink->a)) / 255;
|
rp = ((rs*(255-ink->a))+(ink->r*ink->a)) / 255;
|
||||||
gp = ((gs*(255-ink->a))+(ink->g*ink->a)) / 255;
|
gp = ((gs*(255-ink->a))+(ink->g*ink->a)) / 255;
|
||||||
bp = ((bs*(255-ink->a))+(ink->b*ink->a)) / 255;
|
bp = ((bs*(255-ink->a))+(ink->b*ink->a)) / 255;
|
||||||
}
|
}
|
||||||
else /* PAPIER */
|
else { /* PAPIER */
|
||||||
{
|
|
||||||
rp = ((rs*(255-paper->a))+(paper->r*paper->a)) / 255;
|
rp = ((rs*(255-paper->a))+(paper->r*paper->a)) / 255;
|
||||||
gp = ((gs*(255-paper->a))+(paper->g*paper->a)) / 255;
|
gp = ((gs*(255-paper->a))+(paper->g*paper->a)) / 255;
|
||||||
bp = ((bs*(255-paper->a))+(paper->b*paper->a)) / 255;
|
bp = ((bs*(255-paper->a))+(paper->b*paper->a)) / 255;
|
||||||
@ -131,17 +122,14 @@ return 42;
|
|||||||
/*
|
/*
|
||||||
* fonction très primitive...
|
* fonction très primitive...
|
||||||
*/
|
*/
|
||||||
int
|
int Image_trace_caractere(Image_Desc *im, int x, int y, int code)
|
||||||
Image_trace_caractere(Image_Desc *im, int x, int y, int code)
|
|
||||||
{
|
{
|
||||||
int foo, bar;
|
int foo, bar;
|
||||||
uint8_t octet;
|
uint8_t octet;
|
||||||
|
|
||||||
for (foo=0; foo<8; foo++)
|
for (foo=0; foo<8; foo++) {
|
||||||
{
|
|
||||||
octet = priv_fonte[(code*8)+foo];
|
octet = priv_fonte[(code*8)+foo];
|
||||||
for (bar=0; bar<8; bar++)
|
for (bar=0; bar<8; bar++) {
|
||||||
{
|
|
||||||
if (octet & 1)
|
if (octet & 1)
|
||||||
Image_plotRGB(im, x+8-bar, y+foo, 255, 255, 255);
|
Image_plotRGB(im, x+8-bar, y+foo, 255, 255, 255);
|
||||||
else
|
else
|
||||||
@ -214,11 +202,9 @@ fprintf(stderr, "encre %3d %3d %3d %3d\n", ink->r, ink->g, ink->b, ink->a);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
posx = x; posy = y;
|
posx = x; posy = y;
|
||||||
for (foo=0; foo<t_texte; foo++)
|
for (foo=0; foo<t_texte; foo++) {
|
||||||
{
|
|
||||||
octet = ptrtxt[foo];
|
octet = ptrtxt[foo];
|
||||||
if (posx > (im->width-8))
|
if (posx > (im->width-8)) {
|
||||||
{
|
|
||||||
fprintf(stderr, "can't plot char '%c' at x=%d\n", octet, posx);
|
fprintf(stderr, "can't plot char '%c' at x=%d\n", octet, posx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -213,11 +213,12 @@ int Image_t16x24_pltstr_1(Image_Desc *img, char *str, int x, int y,
|
|||||||
{
|
{
|
||||||
int len, foo;
|
int len, foo;
|
||||||
|
|
||||||
len = strlen(str);
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "%s: '%s' at %d,%d\n", __func__, str, x, y);
|
fprintf(stderr, ">>> %s: '%s' at %d,%d\n", __func__, str, x, y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
len = strlen(str);
|
||||||
|
|
||||||
for (foo=0; foo<len; foo++) {
|
for (foo=0; foo<len; foo++) {
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, "%4d %c\n", foo, str[foo]);
|
fprintf(stderr, "%4d %c\n", foo, str[foo]);
|
||||||
@ -225,7 +226,8 @@ for (foo=0; foo<len; foo++) {
|
|||||||
Image_t16x24_pltch_1(img, str[foo], x+(foo*16), y, paper, ink, flags);
|
Image_t16x24_pltch_1(img, str[foo], x+(foo*16), y, paper, ink, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FUNC_IS_BETA;
|
/* XXX return FUNC_IS_BETA; */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
|
30
Lib/trigo.c
Normal file
30
Lib/trigo.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* trigo.c
|
||||||
|
*
|
||||||
|
* nouveau Thu 15 Sep 2022 09:33:53 PM CEST
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef NEED_ALLOCA_H
|
||||||
|
#include <alloca.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../tthimage.h"
|
||||||
|
|
||||||
|
/*::------------------------------------------------------------------::*/
|
||||||
|
Image_cos010(Image_Desc *src, Image_Desc *dst)
|
||||||
|
{
|
||||||
|
int foo;
|
||||||
|
|
||||||
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
|
fprintf(stderr, "%s: images not compatible, %d\n", __func__, foo);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FULL_NUCKED;
|
||||||
|
}
|
||||||
|
/*::------------------------------------------------------------------::*/
|
||||||
|
/*::------------------------------------------------------------------::*/
|
@ -22,7 +22,7 @@ HTML_DIR=$(DESTDIR)/html
|
|||||||
# use -Wmissing-prototypes ?
|
# use -Wmissing-prototypes ?
|
||||||
|
|
||||||
LIBIMG_OPT=-DFORCE_ABORT=1 -DDEBUG_LEVEL=0 -DIMGCOMMENT=0
|
LIBIMG_OPT=-DFORCE_ABORT=1 -DDEBUG_LEVEL=0 -DIMGCOMMENT=0
|
||||||
CC_OPTS=-Wall -W -g -ansi -O3 -fPIC -no-pie
|
CC_OPTS=-Wall -W -g -pg -ansi -O3 -fPIC -no-pie
|
||||||
CC_HACKS=-DNEED_ALLOCA_H
|
CC_HACKS=-DNEED_ALLOCA_H
|
||||||
CFLAGS= $(CC_OPTS) \
|
CFLAGS= $(CC_OPTS) \
|
||||||
$(LIBIMG_OPT) \
|
$(LIBIMG_OPT) \
|
||||||
|
@ -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 21"
|
#define IMAGE_VERSION_STRING "0.4.51 pl 28"
|
||||||
|
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user