Flutter Engine
The Flutter Engine
gradient.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_GRADIENT_H_
6#define FLUTTER_LIB_UI_PAINTING_GRADIENT_H_
7
8#include "flutter/display_list/effects/dl_color_source.h"
9#include "flutter/lib/ui/painting/matrix.h"
10#include "flutter/lib/ui/painting/shader.h"
12
13namespace flutter {
14
15class CanvasGradient : public Shader {
16 DEFINE_WRAPPERTYPEINFO();
17 FML_FRIEND_MAKE_REF_COUNTED(CanvasGradient);
18
19 public:
20 ~CanvasGradient() override;
21 static void Create(Dart_Handle wrapper);
22
23 void initLinear(const tonic::Float32List& end_points,
24 const tonic::Int32List& colors,
25 const tonic::Float32List& color_stops,
26 DlTileMode tile_mode,
27 const tonic::Float64List& matrix4);
28
29 void initRadial(double center_x,
30 double center_y,
31 double radius,
32 const tonic::Int32List& colors,
33 const tonic::Float32List& color_stops,
34 DlTileMode tile_mode,
35 const tonic::Float64List& matrix4);
36
37 void initSweep(double center_x,
38 double center_y,
39 const tonic::Int32List& colors,
40 const tonic::Float32List& color_stops,
41 DlTileMode tile_mode,
42 double start_angle,
43 double end_angle,
44 const tonic::Float64List& matrix4);
45
46 void initTwoPointConical(double start_x,
47 double start_y,
48 double start_radius,
49 double end_x,
50 double end_y,
51 double end_radius,
52 const tonic::Int32List& colors,
53 const tonic::Float32List& color_stops,
54 DlTileMode tile_mode,
55 const tonic::Float64List& matrix4);
56
57 std::shared_ptr<DlColorSource> shader(DlImageSampling sampling) override {
58 // Gradient color sources do not have image sampling variants...
59 return dl_shader_;
60 }
61
62 private:
64 std::shared_ptr<DlColorSource> dl_shader_;
65};
66
67} // namespace flutter
68
69#endif // FLUTTER_LIB_UI_PAINTING_GRADIENT_H_
static void Create(Dart_Handle wrapper)
Definition: gradient.cc:20
void initRadial(double center_x, double center_y, double radius, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
Definition: gradient.cc:57
void initLinear(const tonic::Float32List &end_points, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
Definition: gradient.cc:26
std::shared_ptr< DlColorSource > shader(DlImageSampling sampling) override
Definition: gradient.h:57
void initTwoPointConical(double start_x, double start_y, double start_radius, double end_x, double end_y, double end_radius, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
Definition: gradient.cc:118
void initSweep(double center_x, double center_y, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, double start_angle, double end_angle, const tonic::Float64List &matrix4)
Definition: gradient.cc:86
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkSamplingOptions sampling
Definition: SkRecords.h:337