<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) ENPC - Jean-Philippe Chancelier
 * Copyright (C) 2011 - DIGITEO - Manuel Juliachs
 *
 * 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="xfpoly">
    <refnamediv>
        <refname>xfpoly</refname>
        <refpurpose>fill a polygon</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>xfpoly(xv,yv,[fill])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>xv,yv</term>
                <listitem>
                    <para>two vectors of same size (the points of the polygon).</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>fill</term>
                <listitem>
                    <para>integer, the color used to fill the polygon.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>xfpoly</literal> fills a polygon with the current color or a color specified by the
            optional <literal>fill</literal> argument.
        </para>
        <para>
            If <literal>fill</literal> is omitted, the polygon is filled with the current color and its contour is
            drawn with the current color and line style.
            If <literal>fill</literal> is present, it is used to fill the polygon as follows:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    <literal>if fill&lt;0</literal>, the polygon is filled with the color <literal>-fill</literal>, and
                    its contour is not drawn.
                </para>
            </listitem>
            <listitem>
                <para>
                    <literal>if fill=0</literal>, the polygon is filled with the current color and its contour is drawn
                    with the current color and line style (equivalent to <literal>fill</literal> omitted).
                </para>
            </listitem>
            <listitem>
                <para>
                    <literal>if fill&gt;0</literal>, the polygon is filled with the color <literal>fill</literal>
                    and its contour is drawn with the current color and line style.
                </para>
            </listitem>
        </itemizedlist>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
x=sin(2*%pi*(0:4)/5);
y=cos(2*%pi*(0:4)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);
gca().foreground = 5;
xfpoly(x,y);
e = gce(); // get the current entity (the last created: here the polyline)
e.fill_mode='off'; // shows only the contour

delete(e);

// Create a new polygon filled with color 3
// and its contour drawn with the current color
xfpoly(x,y,3);

 ]]></programlisting>
        <scilab:image>
            x=sin(2*%pi*(0:4)/5);
            y=cos(2*%pi*(0:4)/5);
            plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);
            gca().foreground = 5;
            xfpoly(x,y);
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="xfpolys">xfpolys</link>
            </member>
            <member>
                <link linkend="xpoly">xpoly</link>
            </member>
            <member>
                <link linkend="xpolys">xpolys</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
