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.33 2000/08/09 17:39:19 grubba Exp $ + **! $Id: colors.c,v 1.34 2000/08/09 17:42:13 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.33 2000/08/09 17:39:19 grubba Exp $"); + RCSID("$Id: colors.c,v 1.34 2000/08/09 17:42:13 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:219:   static struct pike_string *str_g;   static struct pike_string *str_b;   static struct pike_string *str_h;   static struct pike_string *str_s;   static struct pike_string *str_v;      static struct pike_string *no_name;      /* forward */   static void _image_make_rgbl_color(INT32 r,INT32 g,INT32 b); - static void _image_make_rgbf_color(float r,float g,float b); + static void _image_make_rgbf_color(double r, double g, double b);   static void image_make_hsv_color(INT32 args);   static void image_make_cmyk_color(INT32 args);   static void image_make_color(INT32 args);   static void image_make_rgb_color(INT32 args);      struct html_color   {    int r,g,b;    char *name;    struct pike_string *pname;
pike.git/src/modules/Image/colors.c:1424:       cs=(struct color_struct*)    get_storage(sp[-1].u.object,image_color_program);       cs->rgbl.r=(INT32)r;    cs->rgbl.g=(INT32)g;    cs->rgbl.b=(INT32)b;    RGBL_TO_RGB(cs->rgb,cs->rgbl);   }    - static void _image_make_rgbf_color(float r,float g,float b) + static void _image_make_rgbf_color(double r, double g, double b)   {   #define FOO(X) FLOAT_TO_COLORL((X)<0.0?0.0:(X)>1.0?1.0:(X))    _image_make_rgbl_color(FOO(r),FOO(g),FOO(b));   #undef FOO   }      void _image_make_rgb_color(INT32 r,INT32 g,INT32 b)   {    struct color_struct *cs;   
pike.git/src/modules/Image/colors.c:1499:       if(s==0.0)    {    r = g = b = v;    } else {   #define i floor(h)   #define f (h-i)   #define p (v * (1 - s))   #define q (v * (1 - (s * f)))   #define t (v * (1 - (s * (1 -f)))) -  switch((int)i) +  switch(DOUBLE_TO_INT(i))    {    case 6: /* 360 degrees. Same as 0.. */    case 0: r = v; g = t; b = p; break;    case 1: r = q; g = v; b = p; break;    case 2: r = p; g = v; b = t; break;    case 3: r = p; g = q; b = v; break;    case 4: r = t; g = p; b = v; break;    case 5: r = v; g = p; b = q; break; -  default: error("internal error (hue=%d <= hsv[%f,%f,%f])\n",(int)i,h,s,v); +  default: error("internal error (hue=%d <= hsv[%f,%f,%f])\n", +  DOUBLE_TO_INT(i), h, s, v);    }    }   #undef i   #undef f   #undef p   #undef q   #undef t       _image_make_rgbf_color(r,g,b);   }