pike.git
/
src
/
modules
/
Image
/
colors.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/Image/colors.c:1:
/* **! module Image **! note
-
**! $Id: colors.c,v 1.
41
2000/12/
01
08:
09:58
hubbe
Exp $
+
**! $Id: colors.c,v 1.
42
2000/12/
05
21:
08:
24
per
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:145:
**! **! </execute> **! </add_appendix> **! **! see also: Image.Color.Color->name, Image.Color.Color->rgb, colors **! **! added: **! pike 0.7 **! **! note:
-
**! <tt>Image.Color["something"]</tt> will never(!) generate an
Pike_
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
Pike_
error "not present in module", if used
+
**! to give the error "not present in module", if used
**! 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>(), **! 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. **! **! and subtract with a space (lower_case(x)-" ") to make
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.
41
2000/12/
01
08:
09:58
hubbe
Exp $");
+
RCSID("$Id: colors.c,v 1.
42
2000/12/
05
21:
08:
24
per
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:475:
b = COLORL_TO_FLOAT(THIS->rgbl.b); max = MAX3(r,g,b); min = MIN3(r,g,b); v = max; if(max != 0.0) s = (max - min)/max; else
-
Pike_error("internal
Pike_
error, max==0.0\n");
+
Pike_error("internal error, max==0.0\n");
delta = max-min; if(r==max) h = (g-b)/delta; else if(g==max) h = 2+(b-r)/delta; else /*if(b==max)*/ h = 4+(r-g)/delta; h *= 60; /* now in degrees. */ if(h<0) h+=360; push_float(h);
pike.git/src/modules/Image/colors.c:1564:
#define t (v * (1 - (s * (1 -f)))) 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: Pike_error("internal
Pike_
error (hue=%d <= hsv[%f,%f,%f])\n",
+
default: Pike_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);