forked from tTh/FloatImg
+ line shifter and bla
This commit is contained in:
parent
af1a48f149
commit
864c8d2d05
@ -218,6 +218,10 @@ switch (idFx) {
|
||||
retval = random_blocks(image, 70);
|
||||
break;
|
||||
|
||||
case CR_shiftln0:
|
||||
retval = multilines_shift_0(image, 11, 120);
|
||||
break;
|
||||
|
||||
case CR_message:
|
||||
fprintf(stderr, "### message from pid %d, fv=%f ###\n",
|
||||
getpid(), fval);
|
||||
@ -289,18 +293,15 @@ return "???";
|
||||
/* -------------------------------------------------------------- */
|
||||
int crap_number_from_name(char *name)
|
||||
{
|
||||
int idx, foo, retval;
|
||||
int idx, retval;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name);
|
||||
#endif
|
||||
|
||||
retval = -1; /* not found */
|
||||
|
||||
for (idx=0; CrapL[idx].id!=-1; idx++) {
|
||||
|
||||
foo = strcmp(CrapL[idx].name, name);
|
||||
if (0 == foo) {
|
||||
if (0 == strcmp(CrapL[idx].name, name)) {
|
||||
// fprintf(stderr, "found '%s' -> %d\n", name,
|
||||
// CrapL[idx].id);
|
||||
retval = CrapL[idx].id;
|
||||
|
@ -2,18 +2,20 @@
|
||||
* crapulator.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* some constants for effect numbers */
|
||||
|
||||
/*
|
||||
* the main function */
|
||||
|
||||
int crapulator(FloatImg *image, int id_effect, float fparam);
|
||||
|
||||
/*
|
||||
* naming system */
|
||||
void list_crapulors(char *texte);
|
||||
|
||||
char *crap_name_from_number(int num);
|
||||
int crap_number_from_name(char *name);
|
||||
|
||||
/*
|
||||
* this generated file contains the #define
|
||||
* for symbolic name of effect ids.
|
||||
*/
|
||||
#include "crapdef.h"
|
||||
|
||||
|
@ -22,5 +22,6 @@
|
||||
24 bsombra 1 1.0
|
||||
25 vsglitch 1 1.0
|
||||
26 rndblks 1 1.0
|
||||
27 shiftln0 1 1.0
|
||||
99 message 1 1.0
|
||||
-1 end 1 1.0
|
||||
|
@ -208,6 +208,11 @@ for (;;) {
|
||||
value = crap_number_from_name(cptr);
|
||||
// fprintf(stderr, "%s: '%s' -> %d\n", __func__,
|
||||
// cptr, value);
|
||||
if (value < 0) {
|
||||
fprintf(stderr, "%s: '%s' not found\n",
|
||||
__func__, cptr);
|
||||
return -1;
|
||||
}
|
||||
foo = filterstack_add(numid, value, 1, 1.0);
|
||||
continue;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
@ -188,4 +189,48 @@ for (y=BB; y<h-BB; y++) {
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
static void shifter(float *fs, float *fd, int w, int nbr)
|
||||
{
|
||||
int krkr;
|
||||
|
||||
for (krkr=0; krkr<nbr; krkr++) {
|
||||
fd[krkr] = fs[(krkr+w)%nbr];
|
||||
}
|
||||
/* take your sixpack, film at 11 */
|
||||
}
|
||||
|
||||
int multilines_shift_0(FloatImg *picz, int step, int nombre)
|
||||
{
|
||||
float *buffline, *sptr;
|
||||
int idx, ypos;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, picz, step, nombre);
|
||||
#endif
|
||||
|
||||
buffline = alloca(picz->width * sizeof(float));
|
||||
if (NULL==buffline) {
|
||||
fprintf(stderr, "%s: memory panic\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
for (idx=0; idx<nombre; idx++) {
|
||||
ypos = rand() % picz->height;
|
||||
|
||||
sptr = picz->R + (ypos * picz->width);
|
||||
shifter(sptr, buffline, step, picz->width);
|
||||
memcpy(sptr, buffline, picz->width*sizeof(float));
|
||||
|
||||
sptr = picz->G + (ypos * picz->width);
|
||||
shifter(sptr, buffline, step, picz->width);
|
||||
memcpy(sptr, buffline, picz->width*sizeof(float));
|
||||
|
||||
sptr = picz->B + (ypos * picz->width);
|
||||
shifter(sptr, buffline, step, picz->width);
|
||||
memcpy(sptr, buffline, picz->width*sizeof(float));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
|
@ -12,5 +12,6 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo);
|
||||
|
||||
int vertical_singlitch(FloatImg *picz, int xpos, float fv, float omega,
|
||||
float phi);
|
||||
int multilines_shift_0(FloatImg *picz, int step, int nombre);
|
||||
|
||||
/* this is a wtf file */
|
||||
|
@ -229,9 +229,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
/* XXX THIS CODE DON'T WORK !!! */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
fprintf(stderr, "\ngenerated %d png files\n", ipng);
|
||||
@ -273,11 +270,11 @@ fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
//#if DEBUG_LEVEL
|
||||
#if DEBUG_LEVEL
|
||||
/* this is for the debug off calling shellscript */
|
||||
for (foo=0; foo<argc; foo++)
|
||||
fprintf(stderr, "%5d %s\n", foo, argv[foo]);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "E:F:hLS:vw:x:")) != -1) {
|
||||
switch(opt) {
|
||||
|
@ -69,6 +69,9 @@ return 0;
|
||||
int help(void)
|
||||
{
|
||||
puts("yolo!");
|
||||
|
||||
puts("\t-L\tlist available filters");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
@ -103,11 +106,14 @@ fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hF:i:o:vx")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hF:i:Lo:vx")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'F': filterchain = optarg; break;
|
||||
case 'i': infile = optarg; break;
|
||||
case 'L':
|
||||
list_crapulors("available filters");
|
||||
exit(0);
|
||||
case 'o': outfile = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'x': experiment(); break;
|
||||
|
Loading…
Reference in New Issue
Block a user