Esempio n. 1
0
 /**
  *
  * @param ILess_Node_Color $color1 The first color
  * @param ILess_Node_Color $color2 The second color
  */
 public function screen(ILess_Node_Color $color1, ILess_Node_Color $color2)
 {
     /*
     $rs1 = ILess_Math::substract('255', $color1->getRed(true));
     $rs2 = ILess_Math::substract('255', $color2->getRed(true));
     $r = ILess_Math::substract('255', ILess_Math::divide(ILess_Math::multiply($rs1, $rs2), '255'));
     
     $rs1 = ILess_Math::substract('255', $color1->getGreen(true));
     $rs2 = ILess_Math::substract('255', $color2->getGreen(true));
     $g = ILess_Math::substract('255', ILess_Math::divide(ILess_Math::multiply($rs1, $rs2), '255'));
     
     $rs1 = ILess_Math::substract('255', $color1->getBlue(true));
     $rs2 = ILess_Math::substract('255', $color2->getBlue(true));
     $b = ILess_Math::substract('255', ILess_Math::divide(ILess_Math::multiply($rs1, $rs2), '255'));
     */
     // Formula: Result Color = 255 - [((255 - Top Color)*(255 - Bottom Color))/255]
     // $b = 255 - (255 - $color1->getBlue(true)) * (255 - $color2->getBlue(true)) / 255;
     $r = 255 - (255 - $color1->getRed(true)) * (255 - $color2->getRed(true)) / 255;
     $g = 255 - (255 - $color1->getGreen(true)) * (255 - $color2->getGreen(true)) / 255;
     $b = 255 - (255 - $color1->getBlue(true)) * (255 - $color2->getBlue(true)) / 255;
     return $this->rgb($r, $g, $b);
 }
Esempio n. 2
0
 /**
  * @covers getGreen
  */
 public function testGetGreen()
 {
     $color = new ILess_Node_Color('#00ddff');
     $this->assertInstanceOf('ILess_Node_Dimension', $color->getGreen());
     $this->assertEquals('221', (string) $color->getGreen());
 }