|
@@ -37,6 +37,12 @@ class _VidCanvasPlayerState extends State<VidCanvasPlayer> {
|
|
|
ListQueue<int> frames = ListQueue<int>()..addFirst(30);
|
|
|
int maxFramesNum = 10;
|
|
|
int curFPS = 30;
|
|
|
+ List<double> curColorFilterMatrix = <double>[
|
|
|
+ 1, 0, 0, 0, 0,
|
|
|
+ 0, 1, 0, 0, 0,
|
|
|
+ 0, 0, 1, 0, 0,
|
|
|
+ 0, 0, 0, 1, 0,
|
|
|
+ ];
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -69,12 +75,22 @@ class _VidCanvasPlayerState extends State<VidCanvasPlayer> {
|
|
|
if (e is VidPlayerContrastChangeEvent) {
|
|
|
updateFrame();
|
|
|
}
|
|
|
+ if (e is VidPlayerFilterChangeEvent) {
|
|
|
+ onFilterMatrixChanged(e);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void onFrameChanged(VidPlayerFrameIndexChangeEvent e) {
|
|
|
loadFrame(e);
|
|
|
}
|
|
|
|
|
|
+ void onFilterMatrixChanged(VidPlayerFilterChangeEvent e) {
|
|
|
+ setState(() {
|
|
|
+ curColorFilterMatrix = e.filterMatrix;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
void loadFrame(VidPlayerFrameIndexChangeEvent e) async {
|
|
|
|
|
|
|
|
@@ -177,7 +193,8 @@ class _VidCanvasPlayerState extends State<VidCanvasPlayer> {
|
|
|
if (image != null) {
|
|
|
final size = MediaQuery.of(context).size;
|
|
|
return CustomPaint(
|
|
|
- painter: VidPainter(image: image!),
|
|
|
+ painter:
|
|
|
+ VidPainter(image: image!, colorFilterMatrix: curColorFilterMatrix),
|
|
|
isComplex: false,
|
|
|
size: size,
|
|
|
);
|