Login   Register  
PHP Classes
elePHPant
Icontem

File: fill.pimg.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2010-10-31 18:37
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(), 00$color -> allocate());
        
        
// Return pimg_image instance
        
return $this -> pimg;
    }
}
?>