5#ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_FORMATS_H_
6#define FLUTTER_IMPELLER_TOOLKIT_INTEROP_FORMATS_H_
24#include "flutter/third_party/skia/include/core/SkM44.h"
25#include "flutter/third_party/skia/include/core/SkPath.h"
26#include "flutter/third_party/skia/include/core/SkRRect.h"
34 return SkRect::MakeXYWH(rect->
x, rect->
y, rect->
width, rect->
height);
38 return SkPoint::Make(point.
x, point.
y);
42 return SkColorSetARGB(color.
alpha * 255,
54 return SkRect::MakeXYWH(rect.
GetX(),
64 return SkPathFillType::kWinding;
66 return SkPathFillType::kEvenOdd;
68 return SkPathFillType::kWinding;
72 return SkIRect::MakeXYWH(rect.
GetX(),
79template <
class SkiaType,
class OtherType>
80std::vector<SkiaType>
ToSkiaType(
const std::vector<OtherType>& other_vec) {
81 std::vector<SkiaType> skia_vec;
82 skia_vec.reserve(other_vec.size());
83 for (
const auto& other : other_vec) {
98 return SkM44::ColMajor(matrix.
m).asM33();
101template <
class DlType,
class OtherType>
103 std::vector<DlType> dl_vec;
104 dl_vec.reserve(other_vec.size());
105 for (
const auto& other : other_vec) {
146 return Mode::kSrcOver;
148 return Mode::kDstOver;
154 return Mode::kSrcOut;
156 return Mode::kDstOut;
158 return Mode::kSrcATop;
160 return Mode::kDstATop;
166 return Mode::kModulate;
168 return Mode::kScreen;
170 return Mode::kOverlay;
172 return Mode::kDarken;
174 return Mode::kLighten;
176 return Mode::kColorDodge;
178 return Mode::kColorBurn;
180 return Mode::kHardLight;
182 return Mode::kSoftLight;
184 return Mode::kDifference;
186 return Mode::kExclusion;
188 return Mode::kMultiply;
192 return Mode::kSaturation;
196 return Mode::kLuminosity;
198 return Mode::kSrcOver;
202 using Corner = SkRRect::Corner;
203 SkVector sk_radii[4];
209 result.setRectRadii(
ToSkiaType(rect), sk_radii);
215 m.
m[4], m.
m[5], m.
m[6], m.
m[7],
216 m.
m[8], m.
m[9], m.
m[10], m.
m[11],
217 m.
m[12], m.
m[13], m.
m[14], m.
m[15]
232 to.
m[10] = from.
m[10];
233 to.
m[11] = from.
m[11];
234 to.
m[12] = from.
m[12];
235 to.
m[13] = from.
m[13];
236 to.
m[14] = from.
m[14];
237 to.
m[15] = from.
m[15];
241 return Size{size.width, size.height};
245 return Point{point.
x, point.
y};
249 return Size{point.
x, point.
y};
422 switch (color_space) {
uint32_t uint32_t * format
@ kImpellerFillTypeNonZero
@ kImpellerTextDirectionLTR
@ kImpellerTextDirectionRTL
@ kImpellerTextureSamplingNearestNeighbor
@ kImpellerTextureSamplingLinear
ImpellerTextDecorationStyle
@ kImpellerTextDecorationStyleSolid
@ kImpellerTextDecorationStyleWavy
@ kImpellerTextDecorationStyleDouble
@ kImpellerTextDecorationStyleDotted
@ kImpellerTextDecorationStyleDashed
@ kImpellerStrokeJoinRound
@ kImpellerStrokeJoinBevel
@ kImpellerStrokeJoinMiter
@ kImpellerBlendModeSaturation
@ kImpellerBlendModeSoftLight
@ kImpellerBlendModeHardLight
@ kImpellerBlendModeLuminosity
@ kImpellerBlendModeLighten
@ kImpellerBlendModeModulate
@ kImpellerBlendModeSourceIn
@ kImpellerBlendModeDifference
@ kImpellerBlendModeClear
@ kImpellerBlendModeColor
@ kImpellerBlendModeMultiply
@ kImpellerBlendModeSourceATop
@ kImpellerBlendModeDestinationOut
@ kImpellerBlendModeScreen
@ kImpellerBlendModeExclusion
@ kImpellerBlendModeColorBurn
@ kImpellerBlendModeDarken
@ kImpellerBlendModeOverlay
@ kImpellerBlendModeDestinationIn
@ kImpellerBlendModeDestinationATop
@ kImpellerBlendModeDestination
@ kImpellerBlendModeSourceOver
@ kImpellerBlendModeColorDodge
@ kImpellerBlendModeDestinationOver
@ kImpellerBlendModeSource
@ kImpellerBlendModeSourceOut
@ kImpellerStrokeCapRound
@ kImpellerStrokeCapSquare
@ kImpellerDrawStyleStroke
@ kImpellerDrawStyleStrokeAndFill
@ kImpellerColorSpaceExtendedSRGB
@ kImpellerColorSpaceSRGB
@ kImpellerColorSpaceDisplayP3
@ kImpellerTileModeMirror
@ kImpellerTileModeRepeat
@ kImpellerTextAlignmentJustify
@ kImpellerTextAlignmentLeft
@ kImpellerTextAlignmentCenter
@ kImpellerTextAlignmentRight
@ kImpellerTextAlignmentStart
@ kImpellerTextAlignmentEnd
@ kImpellerFontStyleItalic
@ kImpellerFontStyleNormal
@ kImpellerClipOperationIntersect
@ kImpellerClipOperationDifference
@ kImpellerBlurStyleNormal
@ kImpellerBlurStyleOuter
@ kImpellerBlurStyleInner
@ kImpellerBlurStyleSolid
@ kImpellerPixelFormatRGBA8888
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
@ kButt
no stroke extension
@ kStrokeAndFill
both strokes and fills shapes
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes
@ kNormal
fuzzy inside and outside
@ kOuter
nothing inside, fuzzy outside
@ kInner
fuzzy inside, nothing outside
@ kSolid
solid inside, fuzzy outside
impeller::BlendMode DlBlendMode
constexpr SkVector ToSkiaVector(const Size &point)
constexpr txt::TextDecorationStyle ToTxtType(ImpellerTextDecorationStyle style)
SkMatrix ToSkMatrix(const Matrix &matrix)
constexpr Matrix ToImpellerType(const ImpellerMatrix &m)
constexpr Size ToImpellerSize(const ImpellerPoint &point)
constexpr std::optional< SkRect > ToSkiaType(const ImpellerRect *rect)
constexpr void FromImpellerType(const Matrix &from, ImpellerMatrix &to)
constexpr flutter::DlColor ToDisplayListType(Color color)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
ImpellerColorSpace color_space
ImpellerPoint bottom_left
ImpellerPoint bottom_right
static constexpr DlColor RGBA(DlScalar r, DlScalar g, DlScalar b, DlScalar a)
Construct a 32 bit color from floating point R, G, B, and A color channels.
A 4x4 matrix using column-major storage.
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
static constexpr TSize MakeWH(Type width, Type height)