Xcos setup: fix an IndexOutOfBoundsException after 22ee913d
[scilab.git] / scilab / modules / graphics / help / en_US / color_management / hsv2rgb.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA - Serge Steer
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="hsv2rgb">
17     <refnamediv>
18         <refname>hsv2rgb</refname>
19         <refpurpose>Converts HSV colors to RGB</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>[r,g,b] = hsv2rgb(h,s,v)
24             rgb = hsv2rgb(h,s,v)
25             [r,g,b] = hsv2rgb(hsv)
26             rgb = hsv2rgb(hsv)
27         </synopsis>
28     </refsynopsisdiv>
29     <refsection>
30         <title>Arguments</title>
31         <variablelist>
32             <varlistentry>
33                 <term>h</term>
34                 <listitem>
35                     <para> a vector of size n. The "hue" values.
36                     </para>
37                 </listitem>
38             </varlistentry>
39             <varlistentry>
40                 <term>s</term>
41                 <listitem>
42                     <para> a vector of size n. The "saturation" values.
43                     </para>
44                 </listitem>
45             </varlistentry>
46             <varlistentry>
47                 <term>v</term>
48                 <listitem>
49                     <para> a vector of size n. The "value" values
50                     </para>
51                 </listitem>
52             </varlistentry>
53             <varlistentry>
54                 <term>hsv</term>
55                 <listitem>
56                     <para> a n x 3 matrix. Each row contains a [hue saturation value] triple.
57                     </para>
58                 </listitem>
59             </varlistentry>
60             <varlistentry>
61                 <term>r</term>
62                 <listitem>
63                     <para> a column vector of size n. The associated "red" values.
64                     </para>
65                 </listitem>
66             </varlistentry>
67             <varlistentry>
68                 <term>g</term>
69                 <listitem>
70                     <para>a column vector of size n. The associated "green" values.
71                     </para>
72                 </listitem>
73             </varlistentry>
74             <varlistentry>
75                 <term>b</term>
76                 <listitem>
77                     <para>a column vector of size n. The associated "blue" values.
78                     </para>
79                 </listitem>
80             </varlistentry>
81             <varlistentry>
82                 <term>rgb</term>
83                 <listitem>
84                     <para> a n x 3 matrix. Each row contains a [red green blue] triple.
85                     </para>
86                 </listitem>
87             </varlistentry>
88         </variablelist>
89     </refsection>
90     <refsection>
91         <title>Description</title>
92         <para>The function hsv2rgb converts colormaps
93             between the RGB and HSV color spaces. As hue varies from 0 to 1.0,
94             the corresponding colors vary from red through yellow, green, cyan, blue,
95             magenta, and back to red, so that there are actually red values both at 0
96             and 1.0. As saturation varies from 0 to 1.0, the corresponding colors
97             (hues) vary from unsaturated (shades of gray) to fully saturated (no
98             white component). As value, or brightness, varies from 0 to 1.0, the
99             corresponding colors become increasingly brighter.
100         </para>
101     </refsection>
102     <refsection>
103         <title>Examples</title>
104         <programlisting role="example"><![CDATA[
105 t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
106 plot3d1(t,t,z)
107 f=gcf();
108 for h=0:0.1:1
109   hsv=[h*ones(32,1) linspace(0,1,32)' 0.7*ones(32,1)];
110   f.color_map=hsv2rgb(hsv);
111   xpause(10000)
112 end
113 for v=0:0.1:1
114   hsv=[ones(32,1) linspace(0,1,32)' v*ones(32,1)];
115   f.color_map=hsv2rgb(hsv);
116   xpause(10000)
117 end
118  ]]></programlisting>
119         <scilab:image>
120             t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
121             plot3d1(t,t,z)
122             f=gcf();
123             for h=0:0.1:1
124             hsv=[h*ones(32,1) linspace(0,1,32)' 0.7*ones(32,1)];
125             f.color_map=hsv2rgb(hsv);
126             end
127             for v=0:0.1:1
128             hsv=[ones(32,1) linspace(0,1,32)' v*ones(32,1)];
129             f.color_map=hsv2rgb(hsv);
130             end
131         </scilab:image>
132         
133     </refsection>
134 </refentry>