forked from flutter-team-archive/engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinear_gradient_contents.h
More file actions
67 lines (49 loc) · 1.79 KB
/
Copy pathlinear_gradient_contents.h
File metadata and controls
67 lines (49 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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/renderer/texture.h"
#include "impeller/entity/contents/color_source_contents.h"
#include "impeller/entity/entity.h"
#include "impeller/geometry/color.h"
#include "impeller/geometry/gradient.h"
#include "impeller/geometry/path.h"
#include "impeller/geometry/point.h"
namespace impeller {
class LinearGradientContents final : public ColorSourceContents {
public:
LinearGradientContents();
~LinearGradientContents() override;
// |Contents|
bool Render(const ContentContext& renderer,
const Entity& entity,
RenderPass& pass) const override;
void SetEndPoints(Point start_point, Point end_point);
void SetColors(std::vector<Color> colors);
void SetStops(std::vector<Scalar> stops);
const std::vector<Color>& GetColors() const;
const std::vector<Scalar>& GetStops() const;
void SetTileMode(Entity::TileMode tile_mode);
private:
bool RenderTexture(const GradientData& gradient_data,
const ContentContext& renderer,
const Entity& entity,
RenderPass& pass) const;
#ifndef FML_OS_ANDROID
bool RenderFixed(const GradientData& gradient_data,
const ContentContext& renderer,
const Entity& entity,
RenderPass& pass) const;
#endif // FML_OS_ANDROID
Point start_point_;
Point end_point_;
std::vector<Color> colors_;
std::vector<Scalar> stops_;
Entity::TileMode tile_mode_;
FML_DISALLOW_COPY_AND_ASSIGN(LinearGradientContents);
};
} // namespace impeller