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.
3
1999/01/24
00
:
47
:
33
mirar Exp $
+
**! $Id: colors.c,v 1.
4
1999/01/24
01
:
14
:
19
mirar 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:37:
**! <ref>Image.color.rgb</ref>(). **! **! The <tt>hex_name</tt> form is a simple **! <tt>#rrggbb</tt> form, as in HTML or X-program argument. **! A shorter form (<tt>#rgb</tt>) is also accepted. This **! is the inverse to the <ref>Image.color.color->hex</ref>() **! method. **! **! The prefix_string method is a form for getting modified **! colors, it understands all modifiers
-
**! (<
ref
to=Image.color.color
->
light>light</
ref
>,
-
**! <
ref
to=Image.color.color
->
dark>dark</
ref
>,
-
**! <
ref
to=Image.color.color
->
bright>bright</
ref
>,
-
**! <
ref
to=Image.color.color
->
dull>dull</
ref
> and
-
**! <
ref
to=Image.color.color
->
neon>neon</
ref
>). Simply use
-
**!
<
method
><
color
>
; (as in <tt>lightgreen</tt>,
+
**! (<
link
to=Image.color.color
.
light>light</
link
>,
+
**! <
link
to=Image.color.color
.
dark>dark</
link
>,
+
**! <
link
to=Image.color.color
.
bright>bright</
link
>,
+
**! <
link
to=Image.color.color
.
dull>dull</
link
> and
+
**! <
link
to=Image.color.color
.
neon>neon</
link
>). Simply use
+
**!
"
method
"+"
color
"
; (as in <tt>lightgreen</tt>,
**! <tt>dullmagenta</tt>, <tt>lightdullorange</tt>). **! **! see also: Image.color.color->name, Image.color.color->rgb **! **! 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
pike.git/src/modules/Image/colors.c:79:
**! 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" #include <config.h>
-
RCSID("$Id: colors.c,v 1.
3
1999/01/24
00
:
47
:
33
mirar Exp $");
+
RCSID("$Id: colors.c,v 1.
4
1999/01/24
01
:
14
:
19
mirar Exp $");
#include "config.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:702:
**! method object light() **! method object dark() **! method object neon() **! method object bright() **! method object dull() **! Color modification methods. These returns **! a new color. **! <table> **! <tr><th>method</th><th width=50%>effect</th> **! <th>h</th><th>s</th><th>v</th><th>as</th></tr>
-
**! <tr><td>light </td><td>raise light level</td><td>±0</td><td> ±0</td>
+
**! <tr><td>light </td><td>raise light level</td><td>±0</td><td> ±0</td>
<td>+50</td>
**! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light()->light())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->light()->light()->light())</illustration></td></tr> **!
-
**! <tr><td>dark </td><td>lower light level</td><td>±0</td><td> ±0</td>
+
**! <tr><td>dark </td><td>lower light level</td><td>±0</td><td> ±0</td>
<td>-50</td>
**! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark()->dark())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->dark()->dark()->dark())</illustration></td></tr> **!
-
**! <tr><td>bright</td><td>brighter color </td><td>±0</td><td>+50</td>
+
**! <tr><td>bright</td><td>brighter color </td><td>±0</td><td>+50</td>
<td>+50</td>
**! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright()->bright())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->bright()->bright()->bright())</illustration></td></tr> **!
-
**! <tr><td>dull </td><td>greyer color </td><td>±0</td><td>-50</td>
+
**! <tr><td>dull </td><td>greyer color </td><td>±0</td><td>-50</td>
<td>-50</td>
**! <td><illustration>return Image.image(20,20,@(array)Image.color.red)</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull()->dull())</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color.red->dull()->dull()->dull())</illustration></td></tr> **!
-
**! <tr><td>neon </td><td>set to extreme </td><td>±0</td><td>max</td>
+
**! <tr><td>neon </td><td>set to extreme </td><td>±0</td><td>max</td>
<td>max</td>
**! <td><illustration>return Image.image(20,20,@(array)Image.color["#693e3e"])</illustration> **! <illustration>return Image.image(20,20,@(array)Image.color["#693e3e"]->neon())</illustration></td></tr> **! **! </table> **! returns the new color object **! note: **! The opposites may not always take each other out. **! The color is maximised at white and black levels, **! so, for instance **! <ref>Image.color</ref>.white-><ref>light</ref>()-><ref>dark</ref>()
pike.git/src/modules/Image/colors.c:968:
*/ /* **! method object rgb(int red, int green, int blue) **! method object hsv(int hue, int saturation, int value) **! method object greylevel(int level) **! method object html(string html_color) **! Creates a new color object from given red, green and blue, **! hue, saturation and value, or greylevel. **!
-
**! The <ref>html</ref>()
-
**!
method only understands the HTML color names,
-
**! or the <tt>#rrggbb</tt> form.
+
**! The <ref>html</ref>() method only understands the HTML color names,
+
**! or the <tt>#rrggbb</tt> form.
It is case insensitive.
**! **! returns the created object. */ void image_make_rgb_color(INT32 args) { if (args!=3) { error("Image.color.rgb(): illegal number of arguments\n"); return;