• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SHADER_H_
6 #define FLUTTER_LIB_UI_PAINTING_IMAGE_SHADER_H_
7 
8 #include "flutter/lib/ui/dart_wrapper.h"
9 #include "flutter/lib/ui/painting/gradient.h"
10 #include "flutter/lib/ui/painting/image.h"
11 #include "flutter/lib/ui/painting/matrix.h"
12 #include "flutter/lib/ui/painting/shader.h"
13 #include "third_party/skia/include/core/SkMatrix.h"
14 #include "third_party/skia/include/core/SkShader.h"
15 
16 namespace tonic {
17 class DartLibraryNatives;
18 }  // namespace tonic
19 
20 namespace flutter {
21 
22 class ImageShader : public Shader {
23   DEFINE_WRAPPERTYPEINFO();
24   FML_FRIEND_MAKE_REF_COUNTED(ImageShader);
25 
26  public:
27   ~ImageShader() override;
28   static fml::RefPtr<ImageShader> Create();
29 
30   void initWithImage(CanvasImage* image,
31                      SkTileMode tmx,
32                      SkTileMode tmy,
33                      const tonic::Float64List& matrix4);
34 
35   static void RegisterNatives(tonic::DartLibraryNatives* natives);
36 
37  private:
38   ImageShader();
39 };
40 
41 }  // namespace flutter
42 
43 #endif  // FLUTTER_LIB_UI_PAINTING_IMAGE_SHADER_H_
44