Compare commits

..

No commits in common. "63b0bce08119967b0eaea77cee228abf68382618" and "a4e3d073f5ce8f4559b9da05b726f750961ad4eb" have entirely different histories.

7 changed files with 72 additions and 60 deletions

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, nx, ny);
im, r, g, b, nh, nv);
#endif
for (y=0; y<im->height; y++) {

View File

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

View File

@ -20,7 +20,8 @@
/*
* 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;
@ -48,8 +49,10 @@ 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;
@ -67,12 +70,9 @@ 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,8 +95,12 @@ drw = fx - x11; drh = fy - y11;
xx = (int)x11; yy = (int)y11;
#if DEBUG_LEVEL > 2
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);
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);
#endif
if ( ! Image_xy_inside(src, xx, yy) )
@ -199,7 +203,7 @@ int nw, nh, foo;
Image_Desc *dst;
#if DEBUG_LEVEL
fprintf(stderr, "%s: image\t%d %d, scale %f %f\n", __func__,
fprintf(stderr, "image\t%d %d, scale %f %f\n",
src->width, src->height, scaleX, scaleY);
#endif
@ -219,8 +223,9 @@ 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, "%s: no memory\n", __func__);
if ( (dst = Image_alloc(nw, nh, 3)) == NULL )
{
fprintf(stderr, "Image new/scale: no memory\n");
return NULL;
}

View File

@ -14,19 +14,16 @@
/*
* 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 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)) ) {
if ( (foo=Image_compare_desc(src, dst)) )
{
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -39,11 +36,13 @@ resteY /= 2; /* half for the top, half for the bottom */
#if DEBUG_LEVEL
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);
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) +
@ -69,17 +68,20 @@ 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;
}
@ -93,19 +95,16 @@ 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 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)) ) {
if ( (foo=Image_compare_desc(src, dst)) )
{
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -114,7 +113,8 @@ 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,9 +127,11 @@ 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;
@ -152,12 +154,8 @@ int x, y, v1, v2, r, g, b;
int xmax, ymax;
Image_Rect zone;
#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)) ) {
if ( (foo=Image_compare_desc(src, dst)) )
{
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -166,7 +164,8 @@ 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;
}
@ -176,9 +175,11 @@ 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];
@ -220,7 +221,8 @@ 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);
@ -260,7 +262,8 @@ 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;
}
@ -270,7 +273,8 @@ 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,7 +11,8 @@
/*
* 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;
@ -65,7 +66,8 @@ 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 "XXXXXXX warning: $0 is an ugly installer"
echo "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/8x8std Datas/16x24gruik $DESTDIR/share/libimage/
cp -v Datas/8x8thin Datas/16x24thin $DESTDIR/share/libimage/
cp -v 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 \