-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package haxe.ui.backend.openfl.filters; | ||
|
||
import openfl.filters.ColorMatrixFilter; | ||
|
||
class BrightnessFilter { | ||
public var filter:ColorMatrixFilter; | ||
|
||
public function new(multiplier:Float = 1) { | ||
// In html, 0 is a black image, 1 has no effect, over it's a multiplier | ||
// So we adapt | ||
if (multiplier <= 1) multiplier = (multiplier -1) * 255; | ||
if (multiplier > 1) multiplier = (multiplier -1) * 110; | ||
|
||
filter = new ColorMatrixFilter([ | ||
1,0,0,0,multiplier, | ||
0,1,0,0,multiplier, | ||
0,0,1,0,multiplier, | ||
0,0,0,1,0, | ||
0,0,0,0,1]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package haxe.ui.backend.openfl.filters; | ||
|
||
import openfl.filters.ColorMatrixFilter; | ||
|
||
class InvertFilter { | ||
public var filter:ColorMatrixFilter; | ||
|
||
/*<filter id="invert"> | ||
<feComponentTransfer> | ||
<feFuncR type="table" tableValues="[amount] (1 - [amount])"/> | ||
<feFuncG type="table" tableValues="[amount] (1 - [amount])"/> | ||
<feFuncB type="table" tableValues="[amount] (1 - [amount])"/> | ||
</feComponentTransfer> | ||
</filter>*/ | ||
|
||
public function new(multiplier:Float = 1) { | ||
filter = new ColorMatrixFilter([ | ||
-1*multiplier, 0, 0, 0, 255, | ||
0, -1*multiplier, 0, 0, 255, | ||
0, 0, -1*multiplier, 0, 255, | ||
0, 0, 0, 1, 0]); | ||
} | ||
} |