FloatImg/experiment/assemblage.c
2021-03-28 18:52:03 +02:00

70 lines
1.3 KiB
C

/*
* 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, 13.37);
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 = incrustator_0(&incrust, &grande, 100, 100, 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;
}
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int main(int argc, char *argv[])
{
int foo;
verbosity = 1;
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;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */