1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_
6#define FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_
7
8#include "flutter/lib/ui/dart_wrapper.h"
9#include "flutter/lib/ui/painting/image.h"
10#include "flutter/lib/ui/painting/picture.h"
11#include "third_party/skia/include/core/SkImageFilter.h"
12#include "third_party/tonic/typed_data/typed_list.h"
13
14namespace flutter {
15
16class ImageFilter : public RefCountedDartWrappable<ImageFilter> {
17 DEFINE_WRAPPERTYPEINFO();
18 FML_FRIEND_MAKE_REF_COUNTED(ImageFilter);
19
20 public:
21 ~ImageFilter() override;
22 static fml::RefPtr<ImageFilter> Create();
23
24 void initImage(CanvasImage* image);
25 void initPicture(Picture*);
26 void initBlur(double sigma_x, double sigma_y);
27 void initMatrix(const tonic::Float64List& matrix4, int filter_quality);
28
29 const sk_sp<SkImageFilter>& filter() const { return filter_; }
30
31 static void RegisterNatives(tonic::DartLibraryNatives* natives);
32
33 private:
34 ImageFilter();
35
36 sk_sp<SkImageFilter> filter_;
37};
38
39} // namespace flutter
40
41#endif // FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_
42