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

version» Context lines:

pike.git/src/modules/Image/colors.c:446:   {    INT_TYPE r,g,b;    if (args==0)    {    r=87;    g=127;    b=41;    }    else    { -  get_all_args("greylevel",args,"%i%i%i",&r,&g,&b); +  get_all_args(NULL,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)   #define MIN3(X,Y,Z) MINIMUM(MINIMUM(X,Y),Z)      static void image_color_hsvf(INT32 args)
pike.git/src/modules/Image/colors.c:569:   **! method int bits( int rbits, int gbits, int bbits, int rshift, int gshift, int bshift )   **! Returns the color as an integer. The first three parameters state how   **! many bits to use for red, green and blue respectively. The last three   **! state how many bits each colour should be shifted. For instance,   **! <tt>Image.Color("#AABBCC")-&gt;bits(8, 8, 8, 16, 8, 0)</tt> returns   **! the integer 11189196, that is, 0xAABBCC.   */   static void image_color_bits( INT32 args )   {    INT_TYPE rb, gb, bb, rs, gs, bs; -  get_all_args( "bits", args, "%i%i%i%i%i%i", &rb,&gb,&bb, &rs, &gs, &bs ); +  get_all_args( NULL, args, "%i%i%i%i%i%i", &rb,&gb,&bb, &rs, &gs, &bs );    pop_n_elems( args );          /* Do it on the stack to support bignums (it's possible to get 2M    * bits for each channel this way. Not that that's really useful,    * but...    */      #define push_int_bits( i, b, s ) \    if( b <= 31 ) \
pike.git/src/modules/Image/colors.c:647:   **! 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];    INT_TYPE i=sizeof(COLORTYPE)*2;       if (args) -  get_all_args("hex",args,"%i",&i); +  get_all_args(NULL,args,"%i",&i);       pop_n_elems(args);    if (i<1)    {    push_static_text("#"); /* stupid */    return;    }    else if (i!=sizeof(COLORTYPE)*2)    {    ptrdiff_t sh;
pike.git/src/modules/Image/colors.c:747:   **! cast the object to an array, representing red, green   **! 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)   {    struct pike_string *str; -  get_all_args("cast", args, "%n", &str); +  get_all_args(NULL, args, "%n", &str);       if (str==literal_array_string)    {    image_color_rgb(args);    return;    }    if (str==literal_string_string)    {    image_color_name(args);    return;
pike.git/src/modules/Image/colors.c:1152:    sp[-2].u.float_number+=0.2;    sp[-1].u.float_number+=0.2;    }    image_make_hsv_color(3);   }         static void image_color_mult(INT32 args)   {    FLOAT_TYPE x=0.0; -  get_all_args("`*",args,"%f",&x); +  get_all_args(NULL,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 (TYPEOF(*v) == T_OBJECT)    {
pike.git/src/modules/Image/colors.c:1321:    f_sscanf(2);    if (TYPEOF(sp[-1]) == T_ARRAY &&    sp[-1].u.array->size==3)    {    FLOAT_TYPE h,s,v;    stack_swap();    pop_stack();    sp--;    dmalloc_touch_svalue(sp);    push_array_items(sp->u.array); -  get_all_args("create",3,"%f%f%f",&h,&s,&v); +  get_all_args(NULL,3,"%f%f%f",&h,&s,&v);    pop_n_elems(3);    push_int((int)(h/360.0*256.0));    push_int((int)(s/100.0*255.4));    push_int((int)(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:1553:    if( args==1 && TYPEOF(sp[-1]) == T_INT )    {    r = sp[-1].u.integer;    b = r & 0xff;    r >>= 8;    g = r & 0xff;    r >>= 8;    r &= 0xff;    }    else -  get_all_args("rgb",args,"%i%i%i",&r,&g,&b); +  get_all_args(NULL,args,"%i%i%i",&r,&g,&b);       _image_make_rgb_color(r,g,b);   }      static void image_make_hsv_color(INT32 args)   {    FLOAT_TYPE h,s,v;    FLOAT_TYPE r=0,g=0,b=0; /* to avoid warning */       if (args && TYPEOF(sp[-args]) == T_INT)    {    INT_TYPE hi,si,vi; -  get_all_args("hsv",args,"%i%i%i",&hi,&si,&vi); +  get_all_args(NULL,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/((double)COLORMAX))*(360.0/60.0);    s = si/((double)COLORMAX);    v = vi/((double)COLORMAX);    }    else    { -  get_all_args("hsv",args,"%f%f%f",&h,&s,&v); +  get_all_args(NULL,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;    } else {
pike.git/src/modules/Image/colors.c:1622:   #undef p   #undef q   #undef t       _image_make_rgbf_color(r,g,b);   }      static void image_make_cmyk_color(INT32 args)   {    FLOAT_TYPE c,m,y,k,r,g,b; -  get_all_args("cmyk",args,"%F%F%F%F",&c,&m,&y,&k); +  get_all_args(NULL,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)   {    INT_TYPE i;    -  get_all_args("greylevel",args,"%i",&i); +  get_all_args(NULL,args,"%i",&i);    pop_n_elems(args);       _image_make_rgb_color(i,i,i);   }      static void image_make_html_color(INT32 args)   {    int i;    check_all_args("html", args, BIT_STRING, 0);