<?
require_once('bililitePDF_1.php');

class 
bililitePDF_2 extends bililitePDF_1{
    protected 
$currentPage = NULL;

    public function 
newpage(){
        
parent::newpage();
        
$this->currentPage = $this->pages[count($this->pages)-1];
    }
    public function 
moveto($x, $y){;
        
$this->currentPage->contents .= "$x $y m\n";
    }
    public function 
lineto($x, $y){
        
$this->currentPage->contents .= "$x $y l\n";
    }
    public function 
curveto($x1, $y1, $x2, $y2, $x3, $y3){
        
// see http://processingjs.nihongoresources.com/bezierinfo/ for Bezier curve info
        
$this->currentPage->contents .= "$x1 $y1 $x2 $y2 $x3 $y3 c\n";
    }
    public function 
rect ($x, $y, $w, $h){
        
$this->currentPage->contents .= "$x $y $w $h re\n";
    }
    public function 
closepath(){
        
$this->currentPage->contents .= "h\n";
    }
    public function 
linewidth($w){
        
$this->currentPage->contents .= "$w w\n";
    }
    public function 
stroke ($r, $g, $b){
        
$r /= 255; //  change to 0.0-1.0 range
        
$g /= 255;
        
$b /= 255;
        
$this->currentPage->contents .= "$r $g $b RG S\n";
    }
    public function 
fill ($r, $g, $b){
        
$r /= 255; //  change to 0.0-1.0 range
        
$g /= 255;
        
$b /= 255;
        
$this->currentPage->contents .= "$r $g $b rg f\n";
    }
}
?>