| Flutter Impeller |

gradient_generator.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_IMPELLER_ENTITY_CONTENTS_GRADIENT_GENERATOR_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_GRADIENT_GENERATOR_H_
7
8 #include <functional>
9 #include <memory>
10 #include <vector>
11
12 #include "flutter/fml/macros.h"
13 #include "flutter/impeller/core/texture.h"
14 #include "impeller/core/shader_types.h"
15 #include "impeller/geometry/color.h"
16 #include "impeller/geometry/gradient.h"
17 #include "impeller/geometry/path.h"
18 #include "impeller/geometry/point.h"
19
20 namespace impeller {
21
22 class Context;
23
24 /**
25 * @brief Create a host visible texture that contains the gradient defined
26 * by the provided gradient data.
27 */
28 std::shared_ptr<Texture> CreateGradientTexture(
29 const GradientData& gradient_data,
30 const std::shared_ptr<impeller::Context>& context);
31
32 struct StopData {
33 Color color;
34 Scalar stop;
35 Padding<12> _padding_;
36 };
37
38 /**
39 * @brief Populate a vector with the color and stop data for a gradient
40 *
41 * @param colors
42 * @param stops
43 * @return StopData
44 */
45 std::vector<StopData> CreateGradientColors(const std::vector<Color>& colors,
46 const std::vector<Scalar>& stops);
47
48 } // namespace impeller
49
50 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_GRADIENT_GENERATOR_H_
path.h
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Color
Definition: color.h:124
impeller::StopData::stop
Scalar stop
Definition: gradient_generator.h:34
impeller::StopData::color
Color color
Definition: gradient_generator.h:33
gradient.h
impeller::StopData
Definition: gradient_generator.h:32
impeller::Padding< 12 >
texture.h
color.h
impeller::CreateGradientColors
std::vector< StopData > CreateGradientColors(const std::vector< Color > &colors, const std::vector< Scalar > &stops)
Populate a vector with the color and stop data for a gradient.
Definition: gradient_generator.cc:45
impeller::CreateGradientTexture
std::shared_ptr< Texture > CreateGradientTexture(const GradientData &gradient_data, const std::shared_ptr< impeller::Context > &context)
Create a host visible texture that contains the gradient defined by the provided gradient data.
Definition: gradient_generator.cc:17
shader_types.h
impeller
Definition: aiks_blur_unittests.cc:20
impeller::StopData::_padding_
Padding< 12 > _padding_
Definition: gradient_generator.h:35