/** * * @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); }
/** * @covers getBlue */ public function testGetBlue() { $color = new ILess_Node_Color('#ff00cc'); $this->assertInstanceOf('ILess_Node_Dimension', $color->getBlue()); $this->assertEquals('204', (string) $color->getBlue()); }