[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/lipsum/image/ -> PhabricatorLipsumMondrianArtist.php (source)

   1  <?php
   2  
   3  final class PhabricatorLipsumMondrianArtist extends PhabricatorLipsumArtist {
   4  
   5    protected function draw($image, $x, $y) {
   6      $c_white = 0xFFFFFF;
   7      $c_black = 0x000000;
   8      imagefill($image, 0, 0, $c_white);
   9  
  10      $lines_h = mt_rand(2, 5);
  11      $lines_v = mt_rand(2, 5);
  12  
  13      for ($ii = 0; $ii < $lines_h; $ii++) {
  14        $yp = mt_rand(0, $y);
  15  
  16        $thickness = mt_rand(2, 3);
  17        for ($jj = 0; $jj < $thickness; $jj++) {
  18          imageline($image, 0, $yp + $jj, $x, $yp + $jj, $c_black);
  19        }
  20      }
  21  
  22      for ($ii = 0; $ii < $lines_v; $ii++) {
  23        $xp = mt_rand(0, $x);
  24  
  25        $thickness = mt_rand(2, 3);
  26        for ($jj = 0; $jj < $thickness; $jj++) {
  27          imageline($image, $xp + $jj, 0, $xp + $jj, $y, $c_black);
  28        }
  29      }
  30  
  31      $fills = mt_rand(3, 8);
  32      for ($ii = 0; $ii < $fills; $ii++) {
  33        $xp = mt_rand(0, $x - 1);
  34        $yp = mt_rand(0, $y - 1);
  35        if (imagecolorat($image, $xp, $yp) != $c_white) {
  36          continue;
  37        }
  38  
  39        $c_fill = $this->getHSBColor(
  40          mt_rand(0, 359),
  41          mt_rand(80, 100) / 100,
  42          mt_rand(90, 100) / 100);
  43  
  44        imagefill($image, $xp, $yp, $c_fill);
  45      }
  46    }
  47  
  48  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1