pike.git / src / modules / Image / colors.c

version» Context lines:

pike.git/src/modules/Image/colors.c:1:   /*   **! module Image   **! note - **! $Id: colors.c,v 1.11 1999/04/12 14:55:48 mirar Exp $ - **! submodule color + **! $Id: colors.c,v 1.12 1999/04/13 12:32:12 mirar Exp $ + **! submodule Color   **!   **! This module keeps names and easy handling   **! for easy color support. It gives you an easy   **! way to get colors from names.   **!   **! A color is here an object, containing color   **! information and methods for conversion, see below.   **! - **! <ref>Image.color</ref> can be called to make a color object. - **! <ref>Image.color()</ref> takes the following arguments: + **! <ref>Image.Color</ref> can be called to make a color object. + **! <ref>Image.Color()</ref> takes the following arguments:   **! <pre> - **! Image.color(string name) // "red" - **! Image.color(string prefix_string) // "lightblue" - **! Image.color(string hex_name) // "#ff00ff" - **! Image.color(string cmyk_string) // "%17,42,0,19.4" - **! Image.color(string hsv_string) // "%@327,90,32" - **! Image.color(int red, int green, int blue) + **! Image.Color(string name) // "red" + **! Image.Color(string prefix_string) // "lightblue" + **! Image.Color(string hex_name) // "#ff00ff" + **! Image.Color(string cmyk_string) // "%17,42,0,19.4" + **! Image.Color(string hsv_string) // "%@327,90,32" + **! Image.Color(int red, int green, int blue)   **! </pre>   **!   **! The color names available can be listed by using indices - **! on Image.color. The colors are available by name directly - **! as <tt>Image.color.name</tt>, too: + **! on Image.Color. The colors are available by name directly + **! as <tt>Image.Color.name</tt>, too:   **! <pre> - **! ...Image.color.red... - **! ...Image.color.green... + **! ...Image.Color.red... + **! ...Image.Color.green...   **! or, maybe - **! import Image.color; + **! import Image.Color;   **! ...red...   **! ...green...   **! ...lightgreen...   **! </pre>   **!   **! Giving red, green and blue values is equal to calling - **! <ref>Image.color.rgb</ref>(). + **! <ref>Image.Color.rgb</ref>().   **!   **! The prefix_string method is a form for getting modified   **! colors, it understands all modifiers - **! (<link to=Image.color.color.light>light</link>, - **! <link to=Image.color.color.dark>dark</link>, - **! <link to=Image.color.color.bright>bright</link>, - **! <link to=Image.color.color.dull>dull</link> and - **! <link to=Image.color.color.neon>neon</link>). Simply use + **! (<link to=Image.Color.Color.light>light</link>, + **! <link to=Image.Color.Color.dark>dark</link>, + **! <link to=Image.Color.Color.bright>bright</link>, + **! <link to=Image.Color.Color.dull>dull</link> and + **! <link to=Image.Color.Color.neon>neon</link>). Simply use   **! "method"+"color"; (as in <tt>lightgreen</tt>,   **! <tt>dullmagenta</tt>, <tt>lightdullorange</tt>).   **!   **! The <tt>hex_name</tt> form is a simple   **! <tt>#rrggbb</tt> form, as in HTML or X-program argument.   **! A shorter form (<tt>#rgb</tt>) is also accepted. This - **! is the inverse to the <ref>Image.color.color->hex</ref>() + **! is the inverse to the <ref>Image.Color.Color->hex</ref>()   **! method.   **!   **! The <tt>cmyk_string</tt> is a string form of giving   **! <i>cmyk</i> (cyan, magenta, yellow, black) color. These   **! values are floats representing percent.   **!   **! The <tt>hsv_string</tt> is another hue, saturation, value   **! representation, but in floats; hue is in degree range (0..360),   **! and saturation and value is given in percent. <i>This is not   **! the same as returned or given to the <ref>hsv</ref>() methods!</i>   **! - **! see also: Image.color.color->name, Image.color.color->rgb + **! see also: Image.Color.Color->name, Image.Color.Color->rgb   **!   **! added:   **! pike 0.7   **!   **! note: - **! <tt>Image.color["something"]</tt> will never(!) generate an error, + **! <tt>Image.Color["something"]</tt> will never(!) generate an error,   **! but a zero_type 0, if the color is unknown. This is enough   **! to give the error "not present in module", if used - **! as <tt>Image.color.something</tt>, though. + **! as <tt>Image.Color.something</tt>, though.   **!   **! If you are using colors from for instance a webpage, you might - **! want to create the color from <ref>Image.color.guess</ref>(), + **! want to create the color from <ref>Image.Color.guess</ref>(),   **! since that method is more tolerant for mistakes and errors.   **! - **! <tt>Image.color</tt>() is case- and space-sensitive. - **! Use <ref>Image.color.guess</ref>() to catch all variants. + **! <tt>Image.Color</tt>() is case- and space-sensitive. + **! Use <ref>Image.Color.guess</ref>() to catch all variants.   **!   **! and subtract with a space (lower_case(x)-" ") to make   **! sure you get all variants.   **! - **! see also: Image.color.color, Image.color.guess, Image, Image.colortable + **! see also: Image.Color.Color, Image.Color.guess, Image, Image.Colortable   **! - **! class color + **! class Color   **! This is the color object. It has six readable variables,   **! <tt>r</tt>, <tt>g</tt>, <tt>b</tt>, for the <i>red</i>,   **! <i>green</i> and <i>blue</i> values,   **! and <tt>h</tt>, <tt>s</tt>, <tt>v</tt>, for   **! the <i>hue</i>, <i>saturation</i> anv <i>value</i> values.   */      #include "global.h"   #include <config.h>    - RCSID("$Id: colors.c,v 1.11 1999/04/12 14:55:48 mirar Exp $"); + RCSID("$Id: colors.c,v 1.12 1999/04/13 12:32:12 mirar Exp $");      #include "config.h"      #include <math.h>      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"
pike.git/src/modules/Image/colors.c:292:    copy_shared_string(this->name,    colornames->item[d2].u.string);    return;    }    }    copy_shared_string(this->name,no_name);   }      /*   **! method void create(int r,int g,int b) - **! This is the main <ref>Image.color.color</ref> creation + **! This is the main <ref>Image.Color.Color</ref> creation   **! method, mostly for internal use.   **----- internal note: it takes a fourth argument, name of color ---   **!   */   /*   **! method array(int) rgb()   **! method array(int) hsv()   **! method array(int) cmyk()   **! method int greylevel()   **! method int greylevel(int r, int g, int b)   **! This is methods of getting information from an - **! <ref>Image.color.color</ref> object. + **! <ref>Image.Color.Color</ref> object.   **!   **! They give an array of   **! red, green and blue (rgb) values (color value),<br>   **! hue, saturation and value (hsv) values (range as color value), <br>   **! cyan, magenta, yellow, black (cmyk) values (in percent) <br>   **! or the greylevel value (range as color value).   **!   **! The greylevel is calculated by weighting red, green   **! and blue. Default weights are 87, 127 and 41, respective,   **! and could be given by argument.   **!   **! returns array(int) respective int - **! see also: Image.color.color, grey + **! see also: Image.Color.Color, grey   */      static void image_color_rgb(INT32 args)   {    pop_n_elems(args);    push_int(THIS->rgb.r);    push_int(THIS->rgb.g);    push_int(THIS->rgb.b);    f_aggregate(3);   }
pike.git/src/modules/Image/colors.c:349:   {    INT32 r,g,b;    if (args==0)    {    r=87;    g=127;    b=41;    }    else    { -  get_all_args("Image.color.color->greylevel()",args,"%i%i%i",&r,&g,&b); +  get_all_args("Image.Color.Color->greylevel()",args,"%i%i%i",&r,&g,&b);    }    pop_n_elems(args);    if (r+g+b==0) r=g=b=1;    push_int((r*THIS->rgb.r+g*THIS->rgb.g+b*THIS->rgb.b)/(r+g+b));   }      #define MAX3(X,Y,Z) MAXIMUM(MAXIMUM(X,Y),Z)      static void image_color_hsvf(INT32 args)   {
pike.git/src/modules/Image/colors.c:445:    push_float(y*100.0);    push_float(k*100.0);    f_aggregate(4);   }      /*   **! method object grey()   **! method object grey(int red,int green,int blue)   **! Gives a new color, containing a grey color,   **! which is calculated by the <ref>greylevel</ref> method. - **! returns a new <ref>Image.color.color</ref> object + **! returns a new <ref>Image.Color.Color</ref> object   **! see also: greylevel   */      static void image_color_grey(INT32 args)   {    image_color_greylevel(args);    stack_dup();    stack_dup();    image_make_rgb_color(3);   }
pike.git/src/modules/Image/colors.c:477:   **! (Ie, <tt>n=3</tt> gives <tt>#rrrgggbbb</tt>.)   **!   **! <ref>name</ref>() is a simplified method;   **! if the color exists in the database, the name is returned,   **! per default is the <ref>hex</ref>() method use.   **!   **! <ref>html</ref>() gives the <tt>HTML</tt> name of   **! the color, or the <ref>hex</ref>(2) if it isn't one   **! of the 16 <tt>HTML</tt> colors.   **! - **! returns a new <ref>Image.color.color</ref> object - **! see also: rgb, hsv, Image.color + **! returns a new <ref>Image.Color.Color</ref> object + **! see also: rgb, hsv, Image.Color   */      static void image_color_hex(INT32 args)   {    char buf[80];    INT32 i=sizeof(COLORTYPE)*2;       if (args) -  get_all_args("Image.color.color->hex()",args,"%i",&i); +  get_all_args("Image.Color.Color->hex()",args,"%i",&i);       pop_n_elems(args);    if (i<1)    {    push_text("#"); /* stupid */    return;    }    else if (i!=sizeof(COLORTYPE)*2)    {    int sh;
pike.git/src/modules/Image/colors.c:584:   **! and blue (equal to <tt>-><ref>rgb</ref>()</tt>), or   **! to a string, giving the name (equal to <tt>-><ref>name</ref>()</tt>).   **! returns the name as string or rgb as array   **! see also: rgb, name   */      static void image_color_cast(INT32 args)   {    if (args!=1 ||    sp[-1].type!=T_STRING) -  error("Image.color.color->cast(): Illegal argument(s)\n"); +  error("Image.Color.Color->cast(): Illegal argument(s)\n");       if (sp[-1].u.string==str_array)    {    image_color_rgb(args);    return;    }    if (sp[-1].u.string==str_string)    {    image_color_name(args);    return;    } -  error("Image.color.color->cast(): Can't cast to that\n"); +  error("Image.Color.Color->cast(): Can't cast to that\n");   }      static void image_color_index(INT32 args)   {    struct svalue s;       if (args!=1) -  error("Image.color[]: illegal number of arguments\n"); +  error("Image.Color[]: illegal number of arguments\n");       object_index_no_free2(&s,THISOBJ,sp-1);    if (s.type==T_INT && sp[-1].type==T_STRING)    {    if (sp[-1].u.string==str_r)    {    pop_stack();    push_int(THIS->rgb.r);    return;    }
pike.git/src/modules/Image/colors.c:665:   }      /*   **! method int `==(object other_color)   **! method int `==(array(int) rgb)   **! method int `==(int greylevel)   **! method int `==(string name)   **! Compares this object to another color,   **! or color name. Example:   **! <pre> - **! object red=Image.color.red; - **! object other=Image.color. ...; - **! object black=Image.color.black; + **! object red=Image.Color.red; + **! object other=Image.Color. ...; + **! object black=Image.Color.black;   **!   **! if (red==other) ...   **! if (red==({255,0,0})) ...   **! if (black==0) ...   **! if (red=="red") ...   **! </pre>   **!   **! returns 1 or 0   **! see also: rgb, grey, name   **! note:   **! The other datatype (not color object) must be to the right!   */      static void image_color_equal(INT32 args)   {    if (args!=1) -  error("Image.color.color->`==: illegal number of arguments"); +  error("Image.Color.Color->`==: illegal number of arguments");       if (sp[-1].type==T_OBJECT)    {    struct color_struct *other;    other=(struct color_struct*)    get_storage(sp[-1].u.object,image_color_program);    if (other&&    other->rgbl.r==THIS->rgbl.r &&    other->rgbl.g==THIS->rgbl.g &&    other->rgbl.b==THIS->rgbl.b)
pike.git/src/modules/Image/colors.c:762:   **! method object dark()   **! method object neon()   **! method object bright()   **! method object dull()   **! Color modification methods. These returns   **! a new color.   **! <table>   **! <tr><th>method</th><th width=50%>effect</th>   **! <th>h</th><th>s</th><th>v</th><th>as</th></tr>   **! <tr><td>light </td><td>raise light level</td><td>±0</td><td> ±0</td><td>+50</td> - **! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light()->light())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light()->light()->light())</illustration></td></tr> + **! <td><illustration>return Image(20,20,@(array)Color["#693e3e"])</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->light())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->light()->light())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->light()->light()->light())</illustration></td></tr>   **!   **! <tr><td>dark </td><td>lower light level</td><td>±0</td><td> ±0</td><td>-50</td> - **! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark()->dark())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark()->dark()->dark())</illustration></td></tr> + **! <td><illustration>return Image(20,20,@(array)Color["#693e3e"])</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->dark())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->dark()->dark())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->dark()->dark()->dark())</illustration></td></tr>   **!   **! <tr><td>bright</td><td>brighter color </td><td>±0</td><td>+50</td><td>+50</td> - **! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright()->bright())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright()->bright()->bright())</illustration></td></tr> + **! <td><illustration>return Image(20,20,@(array)Color["#693e3e"])</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->bright())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->bright()->bright())</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->bright()->bright()->bright())</illustration></td></tr>   **!   **! <tr><td>dull </td><td>greyer color </td><td>±0</td><td>-50</td><td>-50</td> - **! <td><illustration>return Image.image(20,20,@(array)Image.color.red)</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull()->dull())</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull()->dull()->dull())</illustration></td></tr> + **! <td><illustration>return Image(20,20,@(array)Color.red)</illustration> + **! <illustration>return Image(20,20,@(array)Color.red->dull())</illustration> + **! <illustration>return Image(20,20,@(array)Color.red->dull()->dull())</illustration> + **! <illustration>return Image(20,20,@(array)Color.red->dull()->dull()->dull())</illustration></td></tr>   **!   **! <tr><td>neon </td><td>set to extreme </td><td>±0</td><td>max</td><td>max</td> - **! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> - **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->neon())</illustration></td></tr> + **! <td><illustration>return Image(20,20,@(array)Color["#693e3e"])</illustration> + **! <illustration>return Image(20,20,@(array)Color["#693e3e"]->neon())</illustration></td></tr>   **!   **! </table>   **! returns the new color object   **! note:   **! The opposites may not always take each other out.   **! The color is maximised at white and black levels,   **! so, for instance - **! <ref>Image.color</ref>.white-><ref>light</ref>()-><ref>dark</ref>() + **! <ref>Image.Color</ref>.white-><ref>light</ref>()-><ref>dark</ref>()   **! doesn't give the white color back, but the equal to - **! <ref>Image.color</ref>.white-><ref>dark</ref>(), since + **! <ref>Image.Color</ref>.white-><ref>dark</ref>(), since   **! white can't get any <ref>light</ref>er.   */         static void image_color_light(INT32 args)   {    pop_n_elems(args);    image_color_hsvf(0);    sp--;    push_array_items(sp->u.array); /* frees */
pike.git/src/modules/Image/colors.c:886:    }       sp[-2].u.float_number+=0.2;    image_make_hsv_color(3);   }         static void image_color_mult(INT32 args)   {    float x=0.0; -  get_all_args("Image.color.color->`*",args,"%f",&x); +  get_all_args("Image.Color.Color->`*",args,"%f",&x);    pop_n_elems(args);    _image_make_rgb_color((int)(THIS->rgb.r*x),    (int)(THIS->rgb.g*x),    (int)(THIS->rgb.b*x));   }      int image_color_svalue(struct svalue *v,rgb_group *rgb)   {    if (v->type==T_OBJECT)    {
pike.git/src/modules/Image/colors.c:948:    if (args<=0) return 0;    return image_color_svalue(sp-args,rgb);   }         static void image_color_add(INT32 args)   {    rgb_group rgb;       if (!image_color_arg(args,&rgb)) -  error("Image.color.color->`+: Illegal argument(s)"); +  error("Image.Color.Color->`+: Illegal argument(s)");       pop_n_elems(args);    _image_make_rgb_color((int)(THIS->rgb.r+rgb.r),    (int)(THIS->rgb.g+rgb.g),    (int)(THIS->rgb.b+rgb.b));   }            #define HEXTONUM(C) \
pike.git/src/modules/Image/colors.c:970:    ((C)>='a' && (C)<='f')?(C)-'a'+10: \    ((C)>='A' && (C)<='F')?(C)-'A'+10:-1)      static void image_get_color(INT32 args)   {    struct svalue s;    int n;    static char *callables[]={"light","dark","neon","dull","bright"};       if (args!=1) -  error("Image.color[]: illegal number of args"); +  error("Image.Color[]: illegal number of args");       if (!colors)    make_colors();       mapping_index_no_free(&s,colors,sp-1);    if (s.type==T_INT)    {    object_index_no_free2(&s,THISOBJ,sp-1);    if (s.type!=T_INT)    {
pike.git/src/modules/Image/colors.c:1054:    push_text("@%f,%f,%f\n");    f_sscanf(2);    if (sp[-1].type==T_ARRAY &&    sp[-1].u.array->size==3)    {    float h,s,v;    stack_swap();    pop_stack();    sp--;    push_array_items(sp->u.array); -  get_all_args("Image.color()",3,"%f%f%f",&h,&s,&v); +  get_all_args("Image.Color()",3,"%f%f%f",&h,&s,&v);    pop_n_elems(3);    push_int((INT32)(h/360.0*256.0));    push_int((INT32)(s/100.0*255.4));    push_int((INT32)(v/100.0*255.4));    image_make_hsv_color(3);    return;    }    pop_stack();    }    if (sp[-1].u.string->len>=4 &&
pike.git/src/modules/Image/colors.c:1135:       pop_stack();    *(sp++)=s;   }      static void image_guess_color(INT32 args)   {    struct svalue s;       if (args!=1 && sp[-args].type!=T_STRING) -  error("Image.color->guess(): illegal argument(s)\n"); +  error("Image.Color->guess(): illegal argument(s)\n");       f_lower_case(1);    push_text(" ");    o_subtract();       stack_dup();    image_get_color(1);    if (sp[-1].type==T_OBJECT)    {    stack_swap();
pike.git/src/modules/Image/colors.c:1172:    {    image_get_color(args);    return;    }    image_make_rgb_color(args);   }         /*   **! module Image - **! submodule color + **! submodule Color   **!   **! method object guess(string)   **! This is equivalent to - **! <tt><ref>Image.color</ref>(lower_case(str)-" ")</tt>, + **! <tt><ref>Image.Color</ref>(lower_case(str)-" ")</tt>,   **! and tries the color with a prepending '#' if no   **! corresponding color is found.   **!   **! returns a color object or zero_type   */      /*   **! method object rgb(int red, int green, int blue)   **! method object hsv(int hue, int saturation, int value)   **! method object cmyk(float c,float m,float y,float k)
pike.git/src/modules/Image/colors.c:1248:    cs->rgb.r=(COLORTYPE)r;    cs->rgb.g=(COLORTYPE)g;    cs->rgb.b=(COLORTYPE)b;    RGB_TO_RGBL(cs->rgbl,cs->rgb);   }      static void image_make_rgb_color(INT32 args)   {    INT32 r=0,g=0,b=0;    -  get_all_args("Image.color.rgb()",args,"%i%i%i",&r,&g,&b); +  get_all_args("Image.Color.rgb()",args,"%i%i%i",&r,&g,&b);       _image_make_rgb_color(r,g,b);   }      static void image_make_hsv_color(INT32 args)   {    float h,s,v;    float r=0,g=0,b=0; /* to avoid warning */       if (args && sp[-args].type==T_INT)    {    INT32 hi,si,vi; -  get_all_args("Image.color.hsv()",args,"%i%i%i", +  get_all_args("Image.Color.hsv()",args,"%i%i%i",    &hi,&si,&vi);    pop_n_elems(args);       if (hi<0) hi=(hi%COLORMAX)+COLORMAX;    else if (hi>COLORMAX) hi%=COLORMAX; /* repeating */    if (si<0) si=0; else if (si>COLORMAX) si=COLORMAX;    if (vi<0) vi=0; else if (vi>COLORMAX) vi=COLORMAX;       h = (hi/((float)COLORMAX))*(360.0/60.0);    s = si/((float)COLORMAX);    v = vi/((float)COLORMAX);    }    else    { -  get_all_args("Image.color.hsv()",args,"%f%f%f", +  get_all_args("Image.Color.hsv()",args,"%f%f%f",    &h,&s,&v);    pop_n_elems(args);    if (h<0) h=360+h-(((int)h/360)*360);    if (h>360.0) h-=(((int)h/360)*360);    h/=60;    }       if(s==0.0)    {    r = g = b = v;
pike.git/src/modules/Image/colors.c:1317:   #undef p   #undef q   #undef t       _image_make_rgbf_color(r,g,b);   }      static void image_make_cmyk_color(INT32 args)   {    float c,m,y,k,r,g,b; -  get_all_args("Image.color.cmyk()",args,"%F%F%F%F",&c,&m,&y,&k); +  get_all_args("Image.Color.cmyk()",args,"%F%F%F%F",&c,&m,&y,&k);    pop_n_elems(args);       r=100-(c+k);    g=100-(m+k);    b=100-(y+k);       _image_make_rgbf_color(r*0.01,g*0.01,b*0.01);   }      static void image_make_greylevel_color(INT32 args)   {    INT32 i;    -  get_all_args("Image.color.greylevel()",args,"%i",&i); +  get_all_args("Image.Color.greylevel()",args,"%i",&i);    pop_n_elems(args);       _image_make_rgb_color(i,i,i);   }      static void image_make_html_color(INT32 args)   {    int i;       if (args!=1 ||    sp[-1].type!=T_STRING)    { -  error("Image.color.html(): illegal arguments\n"); +  error("Image.Color.html(): illegal arguments\n");    return;    }       f_lower_case(1);    for (i=0; (size_t)i<sizeof(html_color)/sizeof(html_color[0]); i++)    if (html_color[i].pname==sp[-1].u.string)    {    _image_make_rgb_color(html_color[i].r,    html_color[i].g,    html_color[i].b);
pike.git/src/modules/Image/colors.c:1373:    push_text("#");    stack_swap();    f_add(2);    image_get_color(1);    }   }      /*   **! method array(string) _indices()   **! method array(object) _values() - **! (ie as <tt>indices(Image.color)</tt> or <tt>values(Image.color)</tt>) + **! (ie as <tt>indices(Image.Color)</tt> or <tt>values(Image.Color)</tt>)   **! <tt>indices</tt> gives a list of all the known color names,   **! <tt>values</tt> gives there corresponding objects. - **! see also: Image.color + **! see also: Image.Color   */      static void image_colors_indices(INT32 args)   {    pop_n_elems(args);    if (!colors) make_colors();    ref_push_mapping(colors);    f_indices(1);   }   
pike.git/src/modules/Image/colors.c:1469:    ADD_FUNCTION("cmyk",image_make_cmyk_color,tFunc(tOr(tInt,tFlt)    tOr(tInt,tFlt)    tOr(tInt,tFlt)    tOr(tInt,tFlt),tObj), 0);    ADD_FUNCTION("html",image_make_html_color,tFunc(tStr,tObj),0);    ADD_FUNCTION("guess",image_guess_color,tFunc(tStr,tObj),0);    ADD_FUNCTION("greylevel",image_make_greylevel_color,tFunc(tInt,tObj),0);    ADD_FUNCTION("_indices",image_colors_indices,tFunc(,tArr(tStr)),0);    ADD_FUNCTION("_values",image_colors_values,tFunc(,tArr(tObj)),0);    -  add_program_constant("color",image_color_program,0); +  add_program_constant("Color",image_color_program,0);       prg=end_program();    push_object(clone_object(prg,0));    free_program(prg); -  str=make_shared_string("color"); +  str=make_shared_string("Color");    add_constant(str,sp-1,0);    free_string(str);    pop_stack();   }      void exit_image_colors(void)   {    if (image_color_program)    {    free_program(image_color_program);