Flutter Engine
The Flutter Engine
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
27/// @brief Like SkRRect.isSimple, but allows the corners to differ by
28/// kEhCloseEnough.
29///
30/// An RRect is simple if all corner radii are approximately
31/// equal.
32bool IsNearlySimpleRRect(const SkRRect& rr);
33
34Rect ToRect(const SkRect& rect);
35
36std::optional<Rect> ToRect(const SkRect* rect);
37
38std::vector<Rect> ToRects(const SkRect tex[], int count);
39
40std::vector<Point> ToPoints(const SkPoint points[], int count);
41
42Point ToPoint(const SkPoint& point);
43
44Size ToSize(const SkPoint& point);
45
47
48std::vector<Matrix> ToRSXForms(const SkRSXform xform[], int count);
49
50PathBuilder::RoundingRadii ToRoundingRadii(const SkRRect& rrect);
51
52Path ToPath(const SkPath& path, Point shift = Point(0, 0));
53
54Path ToPath(const SkRRect& rrect);
55
57 Point shift = Point(0, 0));
58
59std::optional<impeller::PixelFormat> ToPixelFormat(SkColorType type);
60
61/// @brief Convert display list colors + stops into impeller colors and stops,
62/// taking care to ensure that the stops monotonically increase from 0.0 to 1.0.
63///
64/// The general process is:
65/// * Ensure that the first gradient stop value is 0.0. If not, insert a new
66/// stop with a value of 0.0 and use the first gradient color as this new
67/// stops color.
68/// * Ensure the last gradient stop value is 1.0. If not, insert a new stop
69/// with a value of 1.0 and use the last gradient color as this stops color.
70/// * Clamp all gradient values between the values of 0.0 and 1.0.
71/// * For all stop values, ensure that the values are monotonically increasing
72/// by clamping each value to a minimum of the previous stop value and itself.
73/// For example, with stop values of 0.0, 0.5, 0.4, 1.0, we would clamp such
74/// that the values were 0.0, 0.5, 0.5, 1.0.
76 std::vector<Color>& colors,
77 std::vector<float>& stops);
78
79} // namespace skia_conversions
80} // namespace impeller
81
82#endif // FLUTTER_IMPELLER_DISPLAY_LIST_SKIA_CONVERSIONS_H_
int count
Definition: FontMgrTest.cpp:50
static const int points[]
SkColorType
Definition: SkColorType.h:19
GLenum type
Definition: SkPath.h:59
DlColor color
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
PODArray< SkColor > colors
Definition: SkRecords.h:276
SK_API sk_sp< SkShader > Color(SkColor)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
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)
bool IsNearlySimpleRRect(const SkRRect &rr)
Like SkRRect.isSimple, but allows the corners to differ by kEhCloseEnough.
Rect ToRect(const SkRect &rect)
Color ToColor(const flutter::DlColor &color)
TRect< Scalar > Rect
Definition: rect.h:769
TPoint< Scalar > Point
Definition: point.h:322
TSize< Scalar > Size
Definition: size.h:137