Changeset 573 for trunk/web2


Ignore:
Timestamp:
01/29/09 13:32:32 (15 years ago)
Author:
ramonb
Message:

job_monarch/libtoga.php:

  • made clusterimage background transparent
  • added drop shadows to nodes in clusterimage
  • nodes seperated by 1 empty pixels in clusterimage

job_monarch/conf.php:

  • altered settings to display new clusterimage nicer
Location:
trunk/web2/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/conf.php

    r552 r573  
    4141// (250 pixels is same width as Ganglia's pie chart)
    4242//
    43 $BIG_CLUSTERIMAGE_MAXWIDTH = 500;
     43$BIG_CLUSTERIMAGE_MAXWIDTH = 700;
    4444
    45 // The size of a single node in the small clusterimage
     45// The size of a single node in the big clusterimage
    4646//
    47 $BIG_CLUSTERIMAGE_NODEWIDTH = 11;
     47$BIG_CLUSTERIMAGE_NODEWIDTH = 14;
    4848
    4949// Max size of small host image
  • trunk/web2/addons/job_monarch/libtoga.php

    r569 r573  
    11921192                $this->size     = $BIG_CLUSTERIMAGE_NODEWIDTH;
    11931193
     1194                $this->drawShadow();
    11941195                $this->draw();
     1196        }
     1197
     1198        function drawShadow()
     1199        {
     1200                // offset of drop shadow from top left
     1201                //
     1202                $ds_offset      = 5;
     1203 
     1204                // number of steps from black to background color
     1205                //
     1206                $ds_steps       = 15;
     1207
     1208                // distance between steps
     1209                //
     1210                $ds_spread = 1;
     1211
     1212                // define the background color
     1213                //
     1214                $background = array("r" => 255, "g" => 255, "b" => 255);
     1215
     1216                // create a new canvas.  New canvas dimensions should be larger than the original's
     1217                //
     1218                $width  = $this->size + $ds_offset;
     1219                $height = $this->size + $ds_offset;
     1220
     1221                // determine the offset between colors
     1222                //
     1223                $step_offset = array("r" => ($background["r"] / $ds_steps), "g" => ($background["g"] / $ds_steps), "b" => ($background["b"] / $ds_steps));
     1224
     1225                // calculate and allocate the needed colors
     1226                //
     1227                $current_color = $background;
     1228
     1229                for ($i = 0; $i <= $ds_steps ; $i++)
     1230                {
     1231                        $colors[$i] = imagecolorallocate($this->image, round($current_color["r"]), round($current_color["g"]), round($current_color["b"]));
     1232
     1233                        $current_color["r"] -= $step_offset["r"];
     1234                        $current_color["g"] -= $step_offset["g"];
     1235                        $current_color["b"] -= $step_offset["b"];
     1236                }
     1237
     1238                // draw overlapping rectangles to create a drop shadow effect
     1239                //
     1240                for ($i = 3; $i < count($colors); $i++)
     1241                {
     1242                        imagefilledrectangle( $this->image, ($this->x + $ds_offset), ($this->y + $ds_offset), ($this->x + $width), ($this->y + $height), $colors[$i] );
     1243                        $width -= $ds_spread;
     1244                        $height -= $ds_spread;
     1245                }
    11951246        }
    11961247
     
    12021253                $size = $this->size;
    12031254
    1204                 imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+($size), $this->y+($size), $black_color );
     1255                imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+($size-2), $this->y+($size-2), $black_color );
    12051256
    12061257                if( $this->showinfo)
     
    12191270                        $load = $this->determineLoad();
    12201271                        $usecolor = $this->colorHex( load_color($load) );
    1221                         imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+($size-1), $this->y+($size-1), $usecolor );
     1272                        imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+($size-3), $this->y+($size-3), $usecolor );
    12221273                        if( $this->down )
    12231274                        {
     
    19622013                $this->nodes    = &$nodes;
    19632014
     2015                imageColorTransparent( $image, $colorwhite );
     2016
    19642017                if ($this->output)
    19652018                {
Note: See TracChangeset for help on using the changeset viewer.