e576bb | 2002-10-11 | Martin Nilsson | |
|
c43fc1 | 1999-03-01 | Henrik Wallin | |
|
2384d5 | 2012-04-13 | Henrik Grubbström (Grubba) | | NEIG is 1, xz, xz+1 or xz-1
|
c43fc1 | 1999-03-01 | Henrik Wallin | | IMAGE_PHASE image_phase(h|v|hv|vh) Name of the function
*/
void IMAGE_PHASE(INT32 args)
{
struct object *o;
struct image *img,
*this;
rgb_group *imgi=0,*thisi=0;
int y, x;
int yz, xz;
int ys, xs;
|
b2d3e4 | 2000-12-01 | Fredrik Hübinette (Hubbe) | | if (!THIS->img) { Pike_error("no image\n"); return; }
|
c43fc1 | 1999-03-01 | Henrik Wallin | | this=THIS;
thisi=this->img;
push_int(this->xsize);
push_int(this->ysize);
o=clone_object(image_program,2);
img=(struct image*)get_storage(o,image_program);
imgi=img->img;
pop_n_elems(args);
THREADS_ALLOW();
xz=this->xsize;
yz=this->ysize;
xs=this->xsize-1;
ys=this->ysize-1;
#define DALOOP(R) \
for(y=1; y<ys; y++) \
for(x=1; x<xs; x++) \
{\
int i;\
int V,H;\
|
2384d5 | 2012-04-13 | Henrik Grubbström (Grubba) | | i=y*xz+x;\
|
c43fc1 | 1999-03-01 | Henrik Wallin | | V=thisi[i-(NEIG)].R-thisi[i].R;\
H=thisi[i+(NEIG)].R-thisi[i].R;\
if ((V==0)&&(H==0))\
{\
/*\
In this case a check to see what there are at the sides \
should be done\
*/\
imgi[i].R=0;\
}\
else \
{\
if (V==0) imgi[i].R=32;\
else if (H==0) imgi[i].R=256-32;\
else\
{\
if (abs(V)>abs(H))\
if (V<0)\
|
d69502 | 2014-01-11 | Arne Goedeke | | imgi[i].R=DOUBLE_TO_COLORTYPE(0.5+224+(((float)H)/(0-V))*32.0);\
|
c43fc1 | 1999-03-01 | Henrik Wallin | | else\
|
d69502 | 2014-01-11 | Arne Goedeke | | imgi[i].R=DOUBLE_TO_COLORTYPE(0.5+96+(((float)H)/(V))*32.0);\
|
c43fc1 | 1999-03-01 | Henrik Wallin | | else\
if (H<0)\
|
d69502 | 2014-01-11 | Arne Goedeke | | imgi[i].R=DOUBLE_TO_COLORTYPE(0.5+32+(((float)V)/(0-H))*32.0);\
|
c43fc1 | 1999-03-01 | Henrik Wallin | | else\
|
d69502 | 2014-01-11 | Arne Goedeke | | imgi[i].R=DOUBLE_TO_COLORTYPE(0.5+160+(((float)V)/(H))*32.0);\
|
c43fc1 | 1999-03-01 | Henrik Wallin | | }\
}\
}
DALOOP(r)
DALOOP(g)
DALOOP(b)
#undef DALOOP
THREADS_DISALLOW();
|
bcf538 | 2005-11-10 | Henrik Grubbström (Grubba) | | push_object(o);
|
c43fc1 | 1999-03-01 | Henrik Wallin | | }
|