/usr/share/php/Imlib/class.ImlibDraw.php is in php-imlib 0.7-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | <?php
/**
* Does everything relevant to drawing or filling ellipses, lines, or rectangles
*
* @version 0.3
* @author Matt McClanahan <cardinal@dodds.net>
* @package Imlib
* @access public
*/
class ImlibDraw extends ImlibCliprect
{
/**
* Resource id# of the image to draw on
*
* @access private
*/
var $im;
/**
* ImlibDraw constructor
*
* @access public
*/
function ImlibDraw()
{
$this->cliprect = 0;
$this->cliprect_inuse = 0;
$this->color = 0;
$this->im = 0;
}
/**
* Callback for drawing everything
*
* Since all the drawing functions work the same way, this function
* does all the work. It takes four ints, often x,y,w,h, and passes
* them to the specified function.
*
* @param int First param
* @param int Second param
* @param int Third param
* @param int Fourth param
* @param string The name of the function to call
* @return bool False if no image is set yet
* @access private
*/
function _draw_something($x,$y,$w,$h,$cb)
{
if (!is_resource($this->im))
return false;
if (!$this->get_color($r,$g,$b,$a))
list($r,$g,$b,$a) = Array(255,255,255,255);
$cbname = 'imlib_image_' . $cb;
if ($this->cliprect_inuse)
return $cbname($this->im,$x,$y,$w,$h,$r,$g,$b,$a,
$this->get_cliprect_array());
else
return $cbname($this->im,$x,$y,$w,$h,$r,$g,$b,$a);
}
/**
* Draw an ellipse
*
* @param int Center X coordinate
* @param int Center Y coordinate
* @param int Ellipse horizontal amplitude
* @param int Ellipse vertical amplitude
*
* @return bool False if no image is set yet
* @access public
*/
function draw_ellipse($x,$y,$w,$h)
{
return $this->_draw_something($x,$y,$w,$h,'draw_ellipse');
}
/**
* Draw a line
*
* @param int First X coordinate
* @param int First Y coordinate
* @param int Second X coordinate
* @param int Second Y coordinate
*
* @return bool False if no image is set yet
* @access public
*/
function draw_line($x1,$y1,$x2,$y2)
{
return $this->_draw_something($x1,$y1,$x2,$y2,'draw_line');
}
/**
* Draw a rectangle
*
* @param int Upper left X coordinate
* @param int Upper left Y coordinate
* @param int Width
* @param int Height
*
* @return bool False if no image is set yet
* @access public
*/
function draw_rectangle($x,$y,$w,$h)
{
return $this->_draw_something($x,$y,$w,$h,'draw_rectangle');
}
/**
* Fill an ellipse
*
* @param int Center X coordinate
* @param int Center Y coordinate
* @param int Ellipse horizontal amplitude
* @param int Ellipse vertical amplitude
*
* @return bool False if no image is set yet
* @access public
*/
function fill_ellipse($x,$y,$w,$h)
{
return $this->_draw_something($x,$y,$w,$h,'fill_ellipse');
}
/**
* Fill a rectangle
*
* @param int Upper left X coordinate
* @param int Upper left Y coordinate
* @param int Width
* @param int Height
*
* @return bool False if no image is set yet
* @access public
*/
function fill_rectangle($x,$y,$w,$h)
{
return $this->_draw_something($x,$y,$w,$h,'fill_rectangle');
}
/**
* Get the current image resource id#
*
* @access public
*/
function get_image()
{
return $this->im;
}
/**
* Set the image resource id# to draw on
*
* @param int Image resource id#
* @access public
*/
function set_image($im)
{
$this->im = $im;
}
};
?>
|