mWidth = $Width; $this->mHeight = $Height; $this->mStyle = $Style; $this->mFont = BCD_DEFAULT_FONT; $this->mImg = ImageCreate($this->mWidth, $this->mHeight); $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR; $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR; $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16, ($dbColor & 0x00FF00) >> 8 , $dbColor & 0x0000FF); $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16, ($dfColor & 0x00FF00) >> 8 , $dfColor & 0x0000FF); if(!($this->mStyle & BCS_TRANSPARENT)) ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor); } function DrawObject($xres) { // Abstract function return false; } function DrawBorder() { ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush); } function DrawChar($Font, $xPos, $yPos, $Char) { ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); } function DrawText($Font, $xPos, $yPos, $Char) { ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); } function DrawSingleBar($xPos, $yPos, $xSize, $ySize) { if($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) { for($i=0;$i<$xSize;$i++) ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush); return true; } return false; } function GetError() { return $this->mError; } function GetFontHeight($font) { return ImageFontHeight($font); } function GetFontWidth($font) { return ImageFontWidth($font); } function SetFont($font) { $this->mFont = $font; } function GetStyle() { return $this->mStyle; } function SetStyle($Style) { $this->mStyle = $Style; } function GetImage() { if(($this->mStyle & BCS_BORDER)) $this->DrawBorder(); ob_start(); if($this->mStyle & BCS_IMAGE_PNG) ImagePng($this->mImg); else if($this->mStyle & BCS_IMAGE_JPEG) ImageJpeg($this->mImg, "", 100); $imagedata = ob_get_contents(); ob_end_clean(); return $imagedata; } function FlushObject() { if(($this->mStyle & BCS_BORDER)) $this->DrawBorder(); if($this->mStyle & BCS_IMAGE_PNG) { Header("Content-Type: image/png"); ImagePng($this->mImg); } else if($this->mStyle & BCS_IMAGE_JPEG) { Header("Content-Type: image/jpeg"); ImageJpeg($this->mImg); } } function DestroyObject() { ImageDestroy($this->mImg); } } ?>