コード例 #1
0
ファイル: Fluid.php プロジェクト: yomy/dotmatrixrenderer
 /**
  * @param RelationCell $cell
  * @param int $x
  * @param int $y
  * @param int $xc
  * @param int $yc
  */
 private function renderLightCell(RelationCell $cell, $x, $y, $xc, $yc)
 {
     if ($cell->topLeft()) {
         imagefilledrectangle($this->GDResource, $x, $y, $xc, $yc, $this->darkColorGD);
     }
     if ($cell->topRight()) {
         imagefilledrectangle($this->GDResource, $xc, $y, $x + $this->getModuleSize(), $yc, $this->darkColorGD);
     }
     if ($cell->bottomLeft()) {
         imagefilledrectangle($this->GDResource, $x, $yc, $xc, $y + $this->getModuleSize(), $this->darkColorGD);
     }
     if ($cell->bottomRight()) {
         imagefilledrectangle($this->GDResource, $xc, $yc, $x + $this->getModuleSize(), $y + $this->getModuleSize(), $this->darkColorGD);
     }
     imagefilledellipse($this->GDResource, $xc, $yc, $this->getModuleSize() - 1, $this->getModuleSize() - 1, $this->lightColorGD);
 }
コード例 #2
0
 /**
  * @param int $l1
  * @param int $l2
  * @param int $l3
  * @param int $l4
  * @param int $l5
  * @param int $l6
  * @param int $l7
  * @param int $l8
  * @param int $l9
  * @dataProvider combinationDataProvider
  */
 public function testRelationCellValues($l1, $l2, $l3, $l4, $l5, $l6, $l7, $l8, $l9)
 {
     $relationCell = new RelationCell($l7, $l8, $l9, $l4, $l5, $l6, $l1, $l2, $l3);
     $expectedNeighborCount = $l2 + $l4 + $l6 + $l8;
     $expectedSurroundCount = $l1 + $l2 + $l3 + $l4 + $l6 + $l7 + $l8 + $l9;
     $this->assertEquals($l1, $relationCell->bottomLeft());
     $this->assertEquals($l2, $relationCell->bottom());
     $this->assertEquals($l3, $relationCell->bottomRight());
     $this->assertEquals($l4, $relationCell->left());
     $this->assertEquals($l5, $relationCell->isDark());
     $this->assertEquals($l6, $relationCell->right());
     $this->assertEquals($l7, $relationCell->topLeft());
     $this->assertEquals($l8, $relationCell->top());
     $this->assertEquals($l9, $relationCell->topRight());
     $this->assertEquals($l1 || $l2 || $l4, $relationCell->anyBottomLeft());
     $this->assertEquals($l2 || $l3 || $l6, $relationCell->anyBottomRight());
     $this->assertEquals($l4 || $l7 || $l8, $relationCell->anyTopLeft());
     $this->assertEquals($l8 || $l9 || $l6, $relationCell->anyTopRight());
     $this->assertEquals($expectedNeighborCount, $relationCell->neighbourCount());
     $this->assertEquals($expectedSurroundCount, $relationCell->surroundCount());
 }