Flutter Engine
image_filter.h
Go to the documentation of this file.
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/color_filter.h"
10 #include "flutter/lib/ui/painting/image.h"
11 #include "flutter/lib/ui/painting/picture.h"
12 #include "third_party/skia/include/core/SkImageFilter.h"
14 
15 namespace flutter {
16 
17 class ImageFilter : public RefCountedDartWrappable<ImageFilter> {
18  DEFINE_WRAPPERTYPEINFO();
19  FML_FRIEND_MAKE_REF_COUNTED(ImageFilter);
20 
21  public:
22  ~ImageFilter() override;
24 
25  static SkSamplingOptions SamplingFromIndex(int filterQualityIndex);
26  static SkFilterMode FilterModeFromIndex(int index);
27 
28  void initImage(CanvasImage* image);
29  void initPicture(Picture*);
30  void initBlur(double sigma_x, double sigma_y, SkTileMode tile_mode);
31  void initMatrix(const tonic::Float64List& matrix4, int filter_quality_index);
32  void initColorFilter(ColorFilter* colorFilter);
33  void initComposeFilter(ImageFilter* outer, ImageFilter* inner);
34 
35  const sk_sp<SkImageFilter>& filter() const { return filter_; }
36 
37  static void RegisterNatives(tonic::DartLibraryNatives* natives);
38 
39  private:
40  ImageFilter();
41 
42  sk_sp<SkImageFilter> filter_;
43 };
44 
45 } // namespace flutter
46 
47 #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_
void initImage(CanvasImage *image)
Definition: image_filter.cc:71
~ImageFilter() override
Definition: image_filter.cc:69
static fml::RefPtr< ImageFilter > Create()
Definition: image_filter.cc:39
static SkFilterMode FilterModeFromIndex(int index)
Definition: image_filter.cc:60
void initColorFilter(ColorFilter *colorFilter)
Definition: image_filter.cc:92
void initComposeFilter(ImageFilter *outer, ImageFilter *inner)
Definition: image_filter.cc:97
void initBlur(double sigma_x, double sigma_y, SkTileMode tile_mode)
Definition: image_filter.cc:79
static SkSamplingOptions SamplingFromIndex(int filterQualityIndex)
Definition: image_filter.cc:50
const sk_sp< SkImageFilter > & filter() const
Definition: image_filter.h:35
static void RegisterNatives(tonic::DartLibraryNatives *natives)
Definition: image_filter.cc:33
void initMatrix(const tonic::Float64List &matrix4, int filter_quality_index)
Definition: image_filter.cc:85
void initPicture(Picture *)
Definition: image_filter.cc:75