cosmetic
This commit is contained in:
parent
54e6a7e58a
commit
8fae30abc7
81
Lib/bitblt.c
81
Lib/bitblt.c
@ -20,30 +20,34 @@
|
||||
* et les parametres x et y disent ou recopier les pixels dans l'image
|
||||
* de destination.
|
||||
*/
|
||||
int
|
||||
Image_get_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
int Image_get_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
{
|
||||
int xfoo, yfoo; /* oh! des 'foo' 2D :-) */
|
||||
int xs, ys;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p %d %d )\n", __func__, s, z, d, x, y);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NEED MORE EXPLANATION XXX !
|
||||
*/
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "GET RECT src %p %4d, %4d, %4d, %4d\n",
|
||||
s, z->x, z->y, z->w, z->h);
|
||||
fprintf(stderr, " dst %p %4d, %4d\n", d, x, y);
|
||||
#endif
|
||||
|
||||
if ( (z->w > d->width) || (z->h > d->height) )
|
||||
{
|
||||
if ( (z->w > d->width) || (z->h > d->height) ) {
|
||||
fprintf(stderr, "%s: oups, bad rect\n", __func__);
|
||||
return 666;
|
||||
}
|
||||
|
||||
for (yfoo=0; yfoo<z->h; yfoo++)
|
||||
{
|
||||
for (yfoo=0; yfoo<z->h; yfoo++) {
|
||||
ys = yfoo + z->y;
|
||||
if (ys<0 || ys>s->height-1)
|
||||
continue;
|
||||
for (xfoo=0; xfoo<z->w; xfoo++)
|
||||
{
|
||||
for (xfoo=0; xfoo<z->w; xfoo++) {
|
||||
xs = xfoo + z->x;
|
||||
if (xs<0 || xs>s->width-1)
|
||||
continue;
|
||||
@ -55,23 +59,27 @@ return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* 2023-09-30: je comprend rien a ce truc !
|
||||
*
|
||||
* recopie d'un rectangle d'une image source par dessus
|
||||
* une image destination.
|
||||
*/
|
||||
int
|
||||
Image_put_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
int Image_put_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
{
|
||||
int xfoo, yfoo;
|
||||
int xs, ys, xd, yd;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p %d %d )\n", __func__, s, z, d, x, y);
|
||||
#endif
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "PUT RECT src %p %4d, %4d, %4d, %4d\n",
|
||||
s, z->x, z->y, z->w, z->h);
|
||||
fprintf(stderr, " dst %p %4d, %4d\n", d, x, y);
|
||||
#endif
|
||||
|
||||
for (yfoo=0; yfoo<z->h; yfoo++)
|
||||
{
|
||||
for (yfoo=0; yfoo<z->h; yfoo++) {
|
||||
ys = yfoo + z->y;
|
||||
if (ys<0 || ys>s->height-1)
|
||||
continue;
|
||||
@ -80,8 +88,7 @@ for (yfoo=0; yfoo<z->h; yfoo++)
|
||||
if (yd<0 || yd>d->height-1)
|
||||
continue;
|
||||
|
||||
for (xfoo=0; xfoo<z->w; xfoo++)
|
||||
{
|
||||
for (xfoo=0; xfoo<z->w; xfoo++) {
|
||||
xs = xfoo + z->x;
|
||||
if (xs<0 || xs>s->width-1)
|
||||
continue;
|
||||
@ -94,33 +101,27 @@ for (yfoo=0; yfoo<z->h; yfoo++)
|
||||
}
|
||||
}
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
return FUNC_IS_ALPHA; /* AH BRAVO */
|
||||
}
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* coredumper dlmkt !
|
||||
*/
|
||||
int
|
||||
Image_copy_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
int Image_copy_rect(Image_Desc *s, Image_Rect *z, Image_Desc *d, int x, int y)
|
||||
{
|
||||
int xs, ys, xd, yd, xx, yy;
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "%s s=%p z=%p d=%p x,y=%d,%d\n", __func__,
|
||||
s, z, d, x, y);
|
||||
#endif
|
||||
fprintf(stderr, ">>> %s ( %p %p %p %d %d )\n", __func__, s, z, d, x, y );
|
||||
|
||||
if (d->magic != MAGIC_OF_IMAGE)
|
||||
{
|
||||
if (d->magic != MAGIC_OF_IMAGE) {
|
||||
fprintf(stderr, "%s: need Dead Beef\n", __func__);
|
||||
return NOT_AN_IMAGE_DESC;
|
||||
}
|
||||
|
||||
foo = 0;
|
||||
for (yy=0; yy<z->h; yy++)
|
||||
{
|
||||
for (yy=0; yy<z->h; yy++) {
|
||||
ys = yy + z->y;
|
||||
if (ys<0 || ys>=s->height)
|
||||
continue;
|
||||
@ -129,8 +130,7 @@ for (yy=0; yy<z->h; yy++)
|
||||
if (yd<0 || yd>=d->height)
|
||||
continue;
|
||||
|
||||
for (xx=0; xx<z->w; xx++)
|
||||
{
|
||||
for (xx=0; xx<z->w; xx++) {
|
||||
xs = xx + z->x;
|
||||
if (xs<0 || xs>=s->width)
|
||||
continue;
|
||||
@ -154,22 +154,21 @@ return FUNC_IS_BETA;
|
||||
* 23 dec 01 found a coredump if src image is too small
|
||||
*
|
||||
*/
|
||||
Image_Desc *
|
||||
Image_create_subimg(Image_Desc *src, Image_Rect *r, int gray)
|
||||
Image_Desc *Image_create_subimg(Image_Desc *src, Image_Rect *r, int gray)
|
||||
{
|
||||
Image_Desc *clone;
|
||||
int x,y,xs, ys;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, r, gray);
|
||||
|
||||
/*
|
||||
* sanities controls...
|
||||
*/
|
||||
if (src->type != IMAGE_RGB)
|
||||
{
|
||||
if (src->type != IMAGE_RGB) {
|
||||
fprintf(stderr, "'%s' work only on RGB images\n", __func__);
|
||||
exit(5);
|
||||
}
|
||||
if ( (r->x<0) || (r->y<0) )
|
||||
{
|
||||
if ( (r->x<0) || (r->y<0) ) {
|
||||
fprintf(stderr, "create_subimg, rect(%d,%d,%d,%d) iznotgoud\n",
|
||||
r->x, r->y, r->w, r->h);
|
||||
exit(5);
|
||||
@ -180,34 +179,28 @@ if ( (r->x<0) || (r->y<0) )
|
||||
* now, we allocate the new image...
|
||||
*/
|
||||
clone = Image_alloc(r->w, r->h, src->type);
|
||||
if (clone == NULL)
|
||||
{
|
||||
if (clone == NULL) {
|
||||
fprintf(stderr, "CreateSubImage: can't alloc memory...\n");
|
||||
exit(5);
|
||||
}
|
||||
|
||||
for (x=0; x<r->w; x++)
|
||||
{
|
||||
for (x=0; x<r->w; x++) {
|
||||
xs = x + r->x;
|
||||
for (y=0; y<r->h; y++)
|
||||
{
|
||||
for (y=0; y<r->h; y++) {
|
||||
ys = y + r->y;
|
||||
/*printf("dst %4d %4d ", x, y); */
|
||||
/*printf("src %4d %4d ", xs, ys); */
|
||||
|
||||
if (ys<0 || ys>src->width)
|
||||
{
|
||||
if (ys<0 || ys>src->width) {
|
||||
Image_plotRGB(clone, x, y, gray, gray, gray);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* XXX calling this func is a nasty cpu sucker,
|
||||
* so we have to go to a nasty optimize trick */
|
||||
/* XXX Image_pixel_copy(src, xs, ys, clone, x, y); */
|
||||
(clone->Rpix[y])[x] = (src->Rpix[ys])[xs];
|
||||
(clone->Gpix[y])[x] = (src->Gpix[ys])[xs];
|
||||
(clone->Bpix[y])[x] = (src->Bpix[ys])[xs];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,18 +17,16 @@
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_calclut_lin(int *lut, int v0, int v255)
|
||||
int Image_calclut_lin(int *lut, int v0, int v255)
|
||||
{
|
||||
int foo, quux, delta;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "calclut lin: v0 = %d v255 = %d\n", v0, v255);
|
||||
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, lut, v0, v255);
|
||||
#endif
|
||||
|
||||
delta = v255 - v0;
|
||||
if (delta == 0)
|
||||
{
|
||||
if (delta == 0) {
|
||||
return DIVISOR_IS_0;
|
||||
}
|
||||
|
||||
@ -36,84 +34,70 @@ if (delta == 0)
|
||||
fprintf(stderr, " calclut lin: delta = %d\n", delta);
|
||||
#endif
|
||||
|
||||
for (foo=0; foo<256; foo++)
|
||||
{
|
||||
for (foo=0; foo<256; foo++) {
|
||||
quux = (foo * delta / 255) + v0;
|
||||
#if DEBUG_LEVEL
|
||||
#if DEBUG_LEVEL > 1
|
||||
printf("lut(%d) = %d\n", foo, quux);
|
||||
#endif
|
||||
lut[foo] = quux;
|
||||
}
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_calclut_foo(int *lut, int v0, int v255)
|
||||
int Image_calclut_foo(int *lut, int v0, int v255)
|
||||
{
|
||||
fprintf(stderr, "%s ( %p %d %d )\n", __func__, lut, v0, v255);
|
||||
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, lut, v0, v255);
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_print_lut(int *lut, char *fname, int flag)
|
||||
int Image_print_lut(int *lut, char *fname, int flag)
|
||||
{
|
||||
FILE *fp;
|
||||
int foo;
|
||||
|
||||
if (strcmp(fname, "-"))
|
||||
fp = fopen(fname, "w");
|
||||
else
|
||||
fp = stdout;
|
||||
if (strcmp(fname, "-")) fp = fopen(fname, "w");
|
||||
else fp = stdout;
|
||||
|
||||
for (foo=0; foo<256; foo++)
|
||||
{
|
||||
if (flag)
|
||||
printf("%d ", foo);
|
||||
printf("%d\n", lut[foo]);
|
||||
for (foo=0; foo<256; foo++) {
|
||||
if (flag) printf("%4d ", foo);
|
||||
printf(" %4d\n", lut[foo]);
|
||||
}
|
||||
|
||||
if (fp!=stdout)
|
||||
fclose(fp);
|
||||
if (fp!=stdout) fclose(fp);
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_load_lut(int *lut, char *fname, int flag)
|
||||
int Image_load_lut(int *lut, char *fname, int flag)
|
||||
{
|
||||
FILE *fp;
|
||||
int value, foo, idx;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p '%s' )\n", __func__, fname, lut);
|
||||
#endif
|
||||
|
||||
if (flag) {
|
||||
fprintf(stderr, "in %s, flag must be O, was %d\n", __func__, flag);
|
||||
return WRONG_FLAG;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "load_lut %s in %p\n", fname, lut);
|
||||
#endif
|
||||
|
||||
if (NULL==(fp=fopen(fname, "r")))
|
||||
{
|
||||
if (NULL==(fp=fopen(fname, "r"))) {
|
||||
fprintf(stderr, "%s can't fopen %s\n", __func__, fname);
|
||||
return 666;
|
||||
}
|
||||
|
||||
/* WARNING : very crude code here (4 nov 1999) */
|
||||
for (idx=0; idx<256; idx++)
|
||||
{
|
||||
for (idx=0; idx<256; idx++) {
|
||||
foo = fscanf(fp, "%d", &value);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "load lut %3d %3d %d\n", idx, foo, value);
|
||||
#endif
|
||||
if (1==foo) lut[idx] = value;
|
||||
else lut[idx] = -1;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
@ -71,6 +72,10 @@ int Image_combine_columns(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
|
||||
{
|
||||
int foo, x, y, mx, r, g, b;
|
||||
|
||||
if (zak) {
|
||||
fprintf(stderr, "in %s, zak is not 0\n", __func__);
|
||||
}
|
||||
|
||||
if (sx == 0) {
|
||||
fprintf(stderr, "Combine Columns: sx is zer0\n");
|
||||
return DIVISOR_IS_ZERO;
|
||||
@ -246,8 +251,12 @@ int foo;
|
||||
int x, y, r, g, b;
|
||||
int vertical, offset;
|
||||
|
||||
if ( p1 || p2 ) {
|
||||
fprintf(stderr, "in %s bad p1 %d or bad p2 %d\n", __func__, p1, p2);
|
||||
}
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
|
||||
fprintf(stderr, "Combine Diagonale: differents sources (%d)\n", foo);
|
||||
fprintf(stderr, "%s: differents sources (%d)\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ int Image_XOR(Image_Desc *s1, Image_Desc *s2, Image_Desc *d, int k)
|
||||
int foo, x, y;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "---> %s ( %p %p %p %d)\n", __func__, s1, s2, d, k);
|
||||
fprintf(stderr, ">>> %s ( %p %p %p %d)\n", __func__, s1, s2, d, k);
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(s1, s2)) )
|
||||
|
98
Lib/dither.c
98
Lib/dither.c
@ -12,11 +12,12 @@
|
||||
en entree, on doit avoir une image RGB, sinon, "segfault"
|
||||
le parametre 'uh' represente l'intensite de la couleur 'on'
|
||||
*/
|
||||
int
|
||||
Image_dither_Bayer_0(Image_Desc *s, Image_Desc *d, int uh)
|
||||
int Image_dither_Bayer_0(Image_Desc *s, Image_Desc *d, int uh)
|
||||
{
|
||||
int dx, dy, x, y, r, g, b;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, s, d, uh);
|
||||
|
||||
/* directement copie de la page 389 de "Bitmapped graphics" de
|
||||
Steve Rimmer. */
|
||||
|
||||
@ -57,18 +58,17 @@ return OLL_KORRECT;
|
||||
* 19 Juin 2000: dithering on a 2x2 matrice.
|
||||
* 15 Nov 2001: 'uh' parameter is _now_ working ;-}
|
||||
*/
|
||||
int
|
||||
Image_dither_crude(Image_Desc *s, Image_Desc *d, int uh)
|
||||
int Image_dither_crude(Image_Desc *s, Image_Desc *d, int uh)
|
||||
{
|
||||
int x, y, r, g, b;
|
||||
int som;
|
||||
|
||||
Image_clear(d, 0, 0, 0);
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, s, d, uh);
|
||||
|
||||
for (x=0; x<(s->width-1); x+=2)
|
||||
{
|
||||
for (y=0; y<(s->height-1); y+=2)
|
||||
{
|
||||
if (s != d) Image_clear(d, 0, 0, 0);
|
||||
|
||||
for (x=0; x<(s->width-1); x+=2) {
|
||||
for (y=0; y<(s->height-1); y+=2) {
|
||||
r = g = b = 0;
|
||||
r += Image_R_pixel(s, x, y);
|
||||
r += Image_R_pixel(s, x+1, y);
|
||||
@ -96,14 +96,8 @@ for (x=0; x<(s->width-1); x+=2)
|
||||
|
||||
som = r + g + b;
|
||||
|
||||
if (som < 2048)
|
||||
{
|
||||
Image_plotRGB(d, x+1, y+1, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Image_plotRGB(d, x+1, y+1, uh, uh, uh);
|
||||
}
|
||||
if (som < 2048) Image_plotRGB(d, x+1, y+1, 0, 0, 0);
|
||||
else Image_plotRGB(d, x+1, y+1, uh, uh, uh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,25 +107,24 @@ return OLL_KORRECT;
|
||||
/*
|
||||
* ça ne marche pas très fort, ce truc...
|
||||
*/
|
||||
int
|
||||
Image_dither_2x2(Image_Desc *s, Image_Desc *d, int uh)
|
||||
int Image_dither_2x2(Image_Desc *s, Image_Desc *d, int uh)
|
||||
{
|
||||
int x, y, xm, ym;
|
||||
int r, g, b, v;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, s, d, uh);
|
||||
|
||||
x = s->width; xm = (x&1) ? (x-1) : x;
|
||||
y = s->height; ym = (y&1) ? (y-1) : y;
|
||||
|
||||
Image_clear(d, 0, 0, 0);
|
||||
if (s != d) Image_clear(d, 0, 0, 0);
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "dither 2x2: %d %d %d %d\n", x, xm, y, ym);
|
||||
#endif
|
||||
|
||||
for (x=0; x<xm; x+=2)
|
||||
{
|
||||
for (y=0; y<ym; y+=2)
|
||||
{
|
||||
for (x=0; x<xm; x+=2) {
|
||||
for (y=0; y<ym; y+=2) {
|
||||
/*
|
||||
* bon sang, mais que faire ici ?
|
||||
*/
|
||||
@ -155,24 +148,22 @@ for (x=0; x<xm; x+=2)
|
||||
return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_dither_seuil_random(Image_Desc *s, Image_Desc *d, int uh)
|
||||
int Image_dither_seuil_random(Image_Desc *s, Image_Desc *d, int uh)
|
||||
{
|
||||
int x, y, r, g, b;
|
||||
int foo;
|
||||
|
||||
if ( (foo=Image_compare_desc(s, d)) )
|
||||
{
|
||||
fprintf(stderr, "dither seuil random: images are differents %d\n", foo);
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, s, d, uh);
|
||||
|
||||
if ( (foo=Image_compare_desc(s, d)) ) {
|
||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
Image_clear(d, 0, 0, 0);
|
||||
if (s != d) Image_clear(d, 0, 0, 0);
|
||||
|
||||
for (y=0; y<s->height; y++)
|
||||
{
|
||||
for (x=0; x<s->width; x++)
|
||||
{
|
||||
for (y=0; y<s->height; y++) {
|
||||
for (x=0; x<s->width; x++) {
|
||||
if (s->Rpix[y][x] < rand() % 256) r = 0;
|
||||
else r = uh;
|
||||
|
||||
@ -195,35 +186,31 @@ return OLL_KORRECT;
|
||||
*
|
||||
* subtle bug: uh _must_ be 255 ?
|
||||
*/
|
||||
int
|
||||
Image_dither_simple_error(Image_Desc *s, Image_Desc *d, int uh)
|
||||
int Image_dither_simple_error(Image_Desc *s, Image_Desc *d, int uh)
|
||||
{
|
||||
int x, y, xa, xb, inc, errR, errG, errB;
|
||||
int r, g, b, dr, dg, db;
|
||||
int foo;
|
||||
|
||||
if ( (foo=Image_compare_desc(s, d)) )
|
||||
{
|
||||
fprintf(stderr, "dither simple error: images are differents %d\n", foo);
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, s, d, uh);
|
||||
|
||||
if ( (foo=Image_compare_desc(s, d)) ) {
|
||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
Image_clear(d, 0, 0, 0);
|
||||
if (s != d) Image_clear(d, 0, 0, 0);
|
||||
errR = errG = errB = 0;
|
||||
|
||||
for (y=0; y<s->height; y++)
|
||||
{
|
||||
if (y & 1)
|
||||
{
|
||||
for (y=0; y<s->height; y++) {
|
||||
if (y & 1) {
|
||||
xa = 0; xb = s->width - 1; inc = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
xa = s->width - 1; xb = 0; inc = -1;
|
||||
}
|
||||
|
||||
for (x=xa; x!=xb; x+=inc)
|
||||
{
|
||||
for (x=xa; x!=xb; x+=inc) {
|
||||
r = (s->Rpix[y])[x];
|
||||
if ( (r + errR) > 127 ) dr = uh;
|
||||
else dr = 0;
|
||||
@ -253,26 +240,21 @@ return OLL_KORRECT;
|
||||
* 29 Jan 2002: may be I can buid a func for automagically
|
||||
* computing of right values ?
|
||||
*/
|
||||
int
|
||||
Image_dither_double_seuil(Image_Desc *s, Image_Desc *d, int sa, int sb, int uh)
|
||||
int Image_dither_double_seuil(Image_Desc *s, Image_Desc *d, int sa, int sb, int uh)
|
||||
{
|
||||
int x, y, r, g, b, foo;
|
||||
|
||||
if ( (foo=Image_compare_desc(s, d)) )
|
||||
{
|
||||
if ( (foo=Image_compare_desc(s, d)) ) {
|
||||
fprintf(stderr, "dither double seuil: images are differents %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
if ( sa >= sb )
|
||||
{
|
||||
if ( sa >= sb ) {
|
||||
fprintf(stderr, "dither double seuil: lo %d > hi %d !\n", sa, sb);
|
||||
}
|
||||
|
||||
for (y=0; y<s->height; y++)
|
||||
{
|
||||
for (x=0; x<s->width; x++)
|
||||
{
|
||||
for (y=0; y<s->height; y++) {
|
||||
for (x=0; x<s->width; x++) {
|
||||
r = (s->Rpix[y])[x];
|
||||
if (r < sa) r = 0;
|
||||
else if (r > sb) r = uh;
|
||||
|
@ -64,6 +64,7 @@ printf("RGBA : %5ld\n", sizeof(RGBA));
|
||||
printf("A_BitPlane : %5ld\n", sizeof(A_BitPlane));
|
||||
printf("RGB_map : %5ld\n", sizeof(RGB_map));
|
||||
printf("Image_Point : %5ld\n", sizeof(Image_Point));
|
||||
printf("RGB LUTs : %5ld\n", sizeof(Image_LUTs));
|
||||
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
10
Lib/tools.c
10
Lib/tools.c
@ -26,7 +26,9 @@ foo = (compteur++) / div;
|
||||
printf("%c\r", batons[foo&0x03]); fflush(stdout);
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
|
||||
/*
|
||||
* I think that the 'chrono' system is full broken
|
||||
*/
|
||||
#define NB_CHRONOS 42
|
||||
|
||||
static struct {
|
||||
@ -98,7 +100,7 @@ printf("/-------- Descriptor Dump (lib v=%s) -----------\n",
|
||||
|
||||
printf("| why text: %s\n", text);
|
||||
printf("| main pointer: %p\n", im);
|
||||
if ( im==NULL ) {
|
||||
if ( NULL == im ) {
|
||||
printf("!\t\tthis is a null descriptor, good luck, Sir...\n");
|
||||
return NULL_DESCRIPTOR;
|
||||
}
|
||||
@ -124,10 +126,10 @@ return 0;
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Image_dump_rect(Image_Rect *rect, char *texte, int flag)
|
||||
{
|
||||
printf("Rect: '%s'\n\t%5d %5d %5d %5d $%08lx\n", texte,
|
||||
printf("Rect: '%s'\n\t%5d %5d %5d %5d $%04lx\n", texte,
|
||||
rect->x, rect->y, rect->w, rect->h, rect->reserved);
|
||||
if (flag) {
|
||||
printf(" coin bas/droite %5d %5d\n", rect->x+rect->w, rect->y+rect->h);
|
||||
printf(" lower right %5d %5d\n", rect->x+rect->w, rect->y+rect->h);
|
||||
printf(" surface %8ld\n", (long)rect->w * (long)rect->h);
|
||||
}
|
||||
fflush(stdout);
|
||||
|
Loading…
Reference in New Issue
Block a user