5 #ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
11 #include <string_view>
23 #ifndef IMPELLER_HPP_NAMESPACE
24 #define IMPELLER_HPP_NAMESPACE impeller::hpp
30 "C++ bindings must be for the same version as the C API.");
38 const char*
name =
nullptr;
42 template <
class... Args>
44 return function(std::forward<Args>(args)...);
48 #define IMPELLER_HPP_EACH_PROC(PROC) \
49 PROC(ImpellerColorFilterCreateBlendNew) \
50 PROC(ImpellerColorFilterCreateColorMatrixNew) \
51 PROC(ImpellerColorFilterRelease) \
52 PROC(ImpellerColorFilterRetain) \
53 PROC(ImpellerColorSourceCreateConicalGradientNew) \
54 PROC(ImpellerColorSourceCreateFragmentProgramNew) \
55 PROC(ImpellerColorSourceCreateImageNew) \
56 PROC(ImpellerColorSourceCreateLinearGradientNew) \
57 PROC(ImpellerColorSourceCreateRadialGradientNew) \
58 PROC(ImpellerColorSourceCreateSweepGradientNew) \
59 PROC(ImpellerColorSourceRelease) \
60 PROC(ImpellerColorSourceRetain) \
61 PROC(ImpellerContextCreateMetalNew) \
62 PROC(ImpellerContextCreateOpenGLESNew) \
63 PROC(ImpellerContextCreateVulkanNew) \
64 PROC(ImpellerContextGetVulkanInfo) \
65 PROC(ImpellerContextRelease) \
66 PROC(ImpellerContextRetain) \
67 PROC(ImpellerDisplayListBuilderClipOval) \
68 PROC(ImpellerDisplayListBuilderClipPath) \
69 PROC(ImpellerDisplayListBuilderClipRect) \
70 PROC(ImpellerDisplayListBuilderClipRoundedRect) \
71 PROC(ImpellerDisplayListBuilderCreateDisplayListNew) \
72 PROC(ImpellerDisplayListBuilderDrawDashedLine) \
73 PROC(ImpellerDisplayListBuilderDrawDisplayList) \
74 PROC(ImpellerDisplayListBuilderDrawLine) \
75 PROC(ImpellerDisplayListBuilderDrawOval) \
76 PROC(ImpellerDisplayListBuilderDrawPaint) \
77 PROC(ImpellerDisplayListBuilderDrawParagraph) \
78 PROC(ImpellerDisplayListBuilderDrawPath) \
79 PROC(ImpellerDisplayListBuilderDrawRect) \
80 PROC(ImpellerDisplayListBuilderDrawRoundedRect) \
81 PROC(ImpellerDisplayListBuilderDrawRoundedRectDifference) \
82 PROC(ImpellerDisplayListBuilderDrawShadow) \
83 PROC(ImpellerDisplayListBuilderDrawTexture) \
84 PROC(ImpellerDisplayListBuilderDrawTextureRect) \
85 PROC(ImpellerDisplayListBuilderGetSaveCount) \
86 PROC(ImpellerDisplayListBuilderGetTransform) \
87 PROC(ImpellerDisplayListBuilderNew) \
88 PROC(ImpellerDisplayListBuilderRelease) \
89 PROC(ImpellerDisplayListBuilderResetTransform) \
90 PROC(ImpellerDisplayListBuilderRestore) \
91 PROC(ImpellerDisplayListBuilderRestoreToCount) \
92 PROC(ImpellerDisplayListBuilderRetain) \
93 PROC(ImpellerDisplayListBuilderRotate) \
94 PROC(ImpellerDisplayListBuilderSave) \
95 PROC(ImpellerDisplayListBuilderSaveLayer) \
96 PROC(ImpellerDisplayListBuilderScale) \
97 PROC(ImpellerDisplayListBuilderSetTransform) \
98 PROC(ImpellerDisplayListBuilderTransform) \
99 PROC(ImpellerDisplayListBuilderTranslate) \
100 PROC(ImpellerDisplayListRelease) \
101 PROC(ImpellerDisplayListRetain) \
102 PROC(ImpellerFragmentProgramNew) \
103 PROC(ImpellerFragmentProgramRelease) \
104 PROC(ImpellerFragmentProgramRetain) \
105 PROC(ImpellerGetVersion) \
106 PROC(ImpellerGlyphInfoGetGraphemeClusterBounds) \
107 PROC(ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin) \
108 PROC(ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd) \
109 PROC(ImpellerGlyphInfoGetTextDirection) \
110 PROC(ImpellerGlyphInfoIsEllipsis) \
111 PROC(ImpellerGlyphInfoRelease) \
112 PROC(ImpellerGlyphInfoRetain) \
113 PROC(ImpellerImageFilterCreateBlurNew) \
114 PROC(ImpellerImageFilterCreateComposeNew) \
115 PROC(ImpellerImageFilterCreateDilateNew) \
116 PROC(ImpellerImageFilterCreateErodeNew) \
117 PROC(ImpellerImageFilterCreateFragmentProgramNew) \
118 PROC(ImpellerImageFilterCreateMatrixNew) \
119 PROC(ImpellerImageFilterRelease) \
120 PROC(ImpellerImageFilterRetain) \
121 PROC(ImpellerLineMetricsGetAscent) \
122 PROC(ImpellerLineMetricsGetBaseline) \
123 PROC(ImpellerLineMetricsGetCodeUnitEndIndex) \
124 PROC(ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace) \
125 PROC(ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline) \
126 PROC(ImpellerLineMetricsGetCodeUnitStartIndex) \
127 PROC(ImpellerLineMetricsGetDescent) \
128 PROC(ImpellerLineMetricsGetHeight) \
129 PROC(ImpellerLineMetricsGetLeft) \
130 PROC(ImpellerLineMetricsGetUnscaledAscent) \
131 PROC(ImpellerLineMetricsGetWidth) \
132 PROC(ImpellerLineMetricsIsHardbreak) \
133 PROC(ImpellerLineMetricsRelease) \
134 PROC(ImpellerLineMetricsRetain) \
135 PROC(ImpellerMaskFilterCreateBlurNew) \
136 PROC(ImpellerMaskFilterRelease) \
137 PROC(ImpellerMaskFilterRetain) \
138 PROC(ImpellerPaintNew) \
139 PROC(ImpellerPaintRelease) \
140 PROC(ImpellerPaintRetain) \
141 PROC(ImpellerPaintSetBlendMode) \
142 PROC(ImpellerPaintSetColor) \
143 PROC(ImpellerPaintSetColorFilter) \
144 PROC(ImpellerPaintSetColorSource) \
145 PROC(ImpellerPaintSetDrawStyle) \
146 PROC(ImpellerPaintSetImageFilter) \
147 PROC(ImpellerPaintSetMaskFilter) \
148 PROC(ImpellerPaintSetStrokeCap) \
149 PROC(ImpellerPaintSetStrokeJoin) \
150 PROC(ImpellerPaintSetStrokeMiter) \
151 PROC(ImpellerPaintSetStrokeWidth) \
152 PROC(ImpellerParagraphBuilderAddText) \
153 PROC(ImpellerParagraphBuilderBuildParagraphNew) \
154 PROC(ImpellerParagraphBuilderNew) \
155 PROC(ImpellerParagraphBuilderPopStyle) \
156 PROC(ImpellerParagraphBuilderPushStyle) \
157 PROC(ImpellerParagraphBuilderRelease) \
158 PROC(ImpellerParagraphBuilderRetain) \
159 PROC(ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew) \
160 PROC(ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew) \
161 PROC(ImpellerParagraphGetAlphabeticBaseline) \
162 PROC(ImpellerParagraphGetHeight) \
163 PROC(ImpellerParagraphGetIdeographicBaseline) \
164 PROC(ImpellerParagraphGetLineCount) \
165 PROC(ImpellerParagraphGetLineMetrics) \
166 PROC(ImpellerParagraphGetLongestLineWidth) \
167 PROC(ImpellerParagraphGetMaxIntrinsicWidth) \
168 PROC(ImpellerParagraphGetMaxWidth) \
169 PROC(ImpellerParagraphGetMinIntrinsicWidth) \
170 PROC(ImpellerParagraphGetWordBoundary) \
171 PROC(ImpellerParagraphRelease) \
172 PROC(ImpellerParagraphRetain) \
173 PROC(ImpellerParagraphStyleNew) \
174 PROC(ImpellerParagraphStyleRelease) \
175 PROC(ImpellerParagraphStyleRetain) \
176 PROC(ImpellerParagraphStyleSetBackground) \
177 PROC(ImpellerParagraphStyleSetEllipsis) \
178 PROC(ImpellerParagraphStyleSetFontFamily) \
179 PROC(ImpellerParagraphStyleSetFontSize) \
180 PROC(ImpellerParagraphStyleSetFontStyle) \
181 PROC(ImpellerParagraphStyleSetFontWeight) \
182 PROC(ImpellerParagraphStyleSetForeground) \
183 PROC(ImpellerParagraphStyleSetHeight) \
184 PROC(ImpellerParagraphStyleSetLocale) \
185 PROC(ImpellerParagraphStyleSetMaxLines) \
186 PROC(ImpellerParagraphStyleSetTextAlignment) \
187 PROC(ImpellerParagraphStyleSetTextDirection) \
188 PROC(ImpellerParagraphStyleSetTextDecoration) \
189 PROC(ImpellerPathBuilderAddArc) \
190 PROC(ImpellerPathBuilderAddOval) \
191 PROC(ImpellerPathBuilderAddRect) \
192 PROC(ImpellerPathBuilderAddRoundedRect) \
193 PROC(ImpellerPathBuilderClose) \
194 PROC(ImpellerPathBuilderCopyPathNew) \
195 PROC(ImpellerPathBuilderCubicCurveTo) \
196 PROC(ImpellerPathBuilderLineTo) \
197 PROC(ImpellerPathBuilderMoveTo) \
198 PROC(ImpellerPathBuilderNew) \
199 PROC(ImpellerPathBuilderQuadraticCurveTo) \
200 PROC(ImpellerPathBuilderRelease) \
201 PROC(ImpellerPathBuilderRetain) \
202 PROC(ImpellerPathBuilderTakePathNew) \
203 PROC(ImpellerPathGetBounds) \
204 PROC(ImpellerPathRelease) \
205 PROC(ImpellerPathRetain) \
206 PROC(ImpellerSurfaceCreateWrappedFBONew) \
207 PROC(ImpellerSurfaceCreateWrappedMetalDrawableNew) \
208 PROC(ImpellerSurfaceDrawDisplayList) \
209 PROC(ImpellerSurfacePresent) \
210 PROC(ImpellerSurfaceRelease) \
211 PROC(ImpellerSurfaceRetain) \
212 PROC(ImpellerTextureCreateWithContentsNew) \
213 PROC(ImpellerTextureCreateWithOpenGLTextureHandleNew) \
214 PROC(ImpellerTextureGetOpenGLHandle) \
215 PROC(ImpellerTextureRelease) \
216 PROC(ImpellerTextureRetain) \
217 PROC(ImpellerTypographyContextNew) \
218 PROC(ImpellerTypographyContextRegisterFont) \
219 PROC(ImpellerTypographyContextRelease) \
220 PROC(ImpellerTypographyContextRetain) \
221 PROC(ImpellerVulkanSwapchainAcquireNextSurfaceNew) \
222 PROC(ImpellerVulkanSwapchainCreateNew) \
223 PROC(ImpellerVulkanSwapchainRelease) \
224 PROC(ImpellerVulkanSwapchainRetain)
228 const std::function<
void*(
const char* function_name)>& resolver) {
229 #define IMPELLER_HPP_PROC(proc) \
232 reinterpret_cast<decltype(proc.function)>(resolver(proc.name)); \
233 if (proc.function == nullptr) { \
238 #undef IMPELLER_HPP_PROC
242 #define IMPELLER_HPP_PROC(name) Proc<decltype(name)> name = {#name};
244 #undef IMPELLER_HPP_PROC
253 template <
class T,
class Traits>
258 explicit Object(T
object) { Reset(
object); }
269 std::swap(object_, other.object_);
278 T
Get()
const {
return object_; }
280 explicit operator bool()
const {
return object_ !=
nullptr; }
285 void Reset(T other =
nullptr) {
286 if (object_ == other) {
290 Traits::Release(object_);
294 Traits::Retain(other);
299 [[nodiscard]] T Leak() {
306 #define IMPELLER_HPP_DEFINE_TRAITS(object) \
307 struct object##Traits { \
308 static void Retain(object ctx) { \
309 gGlobalProcTable.object##Retain(ctx); \
311 static void Release(object ctx) { \
312 gGlobalProcTable.object##Release(ctx); \
337 #undef IMPELLER_HPP_DEFINE_TRAITS
343 std::function<
void()> release_callback)
346 release_callback_(
std::move(release_callback)) {}
349 if (release_callback_) {
359 const uint8_t* mapping_ =
nullptr;
361 std::function<void()> release_callback_;
375 const std::function<
void*(
const char*)>& gl_proc_address_resolver) {
377 std::function<
void*(
const char*)> resolver;
380 user_data.resolver = gl_proc_address_resolver;
382 void* user_data) ->
void* {
383 return reinterpret_cast<UserData*
>(user_data)->resolver(proc_name);
413 std::unique_ptr<Mapping> mapping =
nullptr) {
414 if (mapping ==
nullptr) {
415 mapping = std::make_unique<Mapping>(
nullptr, 0u,
nullptr);
418 c_mapping.
data = mapping->GetMapping();
419 c_mapping.
length = mapping->GetSize();
420 c_mapping.
on_release = [](
void* user_data) ->
void {
421 delete reinterpret_cast<Mapping*
>(user_data);
456 :
public Object<ImpellerColorFilter, ImpellerColorFilterTraits> {
483 :
public Object<ImpellerFragmentProgram, ImpellerFragmentProgramTraits> {
490 c_mapping.
data =
data->GetMapping();
493 delete reinterpret_cast<Mapping*
>(user_data);
505 :
public Object<ImpellerColorSource, ImpellerColorSourceTraits> {
547 horizontal_tile_mode,
635 const std::vector<ImpellerTexture>& samplers,
641 const_cast<ImpellerTexture*
>(samplers.data()),
643 uniform_data !=
nullptr ? uniform_data->
GetMapping() :
nullptr,
644 uniform_data !=
nullptr ? uniform_data->
GetSize() : 0u
654 :
public Object<ImpellerImageFilter, ImpellerImageFilterTraits> {
665 x_sigma, y_sigma, tile_mode),
675 outer.
Get(), inner.
Get()),
713 const std::vector<ImpellerTexture>& samplers,
719 const_cast<ImpellerTexture*
>(samplers.data()),
721 uniform_data !=
nullptr ? uniform_data->
GetMapping() :
nullptr,
722 uniform_data !=
nullptr ? uniform_data->
GetSize() : 0u
757 .ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(
Get());
764 return gGlobalProcTable.ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(
796 :
public Object<ImpellerLineMetrics, ImpellerLineMetricsTraits> {
877 .ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(
Get(), line);
885 .ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(
Get(), line);
968 Get(), code_unit_index),
1097 :
public Object<ImpellerParagraphStyle, ImpellerParagraphStyleTraits> {
1213 ImpellerTypographyContextTraits> {
1223 const char* optional_family_name_alias =
nullptr) {
1228 c_mapping.
data = mapping->GetMapping();
1229 c_mapping.
length = mapping->GetSize();
1231 delete reinterpret_cast<Mapping*
>(user_data);
1237 optional_family_name_alias
1246 :
public Object<ImpellerParagraphBuilder, ImpellerParagraphBuilderTraits> {
1291 return AddText(
reinterpret_cast<const uint8_t*
>(
string.
data()),
1299 return AddText(
reinterpret_cast<const uint8_t*
>(
string.
data()),
1322 :
public Object<ImpellerPathBuilder, ImpellerPathBuilderTraits> {
1349 float start_angle_degrees,
1350 float end_angle_degrees) {
1353 start_angle_degrees,
1400 Get(), &control_point_1, &control_point_2, &end_point);
1435 :
public Object<ImpellerDisplayList, ImpellerDisplayListTraits> {
1438 :
Object(display_list, tag) {}
1470 void* metal_drawable) {
1473 context.
Get(), metal_drawable),
1482 display_list.
Get());
1497 :
public Object<ImpellerVulkanSwapchain, ImpellerVulkanSwapchainTraits> {
1500 :
Object(swapchain, tag) {}
1506 void* vulkan_surface_khr) {
1508 context.
Get(), vulkan_surface_khr),
1526 ImpellerDisplayListBuilderTraits> {
1597 const Paint& paint) {
1611 float opacity = 1.0f) {
1613 Get(), display_list.
Get(), opacity);
1622 const Paint& paint) {
1635 const Paint& paint) {
1657 Get(), paragraph.
Get(), &point);
1667 bool occluder_is_transparent,
1668 float device_pixel_ratio) {
1670 Get(), path.
Get(), &shadow_color, elevation, occluder_is_transparent,
1671 device_pixel_ratio);
1698 const Paint& paint) {
1714 const Paint& paint) {
1731 const Paint& paint) {
1733 Get(), texture.
Get(), &point, sampling, paint.
Get());
1744 const Paint& paint) {
1816 const Paint* paint =
nullptr,
1821 paint ? paint->Get() : NULL,
1822 backdrop ? backdrop->Get() : NULL
static ColorFilter Blend(const ImpellerColor &color, ImpellerBlendMode mode)
static ColorFilter Matrix(const ImpellerColorMatrix &color_matrix)
ColorFilter(ImpellerColorFilter filter, AdoptTag tag)
ColorSource(ImpellerColorSource source, AdoptTag tag)
static ColorSource ConicalGradient(const ImpellerPoint &start_center, float start_radius, const ImpellerPoint &end_center, float end_radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource Image(const Texture &image, ImpellerTileMode horizontal_tile_mode, ImpellerTileMode vertical_tile_mode, ImpellerTextureSampling sampling, const ImpellerMatrix *transformation=nullptr)
static ColorSource SweepGradient(const ImpellerPoint ¢er, float start, float end, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource FragmentProgram(const Context &context, const FragmentProgram &program, const std::vector< ImpellerTexture > &samplers, const Mapping *uniform_data)
static ColorSource LinearGradient(const ImpellerPoint &start_point, const ImpellerPoint &end_point, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource RadialGradient(const ImpellerPoint ¢er, float radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static Context OpenGLES(const std::function< void *(const char *)> &gl_proc_address_resolver)
Context(ImpellerContext context, AdoptTag tag)
bool GetVulkanInfo(ImpellerContextVulkanInfo &info) const
DisplayListBuilder & Transform(const ImpellerMatrix &transform)
DisplayListBuilder & DrawRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, const Paint &paint)
DisplayListBuilder & Restore()
DisplayListBuilder & DrawLine(const ImpellerPoint &from, const ImpellerPoint &to, const Paint &paint)
DisplayListBuilder & Scale(float x_scale, float y_scale)
DisplayListBuilder & DrawRoundedRectDifference(const ImpellerRect &outer_rect, const ImpellerRoundingRadii &outer_radii, const ImpellerRect &inner_rect, const ImpellerRoundingRadii &inner_radii, const Paint &paint)
DisplayListBuilder & Rotate(float angle_degrees)
DisplayListBuilder & ClipRect(const ImpellerRect &rect, ImpellerClipOperation op)
DisplayListBuilder & DrawRect(const ImpellerRect &rect, const Paint &paint)
DisplayListBuilder & ResetTransform()
DisplayListBuilder & DrawTextureRect(const Texture &texture, const ImpellerRect &src_rect, const ImpellerRect &dst_rect, ImpellerTextureSampling sampling, const Paint &paint)
DisplayListBuilder & DrawParagraph(const Paragraph ¶graph, const ImpellerPoint &point)
DisplayListBuilder & DrawPaint(const Paint &paint)
DisplayListBuilder & DrawDashedLine(const ImpellerPoint &from, const ImpellerPoint &to, float on_length, float off_length, const Paint &paint)
DisplayListBuilder & DrawPath(const Path &path, const Paint &paint)
DisplayListBuilder & ClipRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, ImpellerClipOperation op)
DisplayListBuilder & SaveLayer(const ImpellerRect &bounds, const Paint *paint=nullptr, const ImageFilter *backdrop=nullptr)
ImpellerMatrix GetTransform()
DisplayListBuilder & SetTransform(const ImpellerMatrix &transform)
DisplayListBuilder(const ImpellerRect *cull_rect=nullptr)
DisplayListBuilder & RestoreToCount(uint32_t count)
DisplayListBuilder & DrawOval(const ImpellerRect &oval_bounds, const Paint &paint)
DisplayListBuilder & Save()
DisplayListBuilder & DrawShadow(const Path &path, const ImpellerColor &shadow_color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
DisplayListBuilder & Translate(float x_translation, float y_translation)
DisplayListBuilder & DrawTexture(const Texture &texture, const ImpellerPoint &point, ImpellerTextureSampling sampling, const Paint &paint)
DisplayListBuilder & DrawDisplayList(const DisplayList &display_list, float opacity=1.0f)
DisplayListBuilder & ClipPath(const Path &path, ImpellerClipOperation op)
DisplayListBuilder & ClipOval(const ImpellerRect &oval_bounds, ImpellerClipOperation op)
DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
FragmentProgram(ImpellerFragmentProgram program, AdoptTag tag)
static FragmentProgram WithData(std::unique_ptr< Mapping > data)
size_t GetGraphemeClusterCodeUnitRangeEnd() const
GlyphInfo(ImpellerGlyphInfo info, AdoptTag tag)
size_t GetGraphemeClusterCodeUnitRangeBegin() const
ImpellerTextDirection GetTextDirection() const
ImpellerRect GetGraphemeClusterBounds() const
static ImageFilter Compose(const ImageFilter &outer, const ImageFilter &inner)
static ImageFilter Dilate(float x_radius, float y_radius)
static ImageFilter Matrix(const ImpellerMatrix &matrix, ImpellerTextureSampling sampling)
static ImageFilter Blur(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
static ImageFilter FragmentProgram(const Context &context, const FragmentProgram &program, const std::vector< ImpellerTexture > &samplers, const Mapping *uniform_data)
static ImageFilter Erode(float x_radius, float y_radius)
ImageFilter(ImpellerImageFilter filter, AdoptTag tag)
bool IsHardbreak(size_t line) const
size_t GetCodeUnitEndIndex(size_t line) const
size_t GetCodeUnitStartIndex(size_t line) const
double GetHeight(size_t line) const
double GetDescent(size_t line) const
size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const
double GetUnscaledAscent(size_t line) const
double GetWidth(size_t line) const
size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const
double GetBaseline(size_t line) const
double GetLeft(size_t line) const
double GetAscent(size_t line) const
LineMetrics(ImpellerLineMetrics metrics, AdoptTag tag)
const uint8_t * GetMapping() const
Mapping(const uint8_t *mapping, size_t size, std::function< void()> release_callback)
static MaskFilter Blur(ImpellerBlurStyle style, float sigma)
MaskFilter(ImpellerMaskFilter filter, AdoptTag tag)
Object & operator=(const Object &other)
Object & operator=(Object &&other)
Object(T object, AdoptTag)
Object(const Object &other)
Paint & SetDrawStyle(ImpellerDrawStyle style)
Paint & SetColor(const ImpellerColor &color)
Paint & SetBlendMode(ImpellerBlendMode mode)
Paint & SetMaskFilter(const MaskFilter &filter)
Paint & SetStrokeJoin(ImpellerStrokeJoin join)
Paint & SetStrokeWidth(float width)
Paint & SetStrokeCap(ImpellerStrokeCap cap)
Paint & SetColorFilter(const ColorFilter &filter)
Paint & SetColorSource(const ColorSource &source)
Paint & SetImageFilter(const ImageFilter &filter)
Paint & SetStrokeMiter(float miter)
Paragraph Build(float width)
ParagraphBuilder & PushStyle(const ParagraphStyle &style)
ParagraphBuilder & PopStyle()
ParagraphBuilder(const TypographyContext &context)
ParagraphBuilder & AddText(const std::string &string)
ParagraphBuilder & AddText(const std::string_view &string)
ParagraphBuilder & AddText(const uint8_t *utf8_data, uint32_t length)
float GetMaxIntrinsicWidth()
LineMetrics GetLineMetrics() const
GlyphInfo GlyphInfoAtParagraphCoordinates(double x, double y)
GlyphInfo GlyphInfoAtCodeUnitIndex(size_t code_unit_index)
float GetAlphabeticBaseline()
ImpellerRange GetWordBoundary(size_t code_unit_index)
float GetIdeographicBaseline()
Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
float GetLongestLineWidth()
float GetMinIntrinsicWidth()
ParagraphStyle & SetTextAlignment(ImpellerTextAlignment align)
ParagraphStyle & SetTextDirection(ImpellerTextDirection direction)
ParagraphStyle & SetEllipsis(const char *ellipsis)
ParagraphStyle & SetTextDecoration(const ImpellerTextDecoration &decoration)
ParagraphStyle & SetFontSize(float size)
ParagraphStyle & SetForeground(const Paint &paint)
ParagraphStyle & SetLocale(const char *locale)
ParagraphStyle & SetBackground(const Paint &paint)
ParagraphStyle & SetFontStyle(ImpellerFontStyle style)
ParagraphStyle & SetFontFamily(const char *family_name)
ParagraphStyle & SetFontWeight(ImpellerFontWeight weight)
ParagraphStyle & SetMaxLines(uint32_t max_lines)
ParagraphStyle & SetHeight(float height)
PathBuilder & QuadraticCurveTo(const ImpellerPoint &control_point, const ImpellerPoint &end_point)
PathBuilder & AddRect(const ImpellerRect &rect)
PathBuilder & CubicCurveTo(const ImpellerPoint &control_point_1, const ImpellerPoint &control_point_2, const ImpellerPoint &end_point)
Path BuildCopy(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero) const
PathBuilder & AddArc(const ImpellerRect &oval_bounds, float start_angle_degrees, float end_angle_degrees)
Path Build(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero)
PathBuilder & MoveTo(const ImpellerPoint &location)
PathBuilder & LineTo(const ImpellerPoint &location)
PathBuilder & AddOval(const ImpellerRect &oval_bounds)
PathBuilder & AddRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &rounding_radii)
ImpellerRect GetBounds() const
Path(ImpellerPath path, AdoptTag tag)
static Surface WrapFBO(const Context &context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize &size)
Surface(ImpellerSurface surface, AdoptTag tag)
Surface(ImpellerSurface surface)
bool Draw(const DisplayList &display_list) const
static Surface WrapMetalDrawable(const Context &context, void *metal_drawable)
Texture(ImpellerTexture texture, AdoptTag adopt)
static Texture WithContents(const Context &context, const ImpellerTextureDescriptor &descriptor, std::unique_ptr< Mapping > mapping=nullptr)
static Texture WithOpenGLTexture(const Context &context, const ImpellerTextureDescriptor &descriptor, uint64_t handle)
uint64_t GetOpenGLHandle() const
bool RegisterFont(std::unique_ptr< Mapping > mapping, const char *optional_family_name_alias=nullptr)
VulkanSwapchain(ImpellerVulkanSwapchain swapchain, AdoptTag tag)
static VulkanSwapchain Create(const Context &context, void *vulkan_surface_khr)
Surface AcquireNextSurface() const
@ kImpellerFillTypeNonZero
#define IMPELLER_MAKE_VERSION(variant, major, minor, patch)
Pack a version in a uint32_t.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE ImpellerPathBuilderNew()
Create a new path builder. Paths themselves are immutable. A builder builds these immutable paths.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE ImpellerPaintNew()
Create a new paint with default values.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew(ImpellerParagraph IMPELLER_NONNULL paragraph, double x, double y)
Create a new instance of glyph info that can be queried for information about the glyph closest to th...
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE ImpellerParagraphStyleNew()
Create a new paragraph style.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE ImpellerTypographyContextNew()
Create a new typography contents.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE ImpellerDisplayListBuilderNew(const ImpellerRect *IMPELLER_NULLABLE cull_rect)
Create a new display list builder.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context)
Create a new paragraph builder.
#define IMPELLER_HPP_PROC(proc)
#define IMPELLER_HPP_EACH_PROC(PROC)
ProcTable gGlobalProcTable
IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter)
auto operator()(Args &&... args) const
bool Initialize(const std::function< void *(const char *function_name)> &resolver)
ImpellerCallback IMPELLER_NULLABLE on_release
const uint8_t *IMPELLER_NONNULL data
std::shared_ptr< const fml::Mapping > data