8#include "flutter/impeller/aiks/aiks_unittests.h"
10#include "flutter/display_list/dl_blend_mode.h"
11#include "flutter/display_list/dl_builder.h"
12#include "flutter/display_list/dl_color.h"
13#include "flutter/display_list/dl_paint.h"
14#include "flutter/testing/testing.h"
25 std::vector<SkPoint> vertices,
26 std::vector<uint16_t> indices,
27 std::vector<SkPoint> texture_coordinates,
28 std::vector<DlColor>
colors) {
30 {{texture_coordinates.size() > 0,
colors.size() > 0}});
35 if (texture_coordinates.size() > 0) {
36 builder.store_texture_coordinates(texture_coordinates.data());
38 if (indices.size() > 0) {
39 builder.store_indices(indices.data());
41 builder.store_vertices(vertices.data());
52 auto size =
image->impeller_texture()->GetSize();
54 paint.setColorSource(std::make_shared<DlImageColorSource>(
57 std::vector<SkPoint> vertex_coordinates = {
SkPoint::Make(0, 0),
63 builder.DrawVertices(vertices, DlBlendMode::kSrcOver,
paint);
64 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
73 auto size =
image->impeller_texture()->GetSize();
78 paint.setColorSource(std::make_shared<DlImageColorSource>(
88 builder.DrawVertices(vertices, DlBlendMode::kSrcOver,
paint);
89 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
98 auto size =
image->impeller_texture()->GetSize();
100 paint.setColorSource(std::make_shared<DlImageColorSource>(
103 std::vector<SkPoint> positions = {
108 std::vector<DlColor>
colors = {
117 builder.DrawVertices(vertices, DlBlendMode::kDstOver,
paint);
118 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
126 auto size =
image->impeller_texture()->GetSize();
128 paint.setColorSource(std::make_shared<DlImageColorSource>(
131 std::vector<SkPoint> positions = {
136 std::vector<DlColor>
colors = {
148 builder.DrawVertices(vertices, DlBlendMode::kColorBurn,
paint);
149 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
154 constexpr Scalar hexagon_radius = 125;
155 auto hex_start =
Point(200.0, -hexagon_radius + 200.0);
156 auto center_to_flat = 1.73 / 2 * hexagon_radius;
159 std::vector<SkPoint> vertices = {
161 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 0.5 * hexagon_radius),
162 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 1.5 * hexagon_radius),
163 SkPoint::Make(hex_start.x + center_to_flat, hex_start.y + 1.5 * hexagon_radius),
164 SkPoint::Make(hex_start.x, hex_start.y + 2 * hexagon_radius),
165 SkPoint::Make(hex_start.x, hex_start.y + 2 * hexagon_radius),
166 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 1.5 * hexagon_radius),
167 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 1.5 * hexagon_radius),
168 SkPoint::Make(hex_start.x - center_to_flat, hex_start.y + 0.5 * hexagon_radius)
177 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
201 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
215 const float stops[2] = {0.0, 1.0};
218 {100.0, 100.0}, {300.0, 300.0}, 2,
colors.data(), stops,
227 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
234 std::vector<SkPoint> texture_coordinates = {
SkPoint::Make(300, 100),
240 texture_coordinates.data(),
nullptr);
244 const float stops[2] = {0.0, 1.0};
247 {100.0, 100.0}, {300.0, 300.0}, 2,
colors.data(), stops,
256 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
260 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
265 std::vector<SkPoint> texture_coordinates = {
270 texture_coordinates.data(),
nullptr);
278 paint.setColorSource(&image_source);
281 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
285 DrawVerticesImageSourceWithTextureCoordinatesAndColorBlending) {
286 auto texture = CreateTextureForFixture(
"embarcadero.jpg");
294 std::vector<SkPoint> texture_coordinates = {
299 texture_coordinates.data(),
colors.data());
307 paint.setColorSource(&image_source);
310 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
314 std::vector<SkPoint> positions = {
317 std::vector<uint16_t> indices = {0, 1, 2, 0, 2, 3};
321 nullptr,
nullptr, indices.size(),
330 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
334 std::vector<SkPoint> positions = {
338 std::vector<uint16_t> indices = {0, 1, 2, 0, 2, 3};
343 nullptr,
colors.data(), indices.size(),
354 ASSERT_TRUE(OpenPlaygroundHere(
builder.Build()));
static std::shared_ptr< DlLinearGradientColorSource > MakeLinear(const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
A utility class to build up a |DlVertices| object one set of data at a time.
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const SkPoint vertices[], const SkPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
FlutterSemanticsFlag flags
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkImage > image
PODArray< SkColor > colors
DlVertexMode
Defines the way in which the vertices of a DlVertices object are separated into triangles into which ...
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
@ kSrcOver
r = s + (1-sa)*d
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const flutter::DlVertices *vertices)
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
constexpr DlColor modulateOpacity(float opacity) const
static constexpr DlColor kWhite()
static constexpr DlColor kBlue()
constexpr DlColor withAlpha(uint8_t alpha) const
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
static constexpr DlColor kDarkGrey()
flags to indicate/promise which of the optional texture coordinates or colors will be supplied during...
static sk_sp< SkShader > linear(sk_sp< SkShader > shader)