| // Copyright 2013 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #pragma once |
| |
| #include <functional> |
| #include <memory> |
| #include <vector> |
| |
| #include "flutter/fml/macros.h" |
| #include "flutter/impeller/core/texture.h" |
| #include "impeller/core/shader_types.h" |
| #include "impeller/geometry/color.h" |
| #include "impeller/geometry/gradient.h" |
| #include "impeller/geometry/path.h" |
| #include "impeller/geometry/point.h" |
| |
| namespace impeller { |
| |
| class Context; |
| |
| /** |
| * @brief Create a host visible texture that contains the gradient defined |
| * by the provided gradient data. |
| */ |
| std::shared_ptr<Texture> CreateGradientTexture( |
| const GradientData& gradient_data, |
| const std::shared_ptr<impeller::Context>& context); |
| |
| struct StopData { |
| Color color; |
| Scalar stop; |
| Padding<12> _padding_; |
| }; |
| |
| /** |
| * @brief Populate a vector with the color and stop data for a gradient |
| * |
| * @param colors |
| * @param stops |
| * @return StopData |
| */ |
| std::vector<StopData> CreateGradientColors(const std::vector<Color>& colors, |
| const std::vector<Scalar>& stops); |
| |
| } // namespace impeller |