Beispiel #1
0
 /**
  * Generates the background grid.png
  *
  * @author Anthony Short
  * @param $cl Column width
  * @param $bl Baseline
  * @param $gw Gutter Width
  * @return null
  */
 private static function create_grid_image($cw, $bl, $lgw, $rgw, $file)
 {
     if (!file_exists($file)) {
         $image = ImageCreate($cw + $lgw + $rgw, $bl);
         $colorWhite = ImageColorAllocate($image, 255, 255, 255);
         $colorGrey = ImageColorAllocate($image, 200, 200, 200);
         $colorBlue = ImageColorAllocate($image, 240, 240, 255);
         # Draw left gutter
         Imagefilledrectangle($image, 0, 0, $lgw - 1, $bl, $colorWhite);
         # Draw column
         Imagefilledrectangle($image, $lgw, 0, $cw + $lgw - 1, $bl, $colorBlue);
         # Draw right gutter
         Imagefilledrectangle($image, $lgw + $cw + 1, 0, $lgw + $cw + $rgw, $bl, $colorWhite);
         # Draw baseline
         imageline($image, 0, $bl - 1, $lgw + $cw + $rgw, $bl - 1, $colorGrey);
         CSScaffold::cache_create(dirname($file));
         ImagePNG($image, $file);
         # Kill it
         ImageDestroy($image);
     }
 }