* @TODO: - Can we depend on the Horde_Util:: class or some other solution needed?
* - Exceptions
*/
-abstract class Horde_Image_Base Implements Iterator
+abstract class Horde_Image_Base extends EmptyIterator
{
/**
* Background color.
* Constructor.
*
* @param string $rgb The base color for generated pixels/images.
+ *
+ * @throws InvalidArgumentException
*/
protected function __construct($params, $context = array())
{
}
/**
- * Return the current image from the internal iterator.
- *
- * @return Horde_Image_Gd
- */
- public function current()
- {
- return clone($this);
- }
-
- /**
- * Get the index of the internal iterator.
- *
- * @return integer
- */
- public function key()
- {
- return 0;
- }
-
- /**
- * Advance the iterator
- *
- * @return Horde_Image_Imagick
- */
- public function next()
- {
- return null;
- }
-
- /**
- * Deterimines if the current iterator item is valid.
- *
- * @return boolean
- */
- public function valid()
- {
- return false;
- }
-
- /**
* Request a specific image from the collection of images.
*
* @param integer $index The index to return
/**
* PNG image constructor.
*/
- function Horde_Image_png($params)
+ public function __construct($params, $context = array())
{
- parent::Horde_Image($params);
+ parent::__construct($params, $context);
if (!empty($params['width'])) {
$this->rectangle(0, 0, $params['width'], $params['height'], $this->_background, $this->_background);
*/
function rectangle($x, $y, $width, $height, $color = 'black', $fill = 'none')
{
- list($r, $g, $b) = $this->getRGB($color);
+ list($r, $g, $b) = Horde_Image::getRGB($color);
if ($fill != 'none') {
- list($fR, $fG, $fB) = $this->getRGB($fill);
+ list($fR, $fG, $fB) = Horde_Image::getRGB($fill);
}
$x2 = $x + $width;
return pack('N', (($s2 << 16) | $s1));
}
+ /**
+ * Request a specific image from the collection of images.
+ *
+ * @param integer $index The index to return
+ *
+ * @return Horde_Image_Base
+ * @throws Horde_Image_Exception
+ */
+ public function getImageAtIndex($index)
+ {
+ if ($index > 0) {
+ throw new Horde_Image_Exception('Image index out of bounds.');
+ }
+
+ return clone($this);
+ }
+
+ /**
+ * Return the number of image pages available in the image object.
+ *
+ * @return integer
+ */
+ public function getImagePageCount()
+ {
+ return 1;
+ }
+
}