.. _linemenu:
.. _line:

.. index::
   pair: functions; Line drawing
   pair: command; line

Line drawing functions
======================

XaoS has support for drawing lines. These functions are available only in
animations and could be used to show some parts of fractals or draw simple
diagrams. See the tutorial ":tutor:`Introduction to fractals <intro.xaf>`" for examples of this feature.

Lines can be drawn in **screen** coordinates, where 0,0 is the top left corner
and 1,1 is bottom right, **scaled** coordinates, which are similar, but scaled
to keep 0,0--1,1 rectangular, or **Fractal** coordinates, to draw a line at an
exact position on the screen.

The color of the line should be specified by the :ref:`color <color>` command.
You might draw an arbitrary number of lines and, later, morph them. Each line
is identified by a unique numeric key; the current key can be set using
linekey. Commands for changing lines operate on the line with the current key.
(Lines drawn in sequence have consecutive numbers.)

For example::

	(color 'red) 
	(line 'scaled 0.3 0.5 0.7 0.5) 
	(line 'scaled 0.3 0.5 0.7 0.5)
	(line 'scaled 0.3 0.5 0.3 0.5) 
	(line 'scaled 0.7 0.5 0.7 0.5) 
	(linekey 0)
	(morphline 'scaled 0.3 0.3 0.7 0.3) 
	(morphline 'scaled 0.3 0.7 0.7 0.7)
	(morphline 'scaled 0.3 0.3 0.3 0.7) 
	(morphline 'scaled 0.7 0.3 0.7 0.7) 
	(usleep 1000000)

Creates line morphing to rectangle.

.. toctree::

   line
   morphline
   morphlastline
   linekey
   clearline
   clearlines
