<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - Serge Steer
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<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">
    <refnamediv>
        <refname>hsv2rgb</refname>
        <refpurpose>Converts HSV colors to RGB</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[r,g,b] = hsv2rgb(h,s,v)
            rgb = hsv2rgb(h,s,v)
            [r,g,b] = hsv2rgb(hsv)
            rgb = hsv2rgb(hsv)
        </synopsis>
    </refsynopsisdiv>
    <refsection role="parameters">
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>h</term>
                <listitem>
                    <para> a vector of size n. The "hue" values.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>s</term>
                <listitem>
                    <para> a vector of size n. The "saturation" values.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>v</term>
                <listitem>
                    <para> a vector of size n. The "value" values
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>hsv</term>
                <listitem>
                    <para> a n x 3 matrix. Each row contains a [hue saturation value] triple.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>r</term>
                <listitem>
                    <para> a column vector of size n. The associated "red" values.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>g</term>
                <listitem>
                    <para>a column vector of size n. The associated "green" values.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>b</term>
                <listitem>
                    <para>a column vector of size n. The associated "blue" values.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>rgb</term>
                <listitem>
                    <para> a n x 3 matrix. Each row contains a [red green blue] triple.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection role="description">
        <title>Description</title>
        <para>The function hsv2rgb converts colormaps
            between the RGB and HSV color spaces. As hue varies from 0 to 1.0,
            the corresponding colors vary from red through yellow, green, cyan, blue,
            magenta, and back to red, so that there are actually red values both at 0
            and 1.0. As saturation varies from 0 to 1.0, the corresponding colors
            (hues) vary from unsaturated (shades of gray) to fully saturated (no
            white component). As value, or brightness, varies from 0 to 1.0, the
            corresponding colors become increasingly brighter.
        </para>
    </refsection>
    <refsection role="examples">
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
t = [0:0.3:2*%pi]';
z = sin(t)*cos(t');
plot3d1(t,t,z)
f = gcf();
for h = 0:0.1:1
  HSV = [h*ones(32,1) linspace(0,1,32)' 0.7*ones(32,1)];
  f.color_map = hsv2rgb(HSV);
  sleep(10)
end
for v = 0:0.1:1
  HSV = [ones(32,1) linspace(0,1,32)' v*ones(32,1)];
  f.color_map = hsv2rgb(HSV);
  sleep(10)
end
 ]]></programlisting>
        <scilab:image>
            t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
            plot3d1(t,t,z)
            f=gcf();
            for h=0:0.1:1
            HSV=[h*ones(32,1) linspace(0,1,32)' 0.7*ones(32,1)];
            f.color_map=hsv2rgb(HSV);
            end
            for v=0:0.1:1
            HSV=[ones(32,1) linspace(0,1,32)' v*ones(32,1)];
            f.color_map=hsv2rgb(HSV);
            end
        </scilab:image>
    </refsection>
</refentry>
