Compare commits
5 Commits
5d121dee87
...
dbee9eea6e
Author | SHA1 | Date | |
---|---|---|---|
|
dbee9eea6e | ||
|
3b0fc047ad | ||
|
7cf56ea70a | ||
|
f3c9d85c73 | ||
|
6e410e5f50 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -76,3 +76,8 @@ Fonderie/singlepass
|
||||
Fonderie/crapdef.h
|
||||
Fonderie/crapstr.h
|
||||
|
||||
experiment/assemblage
|
||||
experiment/*.fimg
|
||||
experiment/*.pnm
|
||||
experiment/*.o
|
||||
|
||||
|
@ -30,7 +30,7 @@ if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
incrustation_0(pimg, ©, 0);
|
||||
incrustation_vignette(pimg, ©, 0);
|
||||
|
||||
fimg_copy_data(©, pimg);
|
||||
|
||||
|
@ -24,7 +24,7 @@ extern int verbosity;
|
||||
/*
|
||||
* please, add some parameters !
|
||||
*/
|
||||
int incrustation_0(FloatImg *src, FloatImg *dst, int k)
|
||||
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k)
|
||||
{
|
||||
int x, y, x4, y4;
|
||||
float rgb[3];
|
||||
|
@ -3,7 +3,7 @@
|
||||
* ---------------------------------------------------
|
||||
*/
|
||||
|
||||
int incrustation_0(FloatImg *src, FloatImg *dst, int k);
|
||||
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);
|
||||
|
||||
|
||||
int trinitron(FloatImg *pimg, int notused);
|
||||
@ -16,10 +16,6 @@ int upside_down(FloatImg *pimg);
|
||||
|
||||
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);
|
||||
|
@ -176,7 +176,7 @@ if (foo) {
|
||||
foo = fimg_clone(&image, &dest, 1);
|
||||
foo = fimg_copy_data(&image, &dest);
|
||||
|
||||
incrustation_0(&image, &dest, 0);
|
||||
incrustation_vignette(&image, &dest, 0);
|
||||
|
||||
fimg_export_picture(&dest, "foo.png", 0);
|
||||
|
||||
|
@ -1 +1,16 @@
|
||||
# plasma experiment
|
||||
|
||||
# experiments
|
||||
|
||||
|
||||
COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm
|
||||
DEPS = ../floatimg.h ../libfloatimg.a Makefile
|
||||
LIBS = -ltiff -lpnglite -lcfitsio
|
||||
|
||||
all: assemblage
|
||||
|
||||
incrustator.o: incrustator.c incrustator.h Makefile
|
||||
gcc -c $(COPT) $<
|
||||
|
||||
assemblage: assemblage.c Makefile incrustator.o
|
||||
gcc $(COPT) $< incrustator.o ../libfloatimg.a $(LIBS) -o $@
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
# PLASMA EXPERIMENT
|
||||
|
||||
# ASSEMBLAGE
|
||||
|
||||
|
76
experiment/assemblage.c
Normal file
76
experiment/assemblage.c
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* assemblage experimental
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "incrustator.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
|
||||
int premier_essai(int largeur, int hauteur, char *outname)
|
||||
{
|
||||
FloatImg grande, incrust;
|
||||
int foo;
|
||||
|
||||
foo = fimg_create(&grande, largeur, hauteur, FIMG_TYPE_RGB);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: Kkrkr %d pour create grande\n", __func__, foo);
|
||||
return -1;
|
||||
}
|
||||
fimg_vdeg_a(&grande, 2345);
|
||||
|
||||
foo = fimg_create(&incrust, 640, 480, FIMG_TYPE_RGB);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: Kkrkr %d pour create incrust\n", __func__, foo);
|
||||
return -1;
|
||||
}
|
||||
// fimg_drand48(&incrust, 13.37);
|
||||
foo = fimg_load_from_dump("foo.fimg", &incrust);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d loading image\n", __func__, foo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
foo = incrustator_0(&incrust, &grande, 333, 333, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: Kkrkr %d sur incrustator_0\n", __func__, foo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
foo = fimg_export_picture(&grande, outname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: error %d export '%s'\n", __func__,
|
||||
foo, outname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fimg_destroy(&incrust); fimg_destroy(&grande);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo;
|
||||
|
||||
verbosity = 2;
|
||||
|
||||
fimg_print_version(1);
|
||||
|
||||
foo = premier_essai(1280, 1024, "out.pnm");
|
||||
if (foo) {
|
||||
fprintf(stderr, "EPIC FAIL %s\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
|
9
experiment/essai.sh
Executable file
9
experiment/essai.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
make assemblage
|
||||
|
||||
grabvidseq -vv -n 4 -p 3.3333 -o foo.fimg
|
||||
|
||||
./assemblage -v
|
||||
|
||||
display out.pnm
|
54
experiment/incrustator.c
Normal file
54
experiment/incrustator.c
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* incrustator experimental
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "incrustator.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
|
||||
int xpos, int ypos, int flags)
|
||||
{
|
||||
int y, srcpos, dstpos, szl;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d %d 0x%04X\n", __func__, psrc, pdst,
|
||||
xpos, ypos, flags);
|
||||
#endif
|
||||
|
||||
if (verbosity > 1) {
|
||||
fimg_describe(psrc, "source");
|
||||
fimg_describe(pdst, "destination");
|
||||
}
|
||||
|
||||
/* check boudaries */
|
||||
if ( (xpos < 0) || (xpos > pdst->width - psrc->width) ||
|
||||
(ypos < 0) || (ypos > pdst->height - psrc->height) ) {
|
||||
fprintf(stderr, "%s: boudary error\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* move all the data by looping over lines */
|
||||
srcpos = 0;
|
||||
dstpos = (ypos * pdst->width) + xpos;
|
||||
szl = psrc->width * sizeof(float);
|
||||
for (y=0; y<psrc->height; y++) {
|
||||
// fprintf(stderr, " %7d %7d %7d\n", y, srcpos, dstpos);
|
||||
|
||||
memcpy(pdst->R + dstpos, psrc->R + srcpos, szl);
|
||||
memcpy(pdst->G + dstpos, psrc->G + srcpos, szl);
|
||||
memcpy(pdst->B + dstpos, psrc->B + srcpos, szl);
|
||||
|
||||
srcpos += psrc->width;
|
||||
dstpos += pdst->width;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
7
experiment/incrustator.h
Normal file
7
experiment/incrustator.h
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* incrustator experimental
|
||||
*/
|
||||
|
||||
|
||||
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
|
||||
int xpos, int ypos, int flags);
|
Loading…
Reference in New Issue
Block a user