diff --git a/src/modules/Image/colors.c b/src/modules/Image/colors.c index fc3009fd6c948ca1330d4097184770e14c80c95b..2984278ebb9434599ff9cec69d25e1c6da05cd40 100644 --- a/src/modules/Image/colors.c +++ b/src/modules/Image/colors.c @@ -1,7 +1,7 @@ /* **! module Image **! note -**! $Id: colors.c,v 1.24 1999/06/22 19:25:57 mirar Exp $ +**! $Id: colors.c,v 1.25 1999/07/02 21:19:49 mirar Exp $ **! submodule Color **! **! This module keeps names and easy handling @@ -179,7 +179,7 @@ #include "global.h" -RCSID("$Id: colors.c,v 1.24 1999/06/22 19:25:57 mirar Exp $"); +RCSID("$Id: colors.c,v 1.25 1999/07/02 21:19:49 mirar Exp $"); #include "image_machine.h" @@ -933,10 +933,10 @@ static void image_color_neon(INT32 args) if (sp[-1].u.float_number==0.0 || sp[-2].u.float_number==0.0) { - if (sp[-2].u.float_number<0.5) - sp[-2].u.float_number=0.0; + if (sp[-1].u.float_number<0.5) + sp[-1].u.float_number=0.0; else - sp[-2].u.float_number=1.0; + sp[-1].u.float_number=1.0; } else { @@ -954,15 +954,15 @@ static void image_color_dull(INT32 args) sp--; push_array_items(sp->u.array); /* frees */ - if (sp[-1].u.float_number==0.0) + if (sp[-2].u.float_number==0.0) { - pop_n_elems(3); - ref_push_object(THISOBJ); - return; + sp[-1].u.float_number-=0.2; + } + else + { + sp[-2].u.float_number-=0.2; + sp[-1].u.float_number-=0.2; } - - sp[-2].u.float_number-=0.2; - sp[-1].u.float_number-=0.2; image_make_hsv_color(3); } @@ -973,15 +973,15 @@ static void image_color_bright(INT32 args) sp--; push_array_items(sp->u.array); /* frees */ - if (sp[-1].u.float_number==0.0) + if (sp[-2].u.float_number==0.0) { - pop_n_elems(3); - ref_push_object(THISOBJ); - return; + sp[-1].u.float_number+=0.2; + } + else + { + sp[-2].u.float_number+=0.2; + sp[-1].u.float_number+=0.2; } - - sp[-2].u.float_number+=0.2; - sp[-1].u.float_number+=0.2; image_make_hsv_color(3); } diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index 5390d4c91c0636f28f1c6a838e25b13bd11b2529..d8e911023e21646a7e7070d25370add16ed1bd76 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,9 +1,9 @@ -/* $Id: image.c,v 1.149 1999/06/22 18:36:17 grubba Exp $ */ +/* $Id: image.c,v 1.150 1999/07/02 21:19:51 mirar Exp $ */ /* **! module Image **! note -**! $Id: image.c,v 1.149 1999/06/22 18:36:17 grubba Exp $ +**! $Id: image.c,v 1.150 1999/07/02 21:19:51 mirar Exp $ **! class Image **! **! The main object of the <ref>Image</ref> module, this object @@ -97,7 +97,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.149 1999/06/22 18:36:17 grubba Exp $"); +RCSID("$Id: image.c,v 1.150 1999/07/02 21:19:51 mirar Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -1758,6 +1758,8 @@ static void image_gradients(INT32 args) **! returns the new image **! note **! May be subject to change or cease without prior warning. +**! +**! see also: gradients, tuned_box */ void image_test(INT32 args) @@ -2012,6 +2014,7 @@ void image_invert(INT32 args) /* **! method object threshold() +**! method object threshold(int level) **! method object threshold(int r,int g,int b) **! method object threshold(Color color) **! Makes a black-white image. @@ -2027,17 +2030,19 @@ void image_invert(INT32 args) **! **! <table><tr valign=center> **! <td><illustration> return lena(); </illustration></td> +**! <td><illustration> return lena()->threshold(100); </illustration></td> **! <td><illustration> return lena()->threshold(90,100,110); </illustration></td> **! </tr><tr valign=center> **! <td>original</td> -**! <td>->threshold(90,100,110);</td> +**! <td>->threshold(100);</td> +**! <td>->threshold(0,100,0);</td> **! </tr></table> **! **! returns the new image object **! **! see also: grey **! -**! note: +**! note **! The above statement "any ..." was changed from "all ..." **! in Pike 0.7 (9906). It also uses 0,0,0 as default input, **! instead of current color. This is more useful. @@ -2050,10 +2055,13 @@ void image_threshold(INT32 args) rgb_group *s,*d,rgb; struct object *o; struct image *img; + int level=-1; if (!THIS->img) error("Called Image.Image object is not initialized\n");; - if (!getrgb(THIS,0,args,args,"Image.Image->threshold()")) + if (args==1) + get_all_args("threshold","%i",&level),level*=3; + else if (!getrgb(THIS,0,args,args,"Image.Image->threshold()")) rgb.r=rgb.g=rgb.b=0; else rgb=THIS->rgb; @@ -2072,18 +2080,31 @@ void image_threshold(INT32 args) x=THIS->xsize*THIS->ysize; THREADS_ALLOW(); - while (x--) - { - if (s->r>rgb.r || - s->g>rgb.g || - s->b>rgb.b) - d->r=d->g=d->b=255; - else - d->r=d->g=d->b=0; + if (level==-1) + while (x--) + { + if (s->r>rgb.r || + s->g>rgb.g || + s->b>rgb.b) + d->r=d->g=d->b=255; + else + d->r=d->g=d->b=0; - d++; - s++; - } + d++; + s++; + } + else + while (x--) + { + if (s->r+s->g+s->b>level) + d->r=d->g=d->b=255; + else + d->r=d->g=d->b=0; + + d++; + s++; + } + THREADS_DISALLOW(); pop_n_elems(args); diff --git a/src/modules/Image/pattern.c b/src/modules/Image/pattern.c index 6dc60393de7d73f3ae98bc6ddcafbe4e5086f237..5779c34528ede0fe5dbebd6e89b429eff2ac6738 100644 --- a/src/modules/Image/pattern.c +++ b/src/modules/Image/pattern.c @@ -1,9 +1,9 @@ -/* $Id: pattern.c,v 1.16 1999/05/23 17:46:45 mirar Exp $ */ +/* $Id: pattern.c,v 1.17 1999/07/02 21:19:55 mirar Exp $ */ /* **! module Image **! note -**! $Id: pattern.c,v 1.16 1999/05/23 17:46:45 mirar Exp $ +**! $Id: pattern.c,v 1.17 1999/07/02 21:19:55 mirar Exp $ **! class Image */ @@ -511,9 +511,12 @@ void image_turbulence(INT32 args) **! <td>...red channel<br></td> **! </tr></table> **! -**! Use with ->grey() or ->color() for one-color-results. +**! Use with -><ref>grey</ref>() or -><ref>color</ref>() +**! for one-color-results. **! **! returns a new image +**! +**! see also test, noise */ void image_random(INT32 args) diff --git a/src/modules/Image/search.c b/src/modules/Image/search.c index f182c4e9ac795ca26fc95d64f9aececd8474689a..8261a55b6db7e2b3853387db2071f87c0384b64c 100644 --- a/src/modules/Image/search.c +++ b/src/modules/Image/search.c @@ -73,7 +73,7 @@ static void chrono(char *x) **! phase. **! **! <tt>phaseh</tt> gives an image -**! were +**! where **! <pre> **! max falling min rising **! value= 0 64 128 192 @@ -87,13 +87,30 @@ static void chrono(char *x) **! Phase images can be used to create ugly **! effects or to find meta-information **! in the orginal image. +**! +**! <table border=0> +**! <tr> +**! <td><illustration> return lena(); </illustration></td> +**! <td><illustration> return lena()->phaseh(); </illustration></td> +**! <td><illustration> return lena()->phasev(); </illustration></td> +**! <td><illustration> return lena()->phasevh(); </illustration></td> +**! <td><illustration> return lena()->phasehv(); </illustration></td> +**! </tr> +**! <tr> +**! <td>original </td> +**! <td>phaseh() </td> +**! <td>phasev() </td> +**! <td>phasevh()</td> +**! <td>phasehv()</td> +**! </tr> +**! </table> **! **! returns the new image object ** see also: match_phase **! bugs **! 0 should not be set as explained above. **! note -**! experimental status; may not be exact the same +**! <b>experimental status</b>; may not be exact the same **! output in later versions */ static INLINE int sq(int a) { return a*a; } @@ -173,7 +190,8 @@ static INLINE int my_abs(int a) { return (a<0)?-a:a; } **! returns the new image object **! see also: phasev,phaseh **! note -**! Experimental. +**! <b>experimental status</b>; may not be exact the same +**! output in later versions */ @@ -229,7 +247,8 @@ static INLINE int my_abs(int a) { return (a<0)?-a:a; } **! returns some nice acsii-art. **! see also: orient, orient4 **! note -**! Experimental. +**! <b>experimental status</b>; may not be exact the same +**! output in later versions */ @@ -419,6 +438,9 @@ void image_make_ascii(INT32 args) **! base level of result, default is zero **! arg int|float div **! division factor, default is 1.0. +**! note +**! <b>experimental status</b>; may not be exact the same +**! output in later versions */