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.
51
2001/07/
12
13
:
52
:
47
grubba
Exp $
+
**! $Id: colors.c,v 1.
52
2001/07/
17
03
:
44
:
13
nilsson
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:56:
**! **! 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, colors
**!
-
**!
<add_appendix
name="colors"
title="Image.Color
colors"><execute>
+
**!
added:
+
**!
pike 0
.
7
**!
-
+
**! note:
+
**! <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.
+
**!
+
**! 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
+
**! sure you get all variants.
+
**!
+
**! see also: Image.Color.Color, Image.Color.guess, Image, Image.Colortable
+
**!
+
**!
+
**! appendix Image.Color colors
+
**! <execute>
+
**!
**! import Image; **! **! array modifiers=({"neon","light","dark","bright","dull"}); **! **! object F=Font(); **! **! mixed color_info(array(object) ac) **! { **! **! #define YZ 14
pike.git/src/modules/Image/colors.c:137:
**! }),colored); **! **! Array.map(({orig}),color_info); **! write("\240"); **! Array.map(({grey}),color_info); **! write("\240"); **! Array.map(colored/8.0,color_info); **! } **! **! </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 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.
-
**!
-
**! 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
-
**! sure you get all variants.
-
**!
-
**! see also: Image.Color.Color, Image.Color.guess, Image, Image.Colortable
-
**!
+
**! 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.
51
2001/07/
12
13
:
52
:
47
grubba
Exp $");
+
RCSID("$Id: colors.c,v 1.
52
2001/07/
17
03
:
44
:
13
nilsson
Exp $");
#include "image_machine.h" #include <math.h> #include "stralloc.h" #include "pike_macros.h" #include "object.h" #include "constants.h" #include "interpret.h"