PHP Classes

File: fill.pimg.php

Recommend this page to a friend!
  Classes of Tony Bogdanov   PIMG   fill.pimg.php   Download  
File: fill.pimg.php
Role: Class source
Content type: text/plain
Description: Class for filling the image with a color
Class: PIMG
Process images using multiple operations
Author: By
Last change: 1.1
Date: 14 years ago
Size: 704 bytes
 

Contents

Class file image Download
<?php
/* PIMG module: fill's the image with a chosen color */
class pimg_fill
{
   
/* Resources */
   
private $pimg;
   
   
// PIMG constructor
   
function __construct($pimg)
    {
       
$this -> pimg = $pimg;
    }
   
   
   
   
/*
        Fills the image with the specified color
        @param: $color - a pimg_color instance
        @result: pimg_image instance
    */
   
function init($color)
    {
       
/* INPUT VALIDATORS */
       
if (!$color instanceOf pimg_color)
           
$this -> pimg -> setDebug('The passed fill color is not a valid pimg_color', 'error', __CLASS__);
       
       
// Fill the image
       
imagefill($this -> pimg -> handle(), 0, 0, $color -> allocate());
       
       
// Return pimg_image instance
       
return $this -> pimg;
    }
}
?>