summaryrefslogtreecommitdiffhomepage
path: root/docs/class.ImlibCliprect.php
diff options
context:
space:
mode:
authorpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2004-05-19 04:59:31 +0000
committerpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2004-05-19 04:59:31 +0000
commitd0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5 (patch)
treee03d2a7fac8c7619f1286545f717ef7ee3866cd6 /docs/class.ImlibCliprect.php
- initial import
git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a
Diffstat (limited to 'docs/class.ImlibCliprect.php')
-rw-r--r--docs/class.ImlibCliprect.php132
1 files changed, 132 insertions, 0 deletions
diff --git a/docs/class.ImlibCliprect.php b/docs/class.ImlibCliprect.php
new file mode 100644
index 0000000..e731784
--- /dev/null
+++ b/docs/class.ImlibCliprect.php
@@ -0,0 +1,132 @@
+<?php
+
+/**
+* Provides variables and methods for a clipping rectangle
+*
+* The variables and methods in this class provide a clipping rectangle that
+* can be used by any drawing function to restrict drawing/filling to a
+* rectangular region.
+*
+* @version 0.3
+* @author Matt McClanahan <cardinal@dodds.net>
+* @package Imlib
+* @access public
+*/
+class ImlibCliprect extends ImlibColor
+{
+ /**
+ * The array defining the cliprect (x,y,w,h)
+ *
+ * @var array $cliprect
+ * @access private
+ */
+ var $cliprect;
+
+ /**
+ * A boolean that determines if a cliprect is in use or not
+ *
+ * @var bool $cliprect_inuse
+ */
+ var $cliprect_inuse;
+
+ /**
+ * ImlibCliprect constructor
+ *
+ * @access public
+ */
+ function ImlibCliprect() { $this->cliprect_inuse = 0; }
+
+ /**
+ * Get the four values of the cliprect
+ *
+ * @param int Upper left X coordinate to clip from
+ * @param int Upper left Y coordinate to clip from
+ * @param int Width of the cliprect
+ * @param int Height of the cliprect
+ * @access public
+ * @see set_cliprect()
+ */
+ function get_cliprect(&$x,&$y,&$w,&$h)
+ {
+ list($x,$y,$w,$h) = $this->cliprect;
+ }
+
+ /**
+ * Get the array that defines the cliprect (x,y,w,h)
+ *
+ * @return array Array defining the clipping rectangle
+ * @access public
+ * @see set_cliprect_array()
+ */
+ function get_cliprect_array()
+ {
+ return $this->cliprect;
+ }
+
+ /**
+ * Get the boolean that determines if a cliprect is in use or not
+ *
+ * @return bool True if the cliprect is in use
+ * @access public
+ * @see set_cliprect_inuse()
+ */
+ function get_cliprect_inuse()
+ {
+ return $this->cliprect_inuse;
+ }
+
+ /**
+ * Set the four values of the cliprect. 0 for X disables the cliprect.
+ *
+ * @param int Upper left X coordinate to clip from
+ * @param int Upper left Y coordinate to clip from
+ * @param int Width of the cliprect
+ * @param int Height of the cliprect
+ * @access public
+ * @see get_cliprect()
+ */
+ function set_cliprect($x,$y,$w,$h)
+ {
+ if ($x == 0)
+ {
+ $this->cliprect = 0;
+ $this->cliprect_inuse = 0;
+ return;
+ }
+ $this->cliprect_inuse = 1;
+ $this->cliprect = Array($x,$y,$w,$h);
+ }
+
+ /**
+ * Set the array that defines the cliprect (x,y,w,h)
+ *
+ * @param array Array that defines the cliprect
+ * @access public
+ * @see get_cliprect_array()
+ */
+ function set_cliprect_array($arr)
+ {
+ if ($arr[0] == 0)
+ {
+ $this->cliprect = 0;
+ $this->cliprect_inuse = 0;
+ return;
+ }
+ $this->cliprect_inuse = 1;
+ $this->cliprect = $arr;
+ }
+
+ /**
+ * Set the boolean that determines if the cliprect is in use
+ *
+ * @param bool True to enable, false to disable
+ * @access public
+ * @see get_cliprect_inuse()
+ */
+ function set_cliprect_inuse($set)
+ {
+ $this->cliprect_inuse = $set;
+ }
+};
+
+?>