| Flutter Impeller |

snapshot.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 "impeller/core/formats.h"
13 #include "impeller/core/sampler_descriptor.h"
14 #include "impeller/core/texture.h"
15 #include "impeller/geometry/matrix.h"
16 #include "impeller/geometry/rect.h"
17
18 namespace impeller {
19
20 class ContentContext;
21 class Entity;
22
23 /// Represents a texture and its intended draw transform/sampler configuration.
24 struct Snapshot {
25 std::shared_ptr<Texture> texture;
26 /// The transform that should be applied to this texture for rendering.
27 Matrix transform;
28
29 SamplerDescriptor sampler_descriptor =
30 SamplerDescriptor("Default Snapshot Sampler",
31 MinMagFilter::kLinear,
32 MinMagFilter::kLinear,
33 MipFilter::kNearest);
34
35 Scalar opacity = 1.0f;
36
37 std::optional<Rect> GetCoverage() const;
38
39 /// @brief Get the transform that converts screen space coordinates to the UV
40 /// space of this snapshot.
41 std::optional<Matrix> GetUVTransform() const;
42
43 /// @brief Map a coverage rect to this filter input's UV space.
44 /// Result order: Top left, top right, bottom left, bottom right.
45 std::optional<std::array<Point, 4>> GetCoverageUVs(
46 const Rect& coverage) const;
47 };
48
49 } // namespace impeller
impeller::Scalar
float Scalar
Definition: scalar.h:15
formats.h
impeller::Snapshot::sampler_descriptor
SamplerDescriptor sampler_descriptor
Definition: snapshot.h:29
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:18
matrix.h
impeller::MipFilter::kNearest
@ kNearest
Sample from the nearest mip level.
impeller::Snapshot::GetCoverage
std::optional< Rect > GetCoverage() const
Definition: snapshot.cc:11
impeller::Snapshot::transform
Matrix transform
The transform that should be applied to this texture for rendering.
Definition: snapshot.h:27
impeller::MinMagFilter::kLinear
@ kLinear
impeller::Snapshot
Represents a texture and its intended draw transform/sampler configuration.
Definition: snapshot.h:24
impeller::Snapshot::GetUVTransform
std::optional< Matrix > GetUVTransform() const
Get the transform that converts screen space coordinates to the UV space of this snapshot.
Definition: snapshot.cc:18
sampler_descriptor.h
rect.h
texture.h
impeller::Snapshot::texture
std::shared_ptr< Texture > texture
Definition: snapshot.h:25
impeller::Snapshot::GetCoverageUVs
std::optional< std::array< Point, 4 > > GetCoverageUVs(const Rect &coverage) const
Map a coverage rect to this filter input's UV space. Result order: Top left, top right,...
Definition: snapshot.cc:26
impeller
Definition: aiks_context.cc:10
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:36
impeller::Snapshot::opacity
Scalar opacity
Definition: snapshot.h:35