Compare commits

...

5 Commits

Author SHA1 Message Date
tTh
63b0bce081 cosmetic 2022-09-23 13:41:58 +02:00
tTh
2f1f51671c cosmetic 2022-09-23 13:28:02 +02:00
tTh
7679fabae9 oups! 2022-09-21 18:24:03 +02:00
tTh
5bee2ac73c add a second 8x8 font 2022-09-21 18:22:32 +02:00
tTh
c73a361120 alway run a compil under DEBUG_LEVEL=1 2022-09-21 18:16:55 +02:00
7 changed files with 60 additions and 72 deletions

BIN
Datas/8x8std Normal file

Binary file not shown.

View File

@ -436,7 +436,7 @@ int x, y;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d %d %d %d %d )\n", __func__,
im, r, g, b, nh, nv);
im, r, g, b, nx, ny);
#endif
for (y=0; y<im->height; y++) {

View File

@ -108,11 +108,10 @@ int Image_luminance(Image_Desc *src, Image_Desc *dst, int factor)
int foo;
int x, y;
#if DEBUG_LEVEL > 1
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, factor);
#endif
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
#endif
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
@ -154,11 +153,11 @@ int *cumlr, *cumlg, *cumlb;
long cr, cg, cb, s;
if (yoyo != 0) {
fprintf(stderr, "%s: yoyo is %d\n", __func__, yoyo);
fprintf(stderr, "%s: yoyo is %d ?\n", __func__, yoyo);
}
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "Image Egalise RGB: images are differents %d\n", foo);
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -178,7 +177,7 @@ cr = cg = cb = 0L;
s = (src->width * src->height);
#if DEBUG_LEVEL
fprintf(stderr, "Image Egalise 0: surface = %ld\n", s);
fprintf(stderr, "%s: surface = %ld\n", __func__, s);
#endif
for (foo=0; foo<256; foo++) {

View File

@ -20,8 +20,7 @@
/*
* do not use in production !-)
*/
int
Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
int Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
{
float coefX, coefY, fx, fy;
int xd, yd, xs, ys;
@ -49,10 +48,8 @@ fprintf(stderr, "coefficients: X %f y %f\n", coefX, coefY);
* bon, pour les interpolations, il faut que je trouve
* un peu de doc... mais ou ?
*/
for (yd=0; yd<dst->height; yd++)
{
for (xd=0; xd<dst->width; xd++)
{
for (yd=0; yd<dst->height; yd++) {
for (xd=0; xd<dst->width; xd++) {
fx = (float)xd / coefX;
fy = (float)yd / coefY;
xs = (int)fx;
@ -70,9 +67,12 @@ return FUNC_IS_ALPHA;
}
/*::------------------------------------------------------------------::*/
/* new 2 nov 2009 - ave StEx */
/* I've lost all my mathematical concepts so I'm going to make
some approximations\dots */
/*
I've lost all my mathematical concepts so I'm going to make
some approximations\dots
this function is PRIVATE, see 'Image_getpix_bilin' for public interface
*/
static int getpix_bilin(Image_Desc *src, double fx, double fy,
int *pr, int *pg, int *pb)
{
@ -95,12 +95,8 @@ drw = fx - x11; drh = fy - y11;
xx = (int)x11; yy = (int)y11;
#if DEBUG_LEVEL > 2
if ( ! (rand() % 40000) )
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n",
fx, x11, x22, drw, xx);
if ( ! (rand() % 40000) )
printf("Y %10.3f %10.3f %10.3f %10.3f %4d\n",
fy, y11, y22, drh, yy);
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n", fx, x11, x22, drw, xx);
printf("Y %10.3f %10.3f %10.3f %10.3f %4d\n", fy, y11, y22, drh, yy);
#endif
if ( ! Image_xy_inside(src, xx, yy) )
@ -203,7 +199,7 @@ int nw, nh, foo;
Image_Desc *dst;
#if DEBUG_LEVEL
fprintf(stderr, "image\t%d %d, scale %f %f\n",
fprintf(stderr, "%s: image\t%d %d, scale %f %f\n", __func__,
src->width, src->height, scaleX, scaleY);
#endif
@ -223,9 +219,8 @@ fprintf(stderr, "\t%f %f\n", fx, fy);
fprintf(stderr, "\tnew dims: %d x %d\n", nw, nh);
#endif
if ( (dst = Image_alloc(nw, nh, 3)) == NULL )
{
fprintf(stderr, "Image new/scale: no memory\n");
if ( (dst = Image_alloc(nw, nh, 3)) == NULL ) {
fprintf(stderr, "%s: no memory\n", __func__);
return NULL;
}

View File

@ -14,16 +14,19 @@
/*
* comme au bon vieux temps...
*/
int
Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
int Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
{
int foo;
int x, y, v1, v2;
int resteY;
int sigma;
if ( (foo=Image_compare_desc(src, dst)) )
{
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
src, dst, p1, p2, p3);
#endif
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -39,10 +42,8 @@ fprintf(stderr, "%s : height %d reste Y %d\n", __func__, src->height, resteY);
fprintf(stderr, "%s : %d %d %d -> %d\n", __func__, p1, p2, p3, sigma);
#endif
for (y=resteY; y<src->height-resteY-1; y+=3)
{
for (x=0; x<src->width; x++)
{
for (y=resteY; y<src->height-resteY-1; y+=3) {
for (x=0; x<src->width; x++) {
v1 = ( Image_R_pixel(src, x, y) +
Image_R_pixel(src, x, y+1) +
Image_R_pixel(src, x, y+2) +
@ -68,20 +69,17 @@ return FUNC_IS_BETA;
/*
* this is juste a wrapper function - need more work...
*/
int
Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
int Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
{
int foo;
/* 15 janvier 2007: chasse au coredump... */
if ( (src->magic!=MAGIC_OF_IMAGE) || (dst->magic!=MAGIC_OF_IMAGE) )
{
if ( (src->magic!=MAGIC_OF_IMAGE) || (dst->magic!=MAGIC_OF_IMAGE) ) {
fprintf(stderr, "Image TV veryold: bad image descriptor\n");
abort();
}
if ( (foo=Image_compare_desc(src, dst)) )
{
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "Image TV veryold: images are differents %d\n", foo);
return foo;
}
@ -95,16 +93,19 @@ return FUNC_IS_ALPHA;
/*
* new 10 novembre 2013, in mixart-myrys
*/
int
Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
int Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
{
int foo, ox, oy;
int x, y, r, g, b;
int xmax, ymax;
Image_Rect zone;
if ( (foo=Image_compare_desc(src, dst)) )
{
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
src, dst, w, h, grey);
#endif
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -113,8 +114,7 @@ if ( (foo=Image_compare_desc(src, dst)) )
fprintf(stderr, "%s : w %d h %d grey %d\n", __func__, w, h, grey);
#endif
if (0==h || 0==w)
{
if (0==h || 0==w) {
return BAD_PARAMETER;
}
@ -127,11 +127,9 @@ fprintf(stderr, "%s : offsets = %d %d\n", __func__, ox, oy);
#endif
Image_clear(dst, grey, grey, grey);
for (x=ox; x<xmax; x+=w)
{
for (x=ox; x<xmax; x+=w) {
zone.x = x + (w/2);
for (y=oy; y<ymax; y+=h)
{
for (y=oy; y<ymax; y+=h) {
zone.y = y + (h/2);
r = src->Rpix[y][x] & 0xfe;
g = src->Gpix[y][x] & 0xfe;
@ -154,8 +152,12 @@ int x, y, v1, v2, r, g, b;
int xmax, ymax;
Image_Rect zone;
if ( (foo=Image_compare_desc(src, dst)) )
{
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
src, dst, w, h, p3);
#endif
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -164,8 +166,7 @@ if ( (foo=Image_compare_desc(src, dst)) )
fprintf(stderr, "%s : w %d h %d g%d\n", __func__, w, h, p3);
#endif
if ((0==h) || (0==w))
{
if ((0==h) || (0==w)) {
return BAD_PARAMETER;
}
@ -175,11 +176,9 @@ xmax = src->width - w;
ymax = src->height - h;
v1 = v2 = 0;
for (x=0; x<xmax; x+=w)
{
for (x=0; x<xmax; x+=w) {
zone.x = x;
for (y=0; y<ymax; y+=h)
{
for (y=0; y<ymax; y+=h) {
zone.y = y;
r = src->Rpix[y][x];
g = src->Gpix[y][x];
@ -221,8 +220,7 @@ fprintf(stderr, "%s: largeur %d, taille %d\n", __func__, src->width, taille);
Image_gray_noise_0(dst, 20, 60);
for (y=0; y<src->height; y++)
{
for (y=0; y<src->height; y++) {
switch (rand()%3) {
case 0 :
memcpy((dst->Rpix[y]), src->Rpix[y], taille);
@ -262,8 +260,7 @@ Image_clear(dst, 60, 60, 60); /* XXX necessaire ? */
idx = rand() % 42;
for (y=0; y<src->height; y++)
{
for (y=0; y<src->height; y++) {
if (0==mode) {
tri = (idx + y) % 3;
}
@ -273,8 +270,7 @@ for (y=0; y<src->height; y++)
#if DEBUG_LEVEL > 1
fprintf(stderr, " %5d -> %d\n", y, tri);
#endif
switch (tri)
{
switch (tri) {
case 0:
for (x=0; x<(src->width)-1; x++) {
v = (src->Rpix[y][x] + src->Rpix[y][x+1]);

View File

@ -11,8 +11,7 @@
/*
* Rotation d'image. le parametre 'angle' est en degres.
*/
int
Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
int Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
{
int xs, ys, xd, yd;
double arad, fxs, fys, fxd, fyd;
@ -66,8 +65,7 @@ return FUNC_IS_BETA;
*
* reste plus qu'à coder...
*/
int
Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
int Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
double x, double y)
{
int foo, xd, yd;

View File

@ -1,15 +1,15 @@
#!/bin/bash
echo "warning: $0 is an ugly installer"
echo "XXXXXXX warning: $0 is an ugly installer"
DESTDIR="/usr/local/"
DESTDIR="/usr/local"
install -d $DESTDIR/lib/
install -m 0644 libtthimage.a $DESTDIR/lib/libtthimage.a
install -m 0644 tthimage.h $DESTDIR/include/tthimage.h
cp -v Datas/8x8thin Datas/16x24thin $DESTDIR/share/libimage/
cp -v Datas/16x24gruik $DESTDIR/share/libimage/
cp -v Datas/8x8std Datas/16x24gruik $DESTDIR/share/libimage/
liste="genplot2 tga_cadre tga_effects tga_filtres tga_remap tga_tools \
tga_combine tga_television tga_dither tga_applymap tga_makehf15 \