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 13 namespace flutter { 14 15 class ImageFilter : public RefCountedDartWrappable<ImageFilter> { 16 DEFINE_WRAPPERTYPEINFO(); 17 FML_FRIEND_MAKE_REF_COUNTED(ImageFilter); 18 19 public: 20 ~ImageFilter() override; 21 static fml::RefPtr<ImageFilter> Create(); 22 23 void initImage(CanvasImage* image); 24 void initPicture(Picture*); 25 void initBlur(double sigma_x, double sigma_y); 26 void initMatrix(const std::vector<double>& matrix4, int filter_quality); 27 filter()28 const sk_sp<SkImageFilter>& filter() { return filter_; } 29 30 static void RegisterNatives(tonic::DartLibraryNatives* natives); 31 32 private: 33 ImageFilter(); 34 35 sk_sp<SkImageFilter> filter_; 36 }; 37 38 } // namespace flutter 39 40 #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_ 41