three more tools compiled
This commit is contained in:
18
Lib/Makefile
18
Lib/Makefile
@@ -37,6 +37,7 @@ combine4.o: combine4.c $(DEPS)
|
||||
combine5.o: combine5.c $(DEPS)
|
||||
combine6.o: combine6.c $(DEPS)
|
||||
|
||||
detect.o: detect.c $(DEPS)
|
||||
distances.o: distances.c $(DEPS)
|
||||
dither.o: dither.c $(DEPS)
|
||||
dither2.o: dither2.c $(DEPS)
|
||||
@@ -50,10 +51,13 @@ drawpatt.o: drawpatt.c $(DEPS)
|
||||
effects.o: effects.c $(DEPS)
|
||||
effects2.o: effects2.c $(DEPS)
|
||||
effects3.o: effects3.c $(DEPS)
|
||||
extractbits.o: extractbits.c $(DEPS)
|
||||
|
||||
filtadapt.o: filtadapt.c $(DEPS)
|
||||
filtres.o: filtres.c $(DEPS)
|
||||
|
||||
gadgrect.o: gadgrect.c $(DEPS)
|
||||
glitch.o: glitch.c $(DEPS)
|
||||
|
||||
halfsize.o: halfsize.c $(DEPS)
|
||||
|
||||
@@ -77,6 +81,7 @@ patterns.o: patterns.c $(DEPS)
|
||||
patterns2.o: patterns2.c $(DEPS)
|
||||
patterns3.o: patterns3.c $(DEPS)
|
||||
patterns4.o: patterns4.c $(DEPS)
|
||||
photomaton.o: photomaton.c $(DEPS)
|
||||
pht.o: pht.c $(DEPS)
|
||||
pixeliz.o: pixeliz.c $(DEPS)
|
||||
pixels.o: pixels.c $(DEPS)
|
||||
@@ -90,6 +95,7 @@ pov_hf15f.o: pov_hf15f.c $(DEPS)
|
||||
pov_synth.o: pov_synth.c $(DEPS)
|
||||
ptlist.o: ptlist.c $(DEPS)
|
||||
|
||||
recurse.o: recurse.c $(DEPS)
|
||||
rgbmask.o: rgbmask.c $(DEPS)
|
||||
|
||||
scale.o: scale.c $(DEPS)
|
||||
@@ -121,12 +127,12 @@ OBJECTS = 7seg.o \
|
||||
calculs.o classif.o \
|
||||
col4bits.o colors.o colors2.o col_reduc.o col_xyz.o \
|
||||
combine.o combine2.o combine3.o combine4.o combine5.o \
|
||||
distances.o \
|
||||
detect.o distances.o \
|
||||
dither.o dither2.o dither3.o dither4.o \
|
||||
doublesz.o drawalpha.o drawing.o drawpatt.o \
|
||||
effects.o effects2.o effects3.o \
|
||||
filtres.o \
|
||||
gadgrect.o \
|
||||
effects.o effects2.o effects3.o extractbits.o \
|
||||
filtadapt.o filtres.o \
|
||||
gadgrect.o glitch.o \
|
||||
halfsize.o \
|
||||
image.o imprime.o \
|
||||
luts15bits.o \
|
||||
@@ -135,11 +141,11 @@ OBJECTS = 7seg.o \
|
||||
operat.o op2x2.o \
|
||||
palettes.o \
|
||||
patterns.o patterns2.o patterns3.o patterns4.o \
|
||||
pht.o pixeliz.o pixels.o plotteur.o \
|
||||
photomaton.o pht.o pixeliz.o pixels.o plotteur.o \
|
||||
pov_hf15a.o pov_hf15b.o pov_hf15c.o pov_hf15d.o \
|
||||
pov_hf15e.o pov_hf15e.o pov_hf15f.o pov_synth.o \
|
||||
ptlist.o \
|
||||
rgbmask.o \
|
||||
recurse.o rgbmask.o \
|
||||
scale.o sobel4.o \
|
||||
tamppool.o television.o text0.o text1.o text16x24.o \
|
||||
tga.o tools.o \
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tthimage.h"
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
@@ -87,7 +87,7 @@ return OLL_KORRECT;
|
||||
/*
|
||||
* on cherche les endroits ou le niveau de gris est 'plat'.
|
||||
*
|
||||
* le paramètre 'r1' n'est pas utilise et doit etre mis à 0
|
||||
* le parametre 'r1' n'est pas utilise et doit etre mis a 0
|
||||
*/
|
||||
int
|
||||
Image_detect_flat_gray(Image_Desc *src, Image_Desc *dst, int param, int r1)
|
||||
@@ -140,7 +140,7 @@ for (y=1; y<src->height-1; y++)
|
||||
}
|
||||
/*
|
||||
* hop, en finale, on efface les bords, et on
|
||||
* marque l'image "modifiée".
|
||||
* marque l'image "modifiee".
|
||||
*/
|
||||
(void)Image_raz_sides(dst);
|
||||
dst->modified = 1;
|
||||
|
||||
60
Lib/extractbits.c
Normal file
60
Lib/extractbits.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* extractbits.c
|
||||
* new 11 mars 2014
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Image_extrbits_0(Image_Desc *src, Image_Desc *dst, int rs, int gs, int bs)
|
||||
{
|
||||
int x, y, foo;
|
||||
int mr, mg, mb, r, g, b;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s ( %p %p %d %d %d )\n", __func__, src, dst, rs, gs, bs);
|
||||
#endif
|
||||
|
||||
if ( rs<0 || gs<0 || bs<0 ) {
|
||||
fprintf(stderr, "%s : no negativ shift\n", __func__);
|
||||
return BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if ( rs>8 || gs>8 || bs>8 ) {
|
||||
fprintf(stderr, "%s : no shift > 7\n", __func__);
|
||||
return BAD_PARAMETER;
|
||||
}
|
||||
|
||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
mr = 1 << rs;
|
||||
mg = 1 << gs;
|
||||
mb = 1 << bs;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s masques = 0x%02x 0X%02x 0x%02x\n", __func__, mr, mg, mb);
|
||||
#endif
|
||||
|
||||
for (y=0; y<dst->height; y++)
|
||||
{
|
||||
for (x=0; x<dst->width; x++)
|
||||
{
|
||||
r = ((src->Rpix[y])[x] & mr) ? 255 : 0;
|
||||
dst->Rpix[y][x] = r;
|
||||
g = ((src->Gpix[y])[x] & mg) ? 255 : 0;
|
||||
dst->Gpix[y][x] = g;
|
||||
b = ((src->Bpix[y])[x] & mb) ? 255 : 0;
|
||||
dst->Bpix[y][x] = b;
|
||||
}
|
||||
}
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*::------------------------------------------------------------------::*/
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "tthimage.h"
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tthimage.h"
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Image_GlitchMe(Image_Desc *src, Image_Desc *dst, char code,
|
||||
|
||||
93
Lib/photomaton.c
Normal file
93
Lib/photomaton.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
D'apres un article paru dans 'Pour la Science', et il faudrait
|
||||
que je retrouve les references exactes... Et je ,'ai meme pas
|
||||
la date de ce numero de la revue :(
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_photomaton_0(Image_Desc *src, Image_Desc *dst)
|
||||
{
|
||||
int x, y, w, h;
|
||||
int r, g, b;
|
||||
|
||||
if (src->width & 1)
|
||||
{
|
||||
w = src->width - 1;
|
||||
fprintf(stderr, "photomaton: width is odd, ajust %d\n", w);
|
||||
}
|
||||
else
|
||||
w = src->width;
|
||||
|
||||
if (src->height & 1)
|
||||
{
|
||||
h = src->height - 1;
|
||||
fprintf(stderr, "photomaton: height is odd, ajust %d\n", h);
|
||||
}
|
||||
else
|
||||
h = src->height;
|
||||
|
||||
|
||||
for (y=0; y<src->height/2; y++)
|
||||
{
|
||||
for (x=0; x<src->width/2; x++)
|
||||
{
|
||||
Image_getRGB(src, x*2, y*2, &r, &g, &b);
|
||||
Image_plotRGB(dst, x, y, r, g, b);
|
||||
|
||||
Image_getRGB(src, (x*2)+1, y*2, &r, &g, &b);
|
||||
Image_plotRGB(dst, x+(src->width/2), y, r, g, b);
|
||||
|
||||
Image_getRGB(src, x*2, (y*2)+1, &r, &g, &b);
|
||||
Image_plotRGB(dst, x, y+(src->height/2), r, g, b);
|
||||
|
||||
Image_getRGB(src, (x*2)+1, (y*2)+1, &r, &g, &b);
|
||||
Image_plotRGB(dst, x+(src->width/2), y+(src->height/2), r,g,b);
|
||||
}
|
||||
}
|
||||
|
||||
dst->modified = 1;
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_photomaton_n(Image_Desc *src, Image_Desc *dst, int nb)
|
||||
{
|
||||
Image_Desc *tmp;
|
||||
int foo;
|
||||
|
||||
if (nb < 1)
|
||||
{
|
||||
fprintf(stderr, "photomaton_n: %d invalid\n", nb);
|
||||
return INVALID_PARAM;
|
||||
}
|
||||
|
||||
tmp = Image_clone(src, 1); /* copier aussi les pixels */
|
||||
if (tmp==NULL)
|
||||
{
|
||||
fprintf(stderr, "no mem in %s %d %s\n", __FILE__, __LINE__, __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
for (foo=0; foo<nb; foo++)
|
||||
{
|
||||
Image_photomaton_0(tmp, dst);
|
||||
Image_copy(dst, tmp);
|
||||
fprintf(stderr, "photomaton N: passe %d\n", foo);
|
||||
}
|
||||
|
||||
Image_copy(tmp, dst);
|
||||
Image_DeAllocate(tmp); free(tmp);
|
||||
|
||||
dst->modified = 1;
|
||||
|
||||
return FUNC_NOT_FINISH;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
154
Lib/recurse.c
Normal file
154
Lib/recurse.c
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
RECURSION 'QUADTREE' SUR LES IMAGES
|
||||
-----------------------------------
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../tthimage.h"
|
||||
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* bon, c'est qu'un essai, mais il me semble prometteur.
|
||||
* ceci dit, à l'epoque du Copam, il me semble que j'avais
|
||||
* fait le meme genre de truc, mais en bien mieux...
|
||||
*
|
||||
*/
|
||||
static Image_Desc *S, *D;
|
||||
static int seuil;
|
||||
static int level, maxlevel;
|
||||
|
||||
static int
|
||||
recursion(Image_Rect *pRect)
|
||||
{
|
||||
Image_Rect rect;
|
||||
int h1, h2, w1, w2, xx, yy, foo;
|
||||
|
||||
int mr, mg, mb, dr, dg, db, s;
|
||||
|
||||
level++;
|
||||
if (level > maxlevel)
|
||||
maxlevel = level;
|
||||
|
||||
#if DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "%5d -> %3d %3d %3d %3d\n",
|
||||
level, pRect->x, pRect->y, pRect->w, pRect->h);
|
||||
#endif
|
||||
|
||||
foo = Image_stats_zone_0(S, pRect, &mr, &mg, &mb, &dr, &dg, &db);
|
||||
s = (dr + dg + db) / 3;
|
||||
#if DEBUG_LEVEL > 1
|
||||
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);
|
||||
#endif
|
||||
|
||||
if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) )
|
||||
{
|
||||
Image_paint_rect(D, pRect, mr, mg, mb);
|
||||
/* printf(" paint %d %d %d\n", mr, mg, mb); */
|
||||
}
|
||||
else
|
||||
{
|
||||
Image_paint_rect(D, pRect, 255, 0, 0);
|
||||
/* Image_dump_rect(pRect, "R", 0); */
|
||||
|
||||
if ( pRect->h & 1 ) /* impair */
|
||||
{
|
||||
h1 = (pRect->h / 2) + 1;
|
||||
h2 = (pRect->h / 2);
|
||||
yy = (pRect->h / 2) + 1;
|
||||
}
|
||||
else /* pair */
|
||||
{
|
||||
h1 = (pRect->h / 2);
|
||||
h2 = (pRect->h / 2);
|
||||
yy = (pRect->h / 2);
|
||||
}
|
||||
|
||||
if ( pRect->w & 1 ) /* impair */
|
||||
{
|
||||
w1 = (pRect->w / 2) + 1;
|
||||
w2 = (pRect->w / 2);
|
||||
xx = (pRect->w / 2) + 1;
|
||||
}
|
||||
else /* pair */
|
||||
{
|
||||
w1 = (pRect->w / 2);
|
||||
w2 = (pRect->w / 2);
|
||||
xx = (pRect->w / 2);
|
||||
}
|
||||
|
||||
/*
|
||||
printf(" w1 %3d w2 %3d \n", w1, w2);
|
||||
printf(" h1 %3d h2 %3d \n", h1, h2);
|
||||
printf(" xx %3d yy %3d \n", xx, yy);
|
||||
printf("\n");
|
||||
*/
|
||||
|
||||
rect.x = pRect->x; rect.y = pRect->y;
|
||||
rect.w = w1; rect.h = h1;
|
||||
|
||||
recursion(&rect);
|
||||
|
||||
rect.x = pRect->x + xx; rect.y = pRect->y;
|
||||
rect.w = w2; rect.h = h1;
|
||||
|
||||
recursion(&rect);
|
||||
|
||||
rect.x = pRect->x; rect.y = pRect->y + yy;
|
||||
rect.w = w1; rect.h = h2;
|
||||
|
||||
recursion(&rect);
|
||||
|
||||
rect.x = pRect->x + xx; rect.y = pRect->y + yy;
|
||||
rect.w = w2; rect.h = h2;
|
||||
|
||||
recursion(&rect);
|
||||
}
|
||||
|
||||
level--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* a quoi peut bien servir le parametre ?
|
||||
*/
|
||||
int
|
||||
Image_call_recursion_0(Image_Desc *image, Image_Desc *dest, int param)
|
||||
{
|
||||
Image_Rect rect;
|
||||
int foo;
|
||||
|
||||
rect.x = rect.y = 0;
|
||||
rect.h = image->height;
|
||||
rect.w = image->width;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "-> demarrage de la recursion\n");
|
||||
#endif
|
||||
|
||||
S = image; D = dest;
|
||||
seuil = param;
|
||||
level = maxlevel = 0;
|
||||
|
||||
foo = recursion(&rect);
|
||||
fprintf(stderr, "-> fin recursion: %d, maxlevel=%d\n", foo, maxlevel);
|
||||
|
||||
dest->modified = 1;
|
||||
|
||||
return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Image_call_recursion(Image_Desc *image, Image_Desc *dest, int param)
|
||||
{
|
||||
int foo;
|
||||
|
||||
fprintf(stderr, "XXX %s is obsolete XXX\n", __func__);
|
||||
foo = Image_call_recursion_0(image, dest, param);
|
||||
|
||||
return foo;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
Reference in New Issue
Block a user