Flutter Impeller
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_IMPELLER_GEOMETRY_GRADIENT_H_
6 #define FLUTTER_IMPELLER_GEOMETRY_GRADIENT_H_
7 
8 #include <cstdint>
9 #include <vector>
10 
12 
13 namespace impeller {
14 
15 // If texture_size is 0 then the gradient is invalid.
16 struct GradientData {
17  std::vector<uint8_t> color_bytes;
18  uint32_t texture_size;
19 };
20 
21 /**
22  * @brief Populate a vector with the interpolated color bytes for the linear
23  * gradient described by colors and stops.
24  *
25  * @param colors
26  * @param stops
27  * @return GradientData
28  */
29 GradientData CreateGradientBuffer(const std::vector<Color>& colors,
30  const std::vector<Scalar>& stops);
31 
32 } // namespace impeller
33 
34 #endif // FLUTTER_IMPELLER_GEOMETRY_GRADIENT_H_
GradientData CreateGradientBuffer(const std::vector< Color > &colors, const std::vector< Scalar > &stops)
Populate a vector with the interpolated color bytes for the linear gradient described by colors and s...
Definition: gradient.cc:20
uint32_t texture_size
Definition: gradient.h:18
std::vector< uint8_t > color_bytes
Definition: gradient.h:17