Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
skia_conversions.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_DISPLAY_LIST_SKIA_CONVERSIONS_H_
6#define FLUTTER_IMPELLER_DISPLAY_LIST_SKIA_CONVERSIONS_H_
7
23
24namespace impeller {
25namespace skia_conversions {
26
27Rect ToRect(const SkRect& rect);
28
29std::optional<Rect> ToRect(const SkRect* rect);
30
31std::vector<Rect> ToRects(const SkRect tex[], int count);
32
33std::vector<Point> ToPoints(const SkPoint points[], int count);
34
35Point ToPoint(const SkPoint& point);
36
37Size ToSize(const SkPoint& point);
38
39Color ToColor(const flutter::DlColor& color);
40
41std::vector<Matrix> ToRSXForms(const SkRSXform xform[], int count);
42
43PathBuilder::RoundingRadii ToRoundingRadii(const SkRRect& rrect);
44
45Path ToPath(const SkPath& path, Point shift = Point(0, 0));
46
47Path ToPath(const SkRRect& rrect);
48
50 Point shift = Point(0, 0));
51
52std::optional<impeller::PixelFormat> ToPixelFormat(SkColorType type);
53
54/// @brief Convert display list colors + stops into impeller colors and stops,
55/// taking care to ensure that the stops monotonically increase from 0.0 to 1.0.
56///
57/// The general process is:
58/// * Ensure that the first gradient stop value is 0.0. If not, insert a new
59/// stop with a value of 0.0 and use the first gradient color as this new
60/// stops color.
61/// * Ensure the last gradient stop value is 1.0. If not, insert a new stop
62/// with a value of 1.0 and use the last gradient color as this stops color.
63/// * Clamp all gradient values between the values of 0.0 and 1.0.
64/// * For all stop values, ensure that the values are monotonically increasing
65/// by clamping each value to a minimum of the previous stop value and itself.
66/// For example, with stop values of 0.0, 0.5, 0.4, 1.0, we would clamp such
67/// that the values were 0.0, 0.5, 0.5, 1.0.
69 std::vector<Color>& colors,
70 std::vector<float>& stops);
71
72} // namespace skia_conversions
73} // namespace impeller
74
75#endif // FLUTTER_IMPELLER_DISPLAY_LIST_SKIA_CONVERSIONS_H_
int count
static const int points[]
SkColor4f color
SkColorType
Definition SkColorType.h:19
CanvasPath Path
Definition dart_ui.cc:58
std::optional< impeller::PixelFormat > ToPixelFormat(SkColorType type)
Path PathDataFromTextBlob(const sk_sp< SkTextBlob > &blob, Point shift)
std::vector< Point > ToPoints(const SkPoint points[], int count)
Path ToPath(const SkPath &path, Point shift)
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Point ToPoint(const SkPoint &point)
Size ToSize(const SkPoint &point)
std::vector< Rect > ToRects(const SkRect tex[], int count)
PathBuilder::RoundingRadii ToRoundingRadii(const SkRRect &rrect)
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Rect ToRect(const SkRect &rect)
Color ToColor(const flutter::DlColor &color)
TRect< Scalar > Rect
Definition rect.h:746
TPoint< Scalar > Point
Definition point.h:316
TSize< Scalar > Size
Definition size.h:137