PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/experimental/graphic/GraphicContext.php

http://zoop.googlecode.com/
PHP | 165 lines | 23 code | 6 blank | 136 comment | 0 complexity | 69c062d1336d1defddd7531edcb9bded MD5 | raw file
  1<?php
  2abstract class GraphicContext
  3{
  4	//	general stuff
  5	protected $width;
  6	protected $height;
  7	
  8	/*
  9	//	the font stuff
 10	var $textSize;
 11	var $textStyle;
 12	var $textFontName;
 13	
 14	//	the color stuff
 15	var $colors;
 16	var $curLineColor;
 17	var $lineColorStack;
 18	var $curFillColor;
 19	var $curTextColor;
 20    */
 21
 22	function __construct()
 23	{		
 24		/*
 25		//	the font stuff
 26		$this->textSize = 10;
 27		$this->textStyle = '';
 28		$this->textFontName = 'Arial';
 29		
 30		//	the color stuff
 31		$this->colors = array();
 32		$this->addColor('black', 0, 0, 0);
 33		$this->addColor('gray', 128, 128, 128);
 34		$this->addColor('white', 255, 255, 255);
 35		$this->setCurLineColor('black');
 36		$this->setCurFillColor('gray');
 37		$this->setCurTextColor('black');
 38		$this->lineColorStack = array();
 39		*/
 40	}
 41		
 42	public function init($size, $fontName, $fontSize)
 43	{
 44		trigger_error('pseudo virtual function called');
 45	}
 46		
 47	protected function assignSize($size)
 48	{
 49		$parts = explode(':', $size);
 50		$this->width = $parts[0];
 51		$this->height = $parts[1];
 52	}
 53	
 54	public function getWidth()
 55	{
 56		return $this->width;
 57	}
 58	
 59	/*
 60	//	it just so happens these are always implemented the same way so far
 61	function setColor($name, $r, $g, $b)
 62	{
 63		$this->addColor($name, $r, $g, $b);
 64	}	
 65	
 66	
 67	function getHeight()
 68	{
 69		return $this->height;
 70	}
 71	
 72	function getPageHeight()
 73	{
 74		return $this->getHeight();
 75	}
 76	
 77	function _getCurTextColor()
 78	{
 79		return $this->colors[$this->curTextColor];
 80	}
 81	
 82	function _getCurLineColor()
 83	{
 84		return $this->colors[$this->curLineColor];
 85	}
 86	
 87	function _getCurFillColor()
 88	{
 89		return $this->colors[$this->curFillColor];
 90	}
 91	
 92	function setCurLineColor($color)
 93	{
 94		$this->curLineColor = $color;
 95	}
 96	
 97	function setCurFillColor($color)
 98	{
 99		$this->curFillColor = $color;
100	}
101	
102	function setCurTextColor($color)
103	{
104		$this->curTextColor = $color;
105	}
106	
107	function pushLineColor($color)
108	{
109		array_push($this->lineColorStack, $this->curLineColor);
110		$this->setCurLineColor($color);
111	}
112	
113	function popLineColor()
114	{
115		//	is this right?  shouldn't we be setting it to what is on the top AFTER we pop the stack
116		assert(count($this->lineColorStack) > 0);
117		$this->setCurLineColor(array_pop($this->lineColorStack));
118	}
119	
120	function getPageWidth()
121	{
122		return $this->width;
123	}
124	
125	function getTextSize()
126	{
127		return $this->textSize;
128	}
129	
130	function setTextSize($size)
131	{
132		$this->textSize = $size;
133	}
134	
135	function getTextStyle()
136	{
137		return $this->textStyle;
138	}
139	
140	function setTextStyle($style)
141	{
142		$this->textStyle = $style;
143	}
144	
145	function getTextFontName()
146	{
147		return $this->textFontName;
148	}
149	
150	function setTextFontName($font)
151	{
152		$this->textFontName = $font;
153	}
154	
155	function useKerningHack()
156	{
157		return 0;
158	}
159	
160	function getLineHeightMultiplier()
161	{
162		return 1;
163	}
164	*/
165}