is _clear_rectangle working ?
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
@@ -23,7 +25,11 @@ fprintf(stderr, ">>> %s ( %p %p )\n", __func__, pi, coo);
|
||||
|
||||
for (line=0; line<coo[3]; line++) {
|
||||
off = (line+coo[1])*pi->width + coo[0];
|
||||
fprintf(stderr, "line %d off %d\n", line, off);
|
||||
// fprintf(stderr, "line %3d off %8d\n", line, off);
|
||||
/* Kaboum ! */
|
||||
memset(pi->R + off, 0, coo[2]*sizeof(float));
|
||||
memset(pi->G + off, 0, coo[2]*sizeof(float));
|
||||
memset(pi->B + off, 0, coo[2]*sizeof(float));
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -24,7 +24,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
|
||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
||||
Geometrie, FileType, Mirror, KillRGB,
|
||||
Pixelize,SplitLevel,DecompRgbz };
|
||||
Pixelize,SplitLevel,DecompRgbz, Rectangle };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@@ -56,6 +56,7 @@ Command commands[] = {
|
||||
{ "pixelize", Pixelize },
|
||||
{ "spltlvl", SplitLevel },
|
||||
{ "decomprgbz", DecompRgbz },
|
||||
{ "rectangle", Rectangle },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@@ -233,6 +234,10 @@ switch(opt) {
|
||||
case DecompRgbz:
|
||||
foo = essai_decomprgb(filename, outfile);
|
||||
break;
|
||||
case Rectangle:
|
||||
essai_rectangle(outfile, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
exit(1);
|
||||
|
||||
@@ -17,6 +17,31 @@
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_rectangle(char *outf, int k)
|
||||
{
|
||||
FloatImg img;
|
||||
int foo;
|
||||
int rect[4];
|
||||
|
||||
foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB);
|
||||
|
||||
fimg_drand48(&img, 1.0);
|
||||
|
||||
rect[0] = 100; rect[1] = 100;
|
||||
rect[2] = 32; rect[3] = 16;
|
||||
|
||||
foo = fimg_clear_rectangle(&img, rect);
|
||||
|
||||
foo = fimg_export_picture(&img, outf, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
fimg_destroy(&img);
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_killrgb(char *inf, char *outf)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user