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.36 2000/08/11 08:42:19 mirar Exp $ + **! $Id: colors.c,v 1.37 2000/08/11 19:25:53 grubba 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.
pike.git/src/modules/Image/colors.c:172:   **! 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"    - RCSID("$Id: colors.c,v 1.36 2000/08/11 08:42:19 mirar Exp $"); + RCSID("$Id: colors.c,v 1.37 2000/08/11 19:25:53 grubba Exp $");      #include "image_machine.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:586:    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; +  ptrdiff_t sh;    if (i>8) i=8;       sh=4*(sizeof(COLORTYPE)*2-i);    if (sh>0)    sprintf(buf,"#%0*x%0*x%0*x",i,THIS->rgb.r>>sh,    i,THIS->rgb.g>>sh,i,THIS->rgb.b>>sh);    else    {    unsigned INT32 r=THIS->rgbl.r;    unsigned INT32 g=THIS->rgbl.g;
pike.git/src/modules/Image/colors.c:1080:    }    image_make_hsv_color(3);   }         static void image_color_mult(INT32 args)   {    FLOAT_TYPE x=0.0;    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)); +  _image_make_rgb_color(DOUBLE_TO_INT(THIS->rgb.r*x), +  DOUBLE_TO_INT(THIS->rgb.g*x), +  DOUBLE_TO_INT(THIS->rgb.b*x));   }      int image_color_svalue(struct svalue *v,rgb_group *rgb)   {    if (v->type==T_OBJECT)    {    struct color_struct *cs=(struct color_struct*)    get_storage(v->u.object,image_color_program);       if (cs)
pike.git/src/modules/Image/colors.c:1188:    }       if (sp[-1].type==T_STRING &&    sp[-1].u.string->size_shift==0)    {    if (sp[-1].u.string->len>=4 &&    sp[-1].u.string->str[0]=='#')    {    /* #rgb, #rrggbb, #rrrgggbbb, etc */    -  size_t i = sp[-1].u.string->len-1, j, k, rgb[3]; +  size_t i = sp[-1].u.string->len-1, j, k; +  unsigned INT32 rgb[3];    unsigned char *src=(unsigned char *)sp[-1].u.string->str+1;    if (!(i%3))    {    i/=3;    for (j=0; j<3; j++)    {    unsigned INT32 z=0;    for (k=0; k<i; k++)    {    if (HEXTONUM(*src)==-1)