Flutter Engine
The Flutter Engine
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 <memory>
9#include <vector>
10
11#include "flutter/impeller/core/texture.h"
15
16namespace impeller {
17
18class Context;
19
20/**
21 * @brief Create a host visible texture that contains the gradient defined
22 * by the provided gradient data.
23 */
24std::shared_ptr<Texture> CreateGradientTexture(
25 const GradientData& gradient_data,
26 const std::shared_ptr<impeller::Context>& context);
27
28struct StopData {
33};
34
35static_assert(sizeof(StopData) == 32);
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 */
44std::vector<StopData> CreateGradientColors(const std::vector<Color>& colors,
45 const std::vector<Scalar>& stops);
46
47} // namespace impeller
48
49#endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_GRADIENT_GENERATOR_H_
PODArray< SkColor > colors
Definition: SkRecords.h:276
float Scalar
Definition: scalar.h:18
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.
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.