<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- splitted from ./en/functions/ps.xml, last change in rev 1.12 -->
<refentry xml:id="function.ps-rotate" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>ps_rotate</refname>
  <refpurpose>Sets rotation factor</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>ps_rotate</methodname>
   <methodparam><type>resource</type><parameter>psdoc</parameter></methodparam>
   <methodparam><type>float</type><parameter>rot</parameter></methodparam>
  </methodsynopsis>
  <para>
   Sets the rotation of the coordinate system.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>psdoc</parameter></term>
     <listitem>
      <para>
       Resource identifier of the postscript file
       as returned by <function>ps_new</function>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>rot</parameter></term>
     <listitem>
      <para>
       Angle of rotation in degree.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Rotation of the coordinate system</title>
    <programlisting role="php">
<![CDATA[
<?php
function rectangle($ps) {
    ps_moveto($ps, 0, 0);
    ps_lineto($ps, 0, 50);
    ps_lineto($ps, 50, 50);
    ps_lineto($ps, 50, 0);
    ps_lineto($ps, 0, 0);
    ps_stroke($ps);
}

$ps = ps_new();
if (!ps_open_file($ps, "rotation.ps")) {
  print "Cannot open PostScript file\n";
  exit;
}

ps_set_info($ps, "Creator", "rotation.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Rotation example");
ps_set_info($ps, "BoundingBox", "0 0 596 842");

$psfont = ps_findfont($ps, "Helvetica", "", 0);

ps_begin_page($ps, 596, 842);
ps_set_text_pos($ps, 100, 100);
ps_save($ps);
ps_translate($ps, 100, 100);
ps_rotate($ps, 45);
rectangle($ps);
ps_restore($ps);
ps_setfont($ps, $psfont, 8.0);
ps_show($ps, "Text without rotation");
ps_end_page($ps);

ps_delete($ps);
?>
]]>
    </programlisting>
    <para>
     The above example illustrates a very common way of rotating a
     graphic (in this case just a rectangle) by simply rotating the
     coordinate system. Since the graphic's coordinate system assumes
     (0,0) to be the origin, the page coordinate system is also translated
     to place the graphics not on the edge of the page. Pay attention
     to the order of <function>ps_translate</function> and
     <function>ps_rotate</function>.  In the above case the rectancle is
     rotated around the point (100, 100) in the untranslated coordinate
     system. Switching the two statements has a completely
     different result.
    </para>
    <para>
     In order to output the following text at the original position, all
     modifications of the coordinate system are encapsulated in
     <function>ps_save</function> and <function>ps_restore</function>.
    </para>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>ps_scale</function></member>
    <member><function>ps_translate</function></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

