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