Compare commits
No commits in common. "8f29cb0db033b5171fc50a99e810c7182cef9970" and "a587a66af83e45a9a5b58aa4fc54c823b33632a5" have entirely different histories.
8f29cb0db0
...
a587a66af8
1
.gitignore
vendored
1
.gitignore
vendored
@ -66,7 +66,6 @@ tools/*.tiff
|
||||
Fonderie/*.o
|
||||
Fonderie/*.png
|
||||
Fonderie/*.pnm
|
||||
Fonderie/*.gif
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
Fonderie/t
|
||||
|
@ -7,7 +7,7 @@ COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
LIBS = ../libfloatimg.a -lpnglite -lm
|
||||
|
||||
OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o
|
||||
DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h
|
||||
DEPS = fonctions.h crapulator.h metriques.h glitches.h
|
||||
|
||||
all: fonderie interpolator t
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "fonctions.h"
|
||||
#include "crapulator.h"
|
||||
#include "glitches.h"
|
||||
#include "sfx.h"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
static int effect_3(FloatImg *image)
|
||||
@ -123,16 +122,13 @@ switch (idFx) {
|
||||
case 11:
|
||||
retval = trinarize(image, 0);
|
||||
break;
|
||||
case 12:
|
||||
retval = fimg_lissage_2x2(image);
|
||||
break;
|
||||
case 24: /* experiment ! */
|
||||
retval = des_bords_sombres_a(image, 160);
|
||||
break;
|
||||
case 25:
|
||||
/* please make this function more tweakable */
|
||||
retval = vertical_singlitch(image, 290+rand()%45,
|
||||
fval, 0.19, 0);
|
||||
retval = vertical_singlitch(image, 290+rand()%35,
|
||||
fval, 0.18, 0);
|
||||
break;
|
||||
default :
|
||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
OUTF='/tmp/out_a*.png'
|
||||
|
||||
rm $OUTF
|
||||
|
||||
make t && ./t
|
||||
|
||||
|
||||
A_PART=$(ls -1 $OUTF)
|
||||
Z_PART=$(ls -r1 $OUTF)
|
||||
|
||||
convert -delay 10 ${A_PART} ${Z_PART} foo.gif
|
||||
|
||||
|
||||
|
||||
|
@ -37,5 +37,16 @@ int create_fifo(int nbslot, int w, int h, int t);
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* funcs in 'sfx.c' ---> sfx.h
|
||||
* funcs in 'sfx.c'
|
||||
*/
|
||||
|
||||
int des_bords_sombres_a(FloatImg *pimg, int offset);
|
||||
int trinarize(FloatImg *pimg, int notused);
|
||||
int binarize(FloatImg *pimg, int notused);
|
||||
|
||||
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
|
||||
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
|
||||
int colors_brotcher(FloatImg *fimg, float fval);
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
|
@ -113,26 +113,11 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo)
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* used by vertical_singlitch()
|
||||
*/
|
||||
int x_delta(float dy, float phy)
|
||||
{
|
||||
float param, fv;
|
||||
param = dy + phy;
|
||||
fv = 9.999*sin(param) + 6.666*sin(param*3) + 3.333*sin(param*5);
|
||||
return (int)fv;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* please explain arguments
|
||||
*/
|
||||
int vertical_singlitch(FloatImg *picz, int xpos, float fval,
|
||||
float omega, float phi)
|
||||
{
|
||||
int y, x, w, h;
|
||||
float dy;
|
||||
float fv;
|
||||
double dy;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz,
|
||||
@ -140,23 +125,21 @@ fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz,
|
||||
#endif
|
||||
|
||||
h = picz->height; w = picz->width;
|
||||
#define BB 4
|
||||
#define BB 10
|
||||
for (y=BB; y<h-BB; y++) {
|
||||
|
||||
dy = (float)y * omega; /* normalize vertical position */
|
||||
dy = (double)y * omega;
|
||||
|
||||
x = xpos + x_delta(dy, phi); /* add sinus deviation */
|
||||
x = xpos + (int)(10.9*sin(dy+phi)); /* add sinus deviation */
|
||||
|
||||
/* compute bounding box */
|
||||
if ( (x>BB) && (x<w-BB) ) {
|
||||
/* an make the glitch */
|
||||
fimg_plot_rgb(picz, x, y, fval, fval, fval);
|
||||
fv = fval / 3.0;
|
||||
if (rand() & 8)
|
||||
fimg_plot_rgb(picz, x-1, y, fv, fv, fv);
|
||||
fimg_plot_rgb(picz, x-1, y, 0.0, 0.0, 0.0);
|
||||
if (rand() & 8)
|
||||
// XXX else
|
||||
fimg_plot_rgb(picz, x+1, y, fv, fv, fv);
|
||||
fimg_plot_rgb(picz, x+1, y, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -8,10 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
#include <floatimg.h>
|
||||
|
||||
#include "fonctions.h"
|
||||
#include "sfx.h"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/* here are global vars exported by the main module
|
||||
@ -73,23 +72,25 @@ mBb = (mm[5] - mm[4]) * 0.66666;
|
||||
|
||||
size = pimg->width * pimg->height;
|
||||
|
||||
#define VAL (255.0)
|
||||
|
||||
for (foo=0; foo<size; foo++) {
|
||||
|
||||
fptr = pimg->R;
|
||||
if (fptr[foo] < mRa || fptr[foo] > mRb)
|
||||
fptr[foo] = mm[0];
|
||||
fptr[foo] = 0.0;
|
||||
else
|
||||
fptr[foo] = mm[1];
|
||||
|
||||
fptr = pimg->G;
|
||||
if (fptr[foo] < mGa || fptr[foo] > mGb)
|
||||
fptr[foo] = mm[2];
|
||||
fptr[foo] = 0.0;
|
||||
else
|
||||
fptr[foo] = mm[3];
|
||||
|
||||
fptr = pimg->B;
|
||||
if (fptr[foo] < mBa || fptr[foo] > mBb)
|
||||
fptr[foo] = mm[4];
|
||||
fptr[foo] = 0.0;
|
||||
else
|
||||
fptr[foo] = mm[5];
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* sfx.h - special effects for fonderie & interpolator
|
||||
*/
|
||||
|
||||
|
||||
int des_bords_sombres_a(FloatImg *pimg, int offset);
|
||||
|
||||
int trinarize(FloatImg *pimg, int notused); // in sfx.c
|
||||
|
||||
int binarize(FloatImg *pimg, int notused);
|
||||
|
||||
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
|
||||
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
|
||||
int colors_brotcher(FloatImg *fimg, float fval);
|
||||
|
19
Fonderie/t.c
19
Fonderie/t.c
@ -8,7 +8,6 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
#include "glitches.h"
|
||||
#include "sfx.h"
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
@ -16,10 +15,13 @@ int verbosity;
|
||||
|
||||
#define PNG "out.png"
|
||||
#define W 512
|
||||
#define H 256
|
||||
#define LMAX 249.9999
|
||||
#define H 512
|
||||
#define LMAX 233.333
|
||||
#define TIMER 1
|
||||
|
||||
|
||||
int trinarize(FloatImg *pimg, int notused); // in sfx.c
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, iter, xloc, bloub;
|
||||
@ -38,16 +40,16 @@ if (foo) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// fimg_printhead(&image);
|
||||
fimg_printhead(&image);
|
||||
|
||||
srand(getpid());
|
||||
debut = fimg_timer_set(TIMER);
|
||||
|
||||
fimg_hdeg_a(&image, LMAX);
|
||||
for (iter=0; iter<16; iter++) {
|
||||
|
||||
for (iter=0; iter<32; iter++) {
|
||||
fimg_vdeg_a(&image, LMAX);
|
||||
|
||||
for (bloub=0; bloub<6; bloub++) {
|
||||
for (bloub=0; bloub<16; bloub++) {
|
||||
xloc = rand() % W;
|
||||
omega = (float)(0.1 + drand48()*0.6) * 0.4;
|
||||
foo = vertical_singlitch(&image, xloc, LMAX,
|
||||
@ -62,7 +64,6 @@ for (iter=0; iter<32; iter++) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
foo = trinarize(&image, 0); /* XXX */
|
||||
|
||||
sprintf(buff, "/tmp/out_b%03d.png", iter);
|
||||
@ -71,7 +72,7 @@ for (iter=0; iter<32; iter++) {
|
||||
fprintf(stderr, "err %d saving to '%s'\n", foo, buff);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
fin = fimg_timer_set(TIMER);
|
||||
|
Loading…
Reference in New Issue
Block a user