forked from tTh/FloatImg
is _clear_rectangle working ?
This commit is contained in:
parent
0e79b3e8fa
commit
5845ab7962
@ -54,14 +54,10 @@ static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
|
|||||||
{
|
{
|
||||||
int x, y, pline, off;
|
int x, y, pline, off;
|
||||||
|
|
||||||
|
fimg_clear_rectangle(pimg, pos);
|
||||||
|
|
||||||
for (y=pos[1]; y<pos[1]+pos[3]; y++) {
|
for (y=pos[1]; y<pos[1]+pos[3]; y++) {
|
||||||
pline = y*pimg->width;
|
pline = y*pimg->width;
|
||||||
#if 0
|
|
||||||
for (x=0; x<(pos[0]+pos[2]); x++) {
|
|
||||||
off = pline + x;
|
|
||||||
pimg->R[off]=pimg->G[off]=pimg->B[off]=0.0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
for (x=pos[0]+2; x<(pos[0]+pos[2]-2); x++) {
|
for (x=pos[0]+2; x<(pos[0]+pos[2]-2); x++) {
|
||||||
off = pline + x;
|
off = pline + x;
|
||||||
/* wtf i'm doing here ? */
|
/* wtf i'm doing here ? */
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* http://la.buvette.org/photos/cumul
|
* http://la.buvette.org/photos/cumul
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIMG_VERSION 158
|
#define FIMG_VERSION 160
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in memory descriptor
|
* in memory descriptor
|
||||||
@ -108,6 +108,7 @@ typedef struct {
|
|||||||
|
|
||||||
int fimg_killborders(FloatImg *img);
|
int fimg_killborders(FloatImg *img);
|
||||||
int fimg_lissage_2x2(FloatImg *img);
|
int fimg_lissage_2x2(FloatImg *img);
|
||||||
|
int fimg_show_filter(char *title, FimgFilter3x3 *filtr);
|
||||||
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
||||||
|
|
||||||
|
|
||||||
@ -248,6 +249,7 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused);
|
|||||||
int format_from_extension(char *fname);
|
int format_from_extension(char *fname);
|
||||||
char * extension_from_format(int fmt);
|
char * extension_from_format(int fmt);
|
||||||
|
|
||||||
|
int fimg_clear_rectangle(FloatImg *pimg, int rect[4]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "../floatimg.h"
|
#include "../floatimg.h"
|
||||||
@ -23,7 +25,11 @@ fprintf(stderr, ">>> %s ( %p %p )\n", __func__, pi, coo);
|
|||||||
|
|
||||||
for (line=0; line<coo[3]; line++) {
|
for (line=0; line<coo[3]; line++) {
|
||||||
off = (line+coo[1])*pi->width + coo[0];
|
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;
|
return -1;
|
||||||
|
@ -24,7 +24,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
|||||||
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
|
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
|
||||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
||||||
Geometrie, FileType, Mirror, KillRGB,
|
Geometrie, FileType, Mirror, KillRGB,
|
||||||
Pixelize,SplitLevel,DecompRgbz };
|
Pixelize,SplitLevel,DecompRgbz, Rectangle };
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int Cmd;
|
int Cmd;
|
||||||
@ -56,6 +56,7 @@ Command commands[] = {
|
|||||||
{ "pixelize", Pixelize },
|
{ "pixelize", Pixelize },
|
||||||
{ "spltlvl", SplitLevel },
|
{ "spltlvl", SplitLevel },
|
||||||
{ "decomprgbz", DecompRgbz },
|
{ "decomprgbz", DecompRgbz },
|
||||||
|
{ "rectangle", Rectangle },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@ -233,6 +234,10 @@ switch(opt) {
|
|||||||
case DecompRgbz:
|
case DecompRgbz:
|
||||||
foo = essai_decomprgb(filename, outfile);
|
foo = essai_decomprgb(filename, outfile);
|
||||||
break;
|
break;
|
||||||
|
case Rectangle:
|
||||||
|
essai_rectangle(outfile, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -17,6 +17,31 @@
|
|||||||
|
|
||||||
extern int verbosity;
|
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)
|
int essai_killrgb(char *inf, char *outf)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user