| Flutter Impeller |

impeller.hpp
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_TOOLKIT_INTEROP_IMPELLER_HPP_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
7
8 #include <functional>
9 #include <memory>
10 #include <string>
11 #include <string_view>
12 #include <utility>
13 #include <vector>
14
15 #include "impeller.h"
16
17 //------------------------------------------------------------------------------
18 /// A C++ 17 wrapper to the C Impeller API. This is a convenience wrapper for
19 /// the C++ API and only depends on standard libc++ utilities in addition to
20 /// impeller.h
21 ///
22
23 #ifndef IMPELLER_HPP_NAMESPACE
24 #define IMPELLER_HPP_NAMESPACE impeller::hpp
25 #endif // IMPELLER_HPP_NAMESPACE
26
27 // Tripping this assertion means that the C++ wrapper needs to be updated to
28 // account for impeller.h changes as necessary.
29 static_assert(IMPELLER_VERSION == IMPELLER_MAKE_VERSION(1, 1, 4, 0),
30 "C++ bindings must be for the same version as the C API.");
31
32 namespace IMPELLER_HPP_NAMESPACE {
33
34 template <class T>
35 struct Proc {
36 using FunctionType = T;
37
38 const char* name = nullptr;
39
40 FunctionType* function = nullptr;
41
42 template <class... Args>
43 auto operator()(Args&&... args) const {
44 return function(std::forward<Args>(args)...);
45 }
46 };
47
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)
225
226 struct ProcTable {
227 bool Initialize(
228 const std::function<void*(const char* function_name)>& resolver) {
229 #define IMPELLER_HPP_PROC(proc) \
230 { \
231 proc.function = \
232 reinterpret_cast<decltype(proc.function)>(resolver(proc.name)); \
233 if (proc.function == nullptr) { \
234 return false; \
235 } \
236 }
237 IMPELLER_HPP_EACH_PROC(IMPELLER_HPP_PROC)
238 #undef IMPELLER_HPP_PROC
239 return true;
240 }
241
242 #define IMPELLER_HPP_PROC(name) Proc<decltype(name)> name = {#name};
243 IMPELLER_HPP_EACH_PROC(IMPELLER_HPP_PROC)
244 #undef IMPELLER_HPP_PROC
245 };
246
247 extern ProcTable gGlobalProcTable;
248
249 enum class AdoptTag {
250 kAdopt,
251 };
252
253 template <class T, class Traits>
254 class Object {
255 public:
256 Object() = default;
257
258 explicit Object(T object) { Reset(object); }
259
260 Object(T object, AdoptTag) : object_(object) {}
261
262 ~Object() { Reset(); }
263
264 Object(Object&& other) { std::swap(object_, other.object_); }
265
266 Object(const Object& other) { Reset(other.Get()); }
267
268 Object& operator=(Object&& other) {
269 std::swap(object_, other.object_);
270 return *this;
271 }
272
273 Object& operator=(const Object& other) {
274 Reset(other.Get());
275 return *this;
276 }
277
278 T Get() const { return object_; }
279
280 explicit operator bool() const { return object_ != nullptr; }
281
282 private:
283 T object_ = nullptr;
284
285 void Reset(T other = nullptr) {
286 if (object_ == other) {
287 return;
288 }
289 if (object_) {
290 Traits::Release(object_);
291 object_ = nullptr;
292 }
293 if (other) {
294 Traits::Retain(other);
295 object_ = other;
296 }
297 }
298
299 [[nodiscard]] T Leak() {
300 T result = object_;
301 object_ = nullptr;
302 return result;
303 }
304 };
305
306 #define IMPELLER_HPP_DEFINE_TRAITS(object) \
307 struct object##Traits { \
308 static void Retain(object ctx) { \
309 gGlobalProcTable.object##Retain(ctx); \
310 } \
311 static void Release(object ctx) { \
312 gGlobalProcTable.object##Release(ctx); \
313 } \
314 };
315
316 IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter);
317 IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorSource);
318 IMPELLER_HPP_DEFINE_TRAITS(ImpellerContext);
319 IMPELLER_HPP_DEFINE_TRAITS(ImpellerDisplayList);
320 IMPELLER_HPP_DEFINE_TRAITS(ImpellerDisplayListBuilder);
321 IMPELLER_HPP_DEFINE_TRAITS(ImpellerFragmentProgram);
322 IMPELLER_HPP_DEFINE_TRAITS(ImpellerGlyphInfo);
323 IMPELLER_HPP_DEFINE_TRAITS(ImpellerImageFilter);
324 IMPELLER_HPP_DEFINE_TRAITS(ImpellerLineMetrics);
325 IMPELLER_HPP_DEFINE_TRAITS(ImpellerMaskFilter);
326 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPaint);
327 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraph);
328 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraphBuilder);
329 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraphStyle);
330 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPath);
331 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPathBuilder);
332 IMPELLER_HPP_DEFINE_TRAITS(ImpellerSurface);
333 IMPELLER_HPP_DEFINE_TRAITS(ImpellerTexture);
334 IMPELLER_HPP_DEFINE_TRAITS(ImpellerTypographyContext);
335 IMPELLER_HPP_DEFINE_TRAITS(ImpellerVulkanSwapchain);
336
337 #undef IMPELLER_HPP_DEFINE_TRAITS
338
339 class Mapping {
340 public:
341 Mapping(const uint8_t* mapping,
342 size_t size,
343 std::function<void()> release_callback)
344 : mapping_(mapping),
345 size_(size),
346 release_callback_(std::move(release_callback)) {}
347
348 ~Mapping() {
349 if (release_callback_) {
350 release_callback_();
351 }
352 }
353
354 const uint8_t* GetMapping() const { return mapping_; }
355
356 size_t GetSize() const { return size_; }
357
358 private:
359 const uint8_t* mapping_ = nullptr;
360 size_t size_ = 0u;
361 std::function<void()> release_callback_;
362 };
363
364 //------------------------------------------------------------------------------
365 /// @see ImpellerContext
366 ///
367 class Context : public Object<ImpellerContext, ImpellerContextTraits> {
368 public:
369 Context(ImpellerContext context, AdoptTag tag) : Object(context, tag) {}
370
371 //----------------------------------------------------------------------------
372 /// @see ImpellerContextCreateOpenGLESNew
373 ///
374 static Context OpenGLES(
375 const std::function<void*(const char*)>& gl_proc_address_resolver) {
376 struct UserData {
377 std::function<void*(const char*)> resolver;
378 };
379 UserData user_data;
380 user_data.resolver = gl_proc_address_resolver;
381 ImpellerProcAddressCallback callback = [](const char* proc_name,
382 void* user_data) -> void* {
383 return reinterpret_cast<UserData*>(user_data)->resolver(proc_name);
384 };
385 return Context(
386 gGlobalProcTable.ImpellerContextCreateOpenGLESNew(IMPELLER_VERSION, //
387 callback, //
388 &user_data //
389 ),
390 AdoptTag::kAdopt);
391 }
392
393 //----------------------------------------------------------------------------
394 /// @see ImpellerContextGetVulkanInfo
395 ///
396 bool GetVulkanInfo(ImpellerContextVulkanInfo& info) const {
397 return gGlobalProcTable.ImpellerContextGetVulkanInfo(Get(), &info);
398 }
399 };
400
401 //------------------------------------------------------------------------------
402 /// @see ImpellerTexture
403 ///
404 class Texture : public Object<ImpellerTexture, ImpellerTextureTraits> {
405 public:
406 Texture(ImpellerTexture texture, AdoptTag adopt) : Object(texture, adopt) {}
407
408 //----------------------------------------------------------------------------
409 /// @see ImpellerTextureCreateWithContentsNew
410 ///
411 static Texture WithContents(const Context& context,
412 const ImpellerTextureDescriptor& descriptor,
413 std::unique_ptr<Mapping> mapping = nullptr) {
414 if (mapping == nullptr) {
415 mapping = std::make_unique<Mapping>(nullptr, 0u, nullptr);
416 }
417 ImpellerMapping c_mapping = {};
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);
422 };
423 return Texture(gGlobalProcTable.ImpellerTextureCreateWithContentsNew(
424 context.Get(), //
425 &descriptor, //
426 &c_mapping, //
427 mapping.release() //
428 ),
429 AdoptTag::kAdopt);
430 }
431
432 //----------------------------------------------------------------------------
433 /// @see ImpellerTextureCreateWithOpenGLTextureHandleNew
434 ///
435 static Texture WithOpenGLTexture(const Context& context,
436 const ImpellerTextureDescriptor& descriptor,
437 uint64_t handle) {
438 return Texture(
439 gGlobalProcTable.ImpellerTextureCreateWithOpenGLTextureHandleNew(
440 context.Get(), //
441 &descriptor, //
442 handle //
443 ),
444 AdoptTag::kAdopt);
445 }
446
447 uint64_t GetOpenGLHandle() const {
448 return gGlobalProcTable.ImpellerTextureGetOpenGLHandle(Get());
449 }
450 };
451
452 //------------------------------------------------------------------------------
453 /// @see ImpellerColorFilter
454 ///
455 class ColorFilter
456 : public Object<ImpellerColorFilter, ImpellerColorFilterTraits> {
457 public:
458 ColorFilter(ImpellerColorFilter filter, AdoptTag tag) : Object(filter, tag) {}
459
460 //----------------------------------------------------------------------------
461 /// @see ImpellerColorFilterCreateBlendNew
462 ///
463 static ColorFilter Blend(const ImpellerColor& color, ImpellerBlendMode mode) {
464 return ColorFilter(
465 gGlobalProcTable.ImpellerColorFilterCreateBlendNew(&color, mode),
466 AdoptTag::kAdopt);
467 }
468
469 //----------------------------------------------------------------------------
470 /// @see ImpellerColorFilterCreateColorMatrixNew
471 ///
472 static ColorFilter Matrix(const ImpellerColorMatrix& color_matrix) {
473 return ColorFilter(
474 gGlobalProcTable.ImpellerColorFilterCreateColorMatrixNew(&color_matrix),
475 AdoptTag::kAdopt);
476 }
477 };
478
479 //------------------------------------------------------------------------------
480 /// @see ImpellerFragmentProgram
481 ///
482 class FragmentProgram
483 : public Object<ImpellerFragmentProgram, ImpellerFragmentProgramTraits> {
484 public:
485 FragmentProgram(ImpellerFragmentProgram program, AdoptTag tag)
486 : Object(program, tag) {}
487
488 static FragmentProgram WithData(std::unique_ptr<Mapping> data) {
489 ImpellerMapping c_mapping = {};
490 c_mapping.data = data->GetMapping();
491 c_mapping.length = data->GetSize();
492 c_mapping.on_release = [](void* user_data) {
493 delete reinterpret_cast<Mapping*>(user_data);
494 };
495 return FragmentProgram(
496 gGlobalProcTable.ImpellerFragmentProgramNew(&c_mapping, data.release()),
497 AdoptTag::kAdopt);
498 }
499 };
500
501 //------------------------------------------------------------------------------
502 /// @see ImpellerColorSource
503 ///
504 class ColorSource
505 : public Object<ImpellerColorSource, ImpellerColorSourceTraits> {
506 public:
507 ColorSource(ImpellerColorSource source, AdoptTag tag) : Object(source, tag) {}
508
509 //----------------------------------------------------------------------------
510 /// @see ImpellerColorSourceCreateConicalGradientNew
511 ///
512 static ColorSource ConicalGradient(
513 const ImpellerPoint& start_center,
514 float start_radius,
515 const ImpellerPoint& end_center,
516 float end_radius,
517 uint32_t stop_count,
518 const ImpellerColor* colors,
519 const float* stops,
520 ImpellerTileMode tile_mode,
521 const ImpellerMatrix* transformation = nullptr) {
522 return ColorSource(
523 gGlobalProcTable.ImpellerColorSourceCreateConicalGradientNew(
524 &start_center, //
525 start_radius, //
526 &end_center, //
527 end_radius, //
528 stop_count, //
529 colors, //
530 stops, //
531 tile_mode, //
532 transformation //
533 ),
534 AdoptTag::kAdopt);
535 }
536
537 //----------------------------------------------------------------------------
538 /// @see ImpellerColorSourceCreateImageNew
539 ///
540 static ColorSource Image(const Texture& image,
541 ImpellerTileMode horizontal_tile_mode,
542 ImpellerTileMode vertical_tile_mode,
543 ImpellerTextureSampling sampling,
544 const ImpellerMatrix* transformation = nullptr) {
545 return ColorSource(gGlobalProcTable.ImpellerColorSourceCreateImageNew(
546 image.Get(), //
547 horizontal_tile_mode, //
548 vertical_tile_mode, //
549 sampling, //
550 transformation //
551 ),
552 AdoptTag::kAdopt);
553 }
554
555 //----------------------------------------------------------------------------
556 /// @see ImpellerColorSourceCreateLinearGradientNew
557 ///
558 static ColorSource LinearGradient(
559 const ImpellerPoint& start_point,
560 const ImpellerPoint& end_point,
561 uint32_t stop_count,
562 const ImpellerColor* colors,
563 const float* stops,
564 ImpellerTileMode tile_mode,
565 const ImpellerMatrix* transformation = nullptr) {
566 return ColorSource(
567 gGlobalProcTable.ImpellerColorSourceCreateLinearGradientNew(
568 &start_point,
569 &end_point, //
570 stop_count, //
571 colors, //
572 stops, //
573 tile_mode, //
574 transformation //
575 ),
576 AdoptTag::kAdopt);
577 }
578
579 //----------------------------------------------------------------------------
580 /// @see ImpellerColorSourceCreateRadialGradientNew
581 ///
582 static ColorSource RadialGradient(
583 const ImpellerPoint& center,
584 float radius,
585 uint32_t stop_count,
586 const ImpellerColor* colors,
587 const float* stops,
588 ImpellerTileMode tile_mode,
589 const ImpellerMatrix* transformation = nullptr) {
590 return ColorSource(
591 gGlobalProcTable.ImpellerColorSourceCreateRadialGradientNew(
592 &center, //
593 radius, //
594 stop_count, //
595 colors, //
596 stops, //
597 tile_mode, //
598 transformation //
599 ),
600 AdoptTag::kAdopt);
601 }
602
603 //----------------------------------------------------------------------------
604 /// @see ImpellerColorSourceCreateSweepGradientNew
605 ///
606 static ColorSource SweepGradient(
607 const ImpellerPoint& center,
608 float start,
609 float end,
610 uint32_t stop_count,
611 const ImpellerColor* colors,
612 const float* stops,
613 ImpellerTileMode tile_mode,
614 const ImpellerMatrix* transformation = nullptr) {
615 return ColorSource(
616 gGlobalProcTable.ImpellerColorSourceCreateSweepGradientNew(
617 &center, //
618 start, //
619 end, //
620 stop_count, //
621 colors, //
622 stops, //
623 tile_mode, //
624 transformation //
625 ),
626 AdoptTag::kAdopt);
627 }
628
629 //----------------------------------------------------------------------------
630 /// @see ImpellerColorSourceCreateFragmentProgramNew
631 ///
632 static ColorSource FragmentProgram(
633 const Context& context,
634 const FragmentProgram& program,
635 const std::vector<ImpellerTexture>& samplers,
636 const Mapping* uniform_data) {
637 return ColorSource(
638 gGlobalProcTable.ImpellerColorSourceCreateFragmentProgramNew(
639 context.Get(), //
640 program.Get(), //
641 const_cast<ImpellerTexture*>(samplers.data()), //
642 samplers.size(), //
643 uniform_data != nullptr ? uniform_data->GetMapping() : nullptr, //
644 uniform_data != nullptr ? uniform_data->GetSize() : 0u //
645 ),
646 AdoptTag::kAdopt);
647 }
648 };
649
650 //------------------------------------------------------------------------------
651 /// @see ImpellerImageFilter
652 ///
653 class ImageFilter
654 : public Object<ImpellerImageFilter, ImpellerImageFilterTraits> {
655 public:
656 ImageFilter(ImpellerImageFilter filter, AdoptTag tag) : Object(filter, tag) {}
657
658 //----------------------------------------------------------------------------
659 /// @see ImpellerImageFilterCreateBlurNew
660 ///
661 static ImageFilter Blur(float x_sigma,
662 float y_sigma,
663 ImpellerTileMode tile_mode) {
664 return ImageFilter(gGlobalProcTable.ImpellerImageFilterCreateBlurNew(
665 x_sigma, y_sigma, tile_mode),
666 AdoptTag::kAdopt);
667 }
668
669 //----------------------------------------------------------------------------
670 /// @see ImpellerImageFilterCreateComposeNew
671 ///
672 static ImageFilter Compose(const ImageFilter& outer,
673 const ImageFilter& inner) {
674 return ImageFilter(gGlobalProcTable.ImpellerImageFilterCreateComposeNew(
675 outer.Get(), inner.Get()),
676 AdoptTag::kAdopt);
677 }
678
679 //----------------------------------------------------------------------------
680 /// @see ImpellerImageFilterCreateDilateNew
681 ///
682 static ImageFilter Dilate(float x_radius, float y_radius) {
683 return ImageFilter(
684 gGlobalProcTable.ImpellerImageFilterCreateDilateNew(x_radius, y_radius),
685 AdoptTag::kAdopt);
686 }
687
688 //----------------------------------------------------------------------------
689 /// @see ImpellerImageFilterCreateErodeNew
690 ///
691 static ImageFilter Erode(float x_radius, float y_radius) {
692 return ImageFilter(
693 gGlobalProcTable.ImpellerImageFilterCreateErodeNew(x_radius, y_radius),
694 AdoptTag::kAdopt);
695 }
696
697 //----------------------------------------------------------------------------
698 /// @see ImpellerImageFilterCreateMatrixNew
699 ///
700 static ImageFilter Matrix(const ImpellerMatrix& matrix,
701 ImpellerTextureSampling sampling) {
702 return ImageFilter(
703 gGlobalProcTable.ImpellerImageFilterCreateMatrixNew(&matrix, sampling),
704 AdoptTag::kAdopt);
705 }
706
707 //----------------------------------------------------------------------------
708 /// @see ImpellerImageFilterCreateFragmentProgramNew
709 ///
710 static ImageFilter FragmentProgram(
711 const Context& context,
712 const FragmentProgram& program,
713 const std::vector<ImpellerTexture>& samplers,
714 const Mapping* uniform_data) {
715 return ImageFilter(
716 gGlobalProcTable.ImpellerImageFilterCreateFragmentProgramNew(
717 context.Get(), //
718 program.Get(), //
719 const_cast<ImpellerTexture*>(samplers.data()), //
720 samplers.size(), //
721 uniform_data != nullptr ? uniform_data->GetMapping() : nullptr, //
722 uniform_data != nullptr ? uniform_data->GetSize() : 0u //
723 ),
724 AdoptTag::kAdopt);
725 }
726 };
727
728 //------------------------------------------------------------------------------
729 /// @see ImpellerMaskFilter
730 ///
731 class MaskFilter : public Object<ImpellerMaskFilter, ImpellerMaskFilterTraits> {
732 public:
733 MaskFilter(ImpellerMaskFilter filter, AdoptTag tag) : Object(filter, tag) {}
734
735 //----------------------------------------------------------------------------
736 /// @see ImpellerMaskFilterCreateBlurNew
737 ///
738 static MaskFilter Blur(ImpellerBlurStyle style, float sigma) {
739 return MaskFilter(
740 gGlobalProcTable.ImpellerMaskFilterCreateBlurNew(style, sigma),
741 AdoptTag::kAdopt);
742 }
743 };
744
745 //------------------------------------------------------------------------------
746 /// @see ImpellerGlyphInfo
747 ///
748 class GlyphInfo : public Object<ImpellerGlyphInfo, ImpellerGlyphInfoTraits> {
749 public:
750 GlyphInfo(ImpellerGlyphInfo info, AdoptTag tag) : Object(info, tag) {}
751
752 //----------------------------------------------------------------------------
753 /// @see ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin
754 ///
755 size_t GetGraphemeClusterCodeUnitRangeBegin() const {
756 return gGlobalProcTable
757 .ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(Get());
758 }
759
760 //----------------------------------------------------------------------------
761 /// @see ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd
762 ///
763 size_t GetGraphemeClusterCodeUnitRangeEnd() const {
764 return gGlobalProcTable.ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(
765 Get());
766 }
767
768 //----------------------------------------------------------------------------
769 /// @see ImpellerGlyphInfoGetGraphemeClusterBounds
770 ///
771 ImpellerRect GetGraphemeClusterBounds() const {
772 ImpellerRect rect = {};
773 gGlobalProcTable.ImpellerGlyphInfoGetGraphemeClusterBounds(Get(), &rect);
774 return rect;
775 }
776
777 //----------------------------------------------------------------------------
778 /// @see ImpellerGlyphInfoIsEllipsis
779 ///
780 bool IsEllipsis() const {
781 return gGlobalProcTable.ImpellerGlyphInfoIsEllipsis(Get());
782 }
783
784 //----------------------------------------------------------------------------
785 /// @see ImpellerGlyphInfoGetTextDirection
786 ///
787 ImpellerTextDirection GetTextDirection() const {
788 return gGlobalProcTable.ImpellerGlyphInfoGetTextDirection(Get());
789 }
790 };
791
792 //------------------------------------------------------------------------------
793 /// @see ImpellerLineMetrics
794 ///
795 class LineMetrics
796 : public Object<ImpellerLineMetrics, ImpellerLineMetricsTraits> {
797 public:
798 LineMetrics(ImpellerLineMetrics metrics, AdoptTag tag)
799 : Object(metrics, tag) {}
800
801 //----------------------------------------------------------------------------
802 /// @see ImpellerLineMetricsGetUnscaledAscent
803 ///
804 double GetUnscaledAscent(size_t line) const {
805 return gGlobalProcTable.ImpellerLineMetricsGetUnscaledAscent(Get(), line);
806 }
807
808 //----------------------------------------------------------------------------
809 /// @see ImpellerLineMetricsGetAscent
810 ///
811 double GetAscent(size_t line) const {
812 return gGlobalProcTable.ImpellerLineMetricsGetAscent(Get(), line);
813 }
814
815 //----------------------------------------------------------------------------
816 /// @see ImpellerLineMetricsGetDescent
817 ///
818 double GetDescent(size_t line) const {
819 return gGlobalProcTable.ImpellerLineMetricsGetDescent(Get(), line);
820 }
821
822 //----------------------------------------------------------------------------
823 /// @see ImpellerLineMetricsGetBaseline
824 ///
825 double GetBaseline(size_t line) const {
826 return gGlobalProcTable.ImpellerLineMetricsGetBaseline(Get(), line);
827 }
828
829 //----------------------------------------------------------------------------
830 /// @see ImpellerLineMetricsIsHardbreak
831 ///
832 bool IsHardbreak(size_t line) const {
833 return gGlobalProcTable.ImpellerLineMetricsIsHardbreak(Get(), line);
834 }
835
836 //----------------------------------------------------------------------------
837 /// @see ImpellerLineMetricsGetWidth
838 ///
839 double GetWidth(size_t line) const {
840 return gGlobalProcTable.ImpellerLineMetricsGetWidth(Get(), line);
841 }
842
843 //----------------------------------------------------------------------------
844 /// @see ImpellerLineMetricsGetHeight
845 ///
846 double GetHeight(size_t line) const {
847 return gGlobalProcTable.ImpellerLineMetricsGetHeight(Get(), line);
848 }
849
850 //----------------------------------------------------------------------------
851 /// @see ImpellerLineMetricsGetLeft
852 ///
853 double GetLeft(size_t line) const {
854 return gGlobalProcTable.ImpellerLineMetricsGetLeft(Get(), line);
855 }
856
857 //----------------------------------------------------------------------------
858 /// @see ImpellerLineMetricsGetCodeUnitStartIndex
859 ///
860 size_t GetCodeUnitStartIndex(size_t line) const {
861 return gGlobalProcTable.ImpellerLineMetricsGetCodeUnitStartIndex(Get(),
862 line);
863 }
864
865 //----------------------------------------------------------------------------
866 /// @see ImpellerLineMetricsGetCodeUnitEndIndex
867 ///
868 size_t GetCodeUnitEndIndex(size_t line) const {
869 return gGlobalProcTable.ImpellerLineMetricsGetCodeUnitEndIndex(Get(), line);
870 }
871
872 //----------------------------------------------------------------------------
873 /// @see ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace
874 ///
875 size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const {
876 return gGlobalProcTable
877 .ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(Get(), line);
878 }
879
880 //----------------------------------------------------------------------------
881 /// @see ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline
882 ///
883 size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const {
884 return gGlobalProcTable
885 .ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(Get(), line);
886 }
887 };
888
889 //------------------------------------------------------------------------------
890 /// @see ImpellerParagraph
891 ///
892 class Paragraph : public Object<ImpellerParagraph, ImpellerParagraphTraits> {
893 public:
894 Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
895 : Object(paragraph, AdoptTag::kAdopt) {}
896
897 //----------------------------------------------------------------------------
898 /// @see ImpellerParagraphGetAlphabeticBaseline
899 ///
900 float GetAlphabeticBaseline() {
901 return gGlobalProcTable.ImpellerParagraphGetAlphabeticBaseline(Get());
902 }
903
904 //----------------------------------------------------------------------------
905 /// @see ImpellerParagraphGetHeight
906 ///
907 float GetHeight() {
908 return gGlobalProcTable.ImpellerParagraphGetHeight(Get());
909 }
910
911 //----------------------------------------------------------------------------
912 /// @see ImpellerParagraphGetIdeographicBaseline
913 ///
914 float GetIdeographicBaseline() {
915 return gGlobalProcTable.ImpellerParagraphGetIdeographicBaseline(Get());
916 }
917
918 //----------------------------------------------------------------------------
919 /// @see ImpellerParagraphGetLineCount
920 ///
921 uint32_t GetLineCount() {
922 return gGlobalProcTable.ImpellerParagraphGetLineCount(Get());
923 }
924
925 //----------------------------------------------------------------------------
926 /// @see ImpellerParagraphGetLongestLineWidth
927 ///
928 float GetLongestLineWidth() {
929 return gGlobalProcTable.ImpellerParagraphGetLongestLineWidth(Get());
930 }
931
932 //----------------------------------------------------------------------------
933 /// @see ImpellerParagraphGetMaxIntrinsicWidth
934 ///
935 float GetMaxIntrinsicWidth() {
936 return gGlobalProcTable.ImpellerParagraphGetMaxIntrinsicWidth(Get());
937 }
938
939 //----------------------------------------------------------------------------
940 /// @see ImpellerParagraphGetMaxWidth
941 ///
942 float GetMaxWidth() {
943 return gGlobalProcTable.ImpellerParagraphGetMaxWidth(Get());
944 }
945
946 //----------------------------------------------------------------------------
947 /// @see ImpellerParagraphGetMinIntrinsicWidth
948 ///
949 float GetMinIntrinsicWidth() {
950 return gGlobalProcTable.ImpellerParagraphGetMinIntrinsicWidth(Get());
951 }
952
953 //----------------------------------------------------------------------------
954 /// @see ImpellerParagraphGetLineMetrics
955 ///
956 LineMetrics GetLineMetrics() const {
957 auto metrics = gGlobalProcTable.ImpellerParagraphGetLineMetrics(Get());
958 gGlobalProcTable.ImpellerLineMetricsRetain(metrics);
959 return LineMetrics(metrics, AdoptTag::kAdopt);
960 }
961
962 //----------------------------------------------------------------------------
963 /// @see ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew
964 ///
965 GlyphInfo GlyphInfoAtCodeUnitIndex(size_t code_unit_index) {
966 return GlyphInfo(
967 gGlobalProcTable.ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew(
968 Get(), code_unit_index),
969 AdoptTag::kAdopt);
970 }
971
972 //----------------------------------------------------------------------------
973 /// @see ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew
974 ///
975 GlyphInfo GlyphInfoAtParagraphCoordinates(double x, double y) {
976 return GlyphInfo(
977 gGlobalProcTable
978 .ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew(
979 Get(), //
980 x, //
981 y //
982 ),
983 AdoptTag::kAdopt);
984 }
985
986 //----------------------------------------------------------------------------
987 /// @see ImpellerParagraphGetWordBoundary
988 ///
989 ImpellerRange GetWordBoundary(size_t code_unit_index) {
990 ImpellerRange range = {};
991 gGlobalProcTable.ImpellerParagraphGetWordBoundary(Get(), code_unit_index,
992 &range);
993 return range;
994 }
995 };
996
997 //------------------------------------------------------------------------------
998 /// @see ImpellerPaint
999 ///
1000 class Paint : public Object<ImpellerPaint, ImpellerPaintTraits> {
1001 public:
1002 Paint() : Object(gGlobalProcTable.ImpellerPaintNew(), AdoptTag::kAdopt) {}
1003
1004 //----------------------------------------------------------------------------
1005 /// @see ImpellerPaintSetColor
1006 ///
1007 Paint& SetColor(const ImpellerColor& color) {
1008 gGlobalProcTable.ImpellerPaintSetColor(Get(), &color);
1009 return *this;
1010 }
1011
1012 //----------------------------------------------------------------------------
1013 /// @see ImpellerPaintSetBlendMode
1014 ///
1015 Paint& SetBlendMode(ImpellerBlendMode mode) {
1016 gGlobalProcTable.ImpellerPaintSetBlendMode(Get(), mode);
1017 return *this;
1018 }
1019
1020 //----------------------------------------------------------------------------
1021 /// @see ImpellerPaintSetDrawStyle
1022 ///
1023 Paint& SetDrawStyle(ImpellerDrawStyle style) {
1024 gGlobalProcTable.ImpellerPaintSetDrawStyle(Get(), style);
1025 return *this;
1026 }
1027
1028 //----------------------------------------------------------------------------
1029 /// @see ImpellerPaintSetStrokeCap
1030 ///
1031 Paint& SetStrokeCap(ImpellerStrokeCap cap) {
1032 gGlobalProcTable.ImpellerPaintSetStrokeCap(Get(), cap);
1033 return *this;
1034 }
1035
1036 //----------------------------------------------------------------------------
1037 /// @see ImpellerPaintSetStrokeJoin
1038 ///
1039 Paint& SetStrokeJoin(ImpellerStrokeJoin join) {
1040 gGlobalProcTable.ImpellerPaintSetStrokeJoin(Get(), join);
1041 return *this;
1042 }
1043
1044 //----------------------------------------------------------------------------
1045 /// @see ImpellerPaintSetStrokeWidth
1046 ///
1047 Paint& SetStrokeWidth(float width) {
1048 gGlobalProcTable.ImpellerPaintSetStrokeWidth(Get(), width);
1049 return *this;
1050 }
1051
1052 //----------------------------------------------------------------------------
1053 /// @see ImpellerPaintSetStrokeMiter
1054 ///
1055 Paint& SetStrokeMiter(float miter) {
1056 gGlobalProcTable.ImpellerPaintSetStrokeMiter(Get(), miter);
1057 return *this;
1058 }
1059
1060 //----------------------------------------------------------------------------
1061 /// @see ImpellerPaintSetColorFilter
1062 ///
1063 Paint& SetColorFilter(const ColorFilter& filter) {
1064 gGlobalProcTable.ImpellerPaintSetColorFilter(Get(), filter.Get());
1065 return *this;
1066 }
1067
1068 //----------------------------------------------------------------------------
1069 /// @see ImpellerPaintSetColorSource
1070 ///
1071 Paint& SetColorSource(const ColorSource& source) {
1072 gGlobalProcTable.ImpellerPaintSetColorSource(Get(), source.Get());
1073 return *this;
1074 }
1075
1076 //----------------------------------------------------------------------------
1077 /// @see ImpellerPaintSetImageFilter
1078 ///
1079 Paint& SetImageFilter(const ImageFilter& filter) {
1080 gGlobalProcTable.ImpellerPaintSetImageFilter(Get(), filter.Get());
1081 return *this;
1082 }
1083
1084 //----------------------------------------------------------------------------
1085 /// @see ImpellerPaintSetMaskFilter
1086 ///
1087 Paint& SetMaskFilter(const MaskFilter& filter) {
1088 gGlobalProcTable.ImpellerPaintSetMaskFilter(Get(), filter.Get());
1089 return *this;
1090 }
1091 };
1092
1093 //------------------------------------------------------------------------------
1094 /// @see ImpellerParagraphStyle
1095 ///
1096 class ParagraphStyle
1097 : public Object<ImpellerParagraphStyle, ImpellerParagraphStyleTraits> {
1098 public:
1099 ParagraphStyle()
1100 : Object(gGlobalProcTable.ImpellerParagraphStyleNew(), AdoptTag::kAdopt) {
1101 }
1102
1103 //----------------------------------------------------------------------------
1104 /// @see ImpellerParagraphStyleSetBackground
1105 ///
1106 ParagraphStyle& SetBackground(const Paint& paint) {
1107 gGlobalProcTable.ImpellerParagraphStyleSetBackground(Get(), paint.Get());
1108 return *this;
1109 }
1110
1111 //----------------------------------------------------------------------------
1112 /// @see ImpellerParagraphStyleSetFontFamily
1113 ///
1114 ParagraphStyle& SetFontFamily(const char* family_name) {
1115 gGlobalProcTable.ImpellerParagraphStyleSetFontFamily(Get(), family_name);
1116 return *this;
1117 }
1118
1119 //----------------------------------------------------------------------------
1120 /// @see ImpellerParagraphStyleSetFontSize
1121 ///
1122 ParagraphStyle& SetFontSize(float size) {
1123 gGlobalProcTable.ImpellerParagraphStyleSetFontSize(Get(), size);
1124 return *this;
1125 }
1126
1127 //----------------------------------------------------------------------------
1128 /// @see ImpellerParagraphStyleSetFontStyle
1129 ///
1130 ParagraphStyle& SetFontStyle(ImpellerFontStyle style) {
1131 gGlobalProcTable.ImpellerParagraphStyleSetFontStyle(Get(), style);
1132 return *this;
1133 }
1134
1135 //----------------------------------------------------------------------------
1136 /// @see ImpellerParagraphStyleSetFontWeight
1137 ///
1138 ParagraphStyle& SetFontWeight(ImpellerFontWeight weight) {
1139 gGlobalProcTable.ImpellerParagraphStyleSetFontWeight(Get(), weight);
1140 return *this;
1141 }
1142
1143 //----------------------------------------------------------------------------
1144 /// @see ImpellerParagraphStyleSetForeground
1145 ///
1146 ParagraphStyle& SetForeground(const Paint& paint) {
1147 gGlobalProcTable.ImpellerParagraphStyleSetForeground(Get(), paint.Get());
1148 return *this;
1149 }
1150
1151 //----------------------------------------------------------------------------
1152 /// @see ImpellerParagraphStyleSetHeight
1153 ///
1154 ParagraphStyle& SetHeight(float height) {
1155 gGlobalProcTable.ImpellerParagraphStyleSetHeight(Get(), height);
1156 return *this;
1157 }
1158
1159 //----------------------------------------------------------------------------
1160 /// @see ImpellerParagraphStyleSetLocale
1161 ///
1162 ParagraphStyle& SetLocale(const char* locale) {
1163 gGlobalProcTable.ImpellerParagraphStyleSetLocale(Get(), locale);
1164 return *this;
1165 }
1166
1167 //----------------------------------------------------------------------------
1168 /// @see ImpellerParagraphStyleSetEllipsis
1169 ///
1170 ParagraphStyle& SetEllipsis(const char* ellipsis) {
1171 gGlobalProcTable.ImpellerParagraphStyleSetEllipsis(Get(), ellipsis);
1172 return *this;
1173 }
1174
1175 //----------------------------------------------------------------------------
1176 /// @see ImpellerParagraphStyleSetMaxLines
1177 ///
1178 ParagraphStyle& SetMaxLines(uint32_t max_lines) {
1179 gGlobalProcTable.ImpellerParagraphStyleSetMaxLines(Get(), max_lines);
1180 return *this;
1181 }
1182
1183 //----------------------------------------------------------------------------
1184 /// @see ImpellerParagraphStyleSetTextAlignment
1185 ///
1186 ParagraphStyle& SetTextAlignment(ImpellerTextAlignment align) {
1187 gGlobalProcTable.ImpellerParagraphStyleSetTextAlignment(Get(), align);
1188 return *this;
1189 }
1190
1191 //----------------------------------------------------------------------------
1192 /// @see ImpellerParagraphStyleSetTextDirection
1193 ///
1194 ParagraphStyle& SetTextDirection(ImpellerTextDirection direction) {
1195 gGlobalProcTable.ImpellerParagraphStyleSetTextDirection(Get(), direction);
1196 return *this;
1197 }
1198
1199 //----------------------------------------------------------------------------
1200 /// @see ImpellerParagraphStyleSetTextDecoration
1201 ///
1202 ParagraphStyle& SetTextDecoration(const ImpellerTextDecoration& decoration) {
1203 gGlobalProcTable.ImpellerParagraphStyleSetTextDecoration(Get(),
1204 &decoration);
1205 return *this;
1206 }
1207 };
1208
1209 //------------------------------------------------------------------------------
1210 /// @see ImpellerTypographyContext
1211 ///
1212 class TypographyContext : public Object<ImpellerTypographyContext,
1213 ImpellerTypographyContextTraits> {
1214 public:
1215 TypographyContext()
1216 : Object(gGlobalProcTable.ImpellerTypographyContextNew(),
1217 AdoptTag::kAdopt) {}
1218
1219 //----------------------------------------------------------------------------
1220 /// @see ImpellerTypographyContextRegisterFont
1221 ///
1222 bool RegisterFont(std::unique_ptr<Mapping> mapping,
1223 const char* optional_family_name_alias = nullptr) {
1224 if (!mapping) {
1225 return false;
1226 }
1227 ImpellerMapping c_mapping = {};
1228 c_mapping.data = mapping->GetMapping();
1229 c_mapping.length = mapping->GetSize();
1230 c_mapping.on_release = [](void* user_data) {
1231 delete reinterpret_cast<Mapping*>(user_data);
1232 };
1233 return gGlobalProcTable.ImpellerTypographyContextRegisterFont(
1234 Get(), //
1235 &c_mapping, //
1236 mapping.release(), //
1237 optional_family_name_alias //
1238 );
1239 }
1240 };
1241
1242 //------------------------------------------------------------------------------
1243 /// @see ImpellerParagraphBuilder
1244 ///
1245 class ParagraphBuilder
1246 : public Object<ImpellerParagraphBuilder, ImpellerParagraphBuilderTraits> {
1247 public:
1248 explicit ParagraphBuilder(const TypographyContext& context)
1249 : Object(gGlobalProcTable.ImpellerParagraphBuilderNew(context.Get()),
1250 AdoptTag::kAdopt) {}
1251
1252 //----------------------------------------------------------------------------
1253 /// @see ImpellerParagraphBuilderBuildParagraphNew
1254 ///
1255 Paragraph Build(float width) {
1256 return Paragraph(
1257 gGlobalProcTable.ImpellerParagraphBuilderBuildParagraphNew(Get(), //
1258 width //
1259 ),
1260 AdoptTag::kAdopt);
1261 }
1262
1263 //----------------------------------------------------------------------------
1264 /// @see ImpellerParagraphBuilderPushStyle
1265 ///
1266 ParagraphBuilder& PushStyle(const ParagraphStyle& style) {
1267 gGlobalProcTable.ImpellerParagraphBuilderPushStyle(Get(), style.Get());
1268 return *this;
1269 }
1270
1271 //----------------------------------------------------------------------------
1272 /// @see ImpellerParagraphBuilderPopStyle
1273 ///
1274 ParagraphBuilder& PopStyle() {
1275 gGlobalProcTable.ImpellerParagraphBuilderPopStyle(Get());
1276 return *this;
1277 }
1278
1279 //----------------------------------------------------------------------------
1280 /// @see ImpellerParagraphBuilderAddText
1281 ///
1282 ParagraphBuilder& AddText(const uint8_t* utf8_data, uint32_t length) {
1283 gGlobalProcTable.ImpellerParagraphBuilderAddText(Get(), utf8_data, length);
1284 return *this;
1285 }
1286
1287 //----------------------------------------------------------------------------
1288 /// @see ImpellerParagraphBuilderAddText
1289 ///
1290 ParagraphBuilder& AddText(const std::string& string) {
1291 return AddText(reinterpret_cast<const uint8_t*>(string.data()),
1292 string.size());
1293 }
1294
1295 //----------------------------------------------------------------------------
1296 /// @see ImpellerParagraphBuilderAddText
1297 ///
1298 ParagraphBuilder& AddText(const std::string_view& string) {
1299 return AddText(reinterpret_cast<const uint8_t*>(string.data()),
1300 string.size());
1301 }
1302 };
1303
1304 //------------------------------------------------------------------------------
1305 /// @see ImpellerPath
1306 ///
1307 class Path : public Object<ImpellerPath, ImpellerPathTraits> {
1308 public:
1309 Path(ImpellerPath path, AdoptTag tag) : Object(path, tag) {}
1310
1311 ImpellerRect GetBounds() const {
1312 ImpellerRect bounds = {};
1313 gGlobalProcTable.ImpellerPathGetBounds(Get(), &bounds);
1314 return bounds;
1315 }
1316 };
1317
1318 //------------------------------------------------------------------------------
1319 /// @see ImpellerPathBuilder
1320 ///
1321 class PathBuilder
1322 : public Object<ImpellerPathBuilder, ImpellerPathBuilderTraits> {
1323 public:
1324 PathBuilder()
1325 : Object(gGlobalProcTable.ImpellerPathBuilderNew(), AdoptTag::kAdopt) {}
1326
1327 //----------------------------------------------------------------------------
1328 /// @see ImpellerPathBuilderCopyPathNew
1329 ///
1330 Path BuildCopy(ImpellerFillType fill =
1331 ImpellerFillType::kImpellerFillTypeNonZero) const {
1332 return Path(gGlobalProcTable.ImpellerPathBuilderCopyPathNew(Get(), fill),
1333 AdoptTag::kAdopt);
1334 }
1335
1336 //----------------------------------------------------------------------------
1337 /// @see ImpellerPathBuilderTakePathNew
1338 ///
1339 Path Build(
1340 ImpellerFillType fill = ImpellerFillType::kImpellerFillTypeNonZero) {
1341 return Path(gGlobalProcTable.ImpellerPathBuilderTakePathNew(Get(), fill),
1342 AdoptTag::kAdopt);
1343 }
1344
1345 //----------------------------------------------------------------------------
1346 /// @see ImpellerPathBuilderAddArc
1347 ///
1348 PathBuilder& AddArc(const ImpellerRect& oval_bounds,
1349 float start_angle_degrees,
1350 float end_angle_degrees) {
1351 gGlobalProcTable.ImpellerPathBuilderAddArc(Get(), //
1352 &oval_bounds, //
1353 start_angle_degrees, //
1354 end_angle_degrees //
1355 );
1356 return *this;
1357 }
1358
1359 //----------------------------------------------------------------------------
1360 /// @see ImpellerPathBuilderAddOval
1361 ///
1362 PathBuilder& AddOval(const ImpellerRect& oval_bounds) {
1363 gGlobalProcTable.ImpellerPathBuilderAddOval(Get(), &oval_bounds);
1364 return *this;
1365 }
1366
1367 //----------------------------------------------------------------------------
1368 /// @see ImpellerPathBuilderAddRect
1369 ///
1370 PathBuilder& AddRect(const ImpellerRect& rect) {
1371 gGlobalProcTable.ImpellerPathBuilderAddRect(Get(), &rect);
1372 return *this;
1373 }
1374
1375 //----------------------------------------------------------------------------
1376 /// @see ImpellerPathBuilderAddRoundedRect
1377 ///
1378 PathBuilder& AddRoundedRect(const ImpellerRect& rect,
1379 const ImpellerRoundingRadii& rounding_radii) {
1380 gGlobalProcTable.ImpellerPathBuilderAddRoundedRect(Get(), &rect,
1381 &rounding_radii);
1382 return *this;
1383 }
1384
1385 //----------------------------------------------------------------------------
1386 /// @see ImpellerPathBuilderClose
1387 ///
1388 PathBuilder& Close() {
1389 gGlobalProcTable.ImpellerPathBuilderClose(Get());
1390 return *this;
1391 }
1392
1393 //----------------------------------------------------------------------------
1394 /// @see ImpellerPathBuilderCubicCurveTo
1395 ///
1396 PathBuilder& CubicCurveTo(const ImpellerPoint& control_point_1,
1397 const ImpellerPoint& control_point_2,
1398 const ImpellerPoint& end_point) {
1399 gGlobalProcTable.ImpellerPathBuilderCubicCurveTo(
1400 Get(), &control_point_1, &control_point_2, &end_point);
1401 return *this;
1402 }
1403
1404 //----------------------------------------------------------------------------
1405 /// @see ImpellerPathBuilderLineTo
1406 ///
1407 PathBuilder& LineTo(const ImpellerPoint& location) {
1408 gGlobalProcTable.ImpellerPathBuilderLineTo(Get(), &location);
1409 return *this;
1410 }
1411
1412 //----------------------------------------------------------------------------
1413 /// @see ImpellerPathBuilderMoveTo
1414 ///
1415 PathBuilder& MoveTo(const ImpellerPoint& location) {
1416 gGlobalProcTable.ImpellerPathBuilderMoveTo(Get(), &location);
1417 return *this;
1418 }
1419
1420 //----------------------------------------------------------------------------
1421 /// @see ImpellerPathBuilderQuadraticCurveTo
1422 ///
1423 PathBuilder& QuadraticCurveTo(const ImpellerPoint& control_point,
1424 const ImpellerPoint& end_point) {
1425 gGlobalProcTable.ImpellerPathBuilderQuadraticCurveTo(Get(), &control_point,
1426 &end_point);
1427 return *this;
1428 }
1429 };
1430
1431 //------------------------------------------------------------------------------
1432 /// @see ImpellerDisplayList
1433 ///
1434 class DisplayList
1435 : public Object<ImpellerDisplayList, ImpellerDisplayListTraits> {
1436 public:
1437 DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
1438 : Object(display_list, tag) {}
1439 };
1440
1441 //------------------------------------------------------------------------------
1442 /// @see ImpellerSurface
1443 ///
1444 class Surface : public Object<ImpellerSurface, ImpellerSurfaceTraits> {
1445 public:
1446 explicit Surface(ImpellerSurface surface) : Object(surface) {}
1447
1448 Surface(ImpellerSurface surface, AdoptTag tag) : Object(surface, tag) {}
1449
1450 //----------------------------------------------------------------------------
1451 /// @see ImpellerSurfaceCreateWrappedFBONew
1452 ///
1453 static Surface WrapFBO(const Context& context,
1454 uint64_t fbo,
1455 ImpellerPixelFormat format,
1456 const ImpellerISize& size) {
1457 return Surface(
1458 gGlobalProcTable.ImpellerSurfaceCreateWrappedFBONew(context.Get(), //
1459 fbo, //
1460 format, //
1461 &size //
1462 ),
1463 AdoptTag::kAdopt);
1464 }
1465
1466 //----------------------------------------------------------------------------
1467 /// @see ImpellerSurfaceCreateWrappedMetalDrawableNew
1468 ///
1469 static Surface WrapMetalDrawable(const Context& context,
1470 void* metal_drawable) {
1471 return Surface(
1472 gGlobalProcTable.ImpellerSurfaceCreateWrappedMetalDrawableNew(
1473 context.Get(), metal_drawable),
1474 AdoptTag::kAdopt);
1475 }
1476
1477 //----------------------------------------------------------------------------
1478 /// @see ImpellerSurfaceDrawDisplayList
1479 ///
1480 bool Draw(const DisplayList& display_list) const {
1481 return gGlobalProcTable.ImpellerSurfaceDrawDisplayList(Get(),
1482 display_list.Get());
1483 }
1484
1485 //----------------------------------------------------------------------------
1486 /// @see ImpellerSurfacePresent
1487 ///
1488 bool Present() const {
1489 return gGlobalProcTable.ImpellerSurfacePresent(Get());
1490 }
1491 };
1492
1493 //------------------------------------------------------------------------------
1494 /// @see ImpellerVulkanSwapchain
1495 ///
1496 class VulkanSwapchain
1497 : public Object<ImpellerVulkanSwapchain, ImpellerVulkanSwapchainTraits> {
1498 public:
1499 VulkanSwapchain(ImpellerVulkanSwapchain swapchain, AdoptTag tag)
1500 : Object(swapchain, tag) {}
1501
1502 //----------------------------------------------------------------------------
1503 /// @see ImpellerVulkanSwapchainCreateNew
1504 ///
1505 static VulkanSwapchain Create(const Context& context,
1506 void* vulkan_surface_khr) {
1507 return VulkanSwapchain(gGlobalProcTable.ImpellerVulkanSwapchainCreateNew(
1508 context.Get(), vulkan_surface_khr),
1509 AdoptTag::kAdopt);
1510 }
1511
1512 //----------------------------------------------------------------------------
1513 /// @see ImpellerVulkanSwapchainAcquireNextSurfaceNew
1514 ///
1515 Surface AcquireNextSurface() const {
1516 return Surface(
1517 gGlobalProcTable.ImpellerVulkanSwapchainAcquireNextSurfaceNew(Get()),
1518 AdoptTag::kAdopt);
1519 }
1520 };
1521
1522 //------------------------------------------------------------------------------
1523 /// @see ImpellerDisplayListBuilder
1524 ///
1525 class DisplayListBuilder : public Object<ImpellerDisplayListBuilder,
1526 ImpellerDisplayListBuilderTraits> {
1527 public:
1528 //----------------------------------------------------------------------------
1529 /// @see ImpellerDisplayListBuilderNew
1530 ///
1531 explicit DisplayListBuilder(const ImpellerRect* cull_rect = nullptr)
1532 : Object(gGlobalProcTable.ImpellerDisplayListBuilderNew(cull_rect),
1533 AdoptTag::kAdopt) {}
1534
1535 //----------------------------------------------------------------------------
1536 /// @see ImpellerDisplayListBuilderCreateDisplayListNew
1537 ///
1538 DisplayList Build() {
1539 return DisplayList(
1540 gGlobalProcTable.ImpellerDisplayListBuilderCreateDisplayListNew(Get()),
1541 AdoptTag::kAdopt);
1542 }
1543
1544 //----------------------------------------------------------------------------
1545 /// @see ImpellerDisplayListBuilderClipOval
1546 ///
1547 DisplayListBuilder& ClipOval(const ImpellerRect& oval_bounds,
1548 ImpellerClipOperation op) {
1549 gGlobalProcTable.ImpellerDisplayListBuilderClipOval(Get(), //
1550 &oval_bounds, //
1551 op);
1552 return *this;
1553 }
1554
1555 //----------------------------------------------------------------------------
1556 /// @see ImpellerDisplayListBuilderClipPath
1557 ///
1558 DisplayListBuilder& ClipPath(const Path& path, ImpellerClipOperation op) {
1559 gGlobalProcTable.ImpellerDisplayListBuilderClipPath(Get(), //
1560 path.Get(), //
1561 op);
1562 return *this;
1563 }
1564
1565 //----------------------------------------------------------------------------
1566 /// @see ImpellerDisplayListBuilderClipRect
1567 ///
1568 DisplayListBuilder& ClipRect(const ImpellerRect& rect,
1569 ImpellerClipOperation op) {
1570 gGlobalProcTable.ImpellerDisplayListBuilderClipRect(Get(), //
1571 &rect, //
1572 op);
1573 return *this;
1574 }
1575
1576 //----------------------------------------------------------------------------
1577 /// @see ImpellerDisplayListBuilderClipRoundedRect
1578 ///
1579 DisplayListBuilder& ClipRoundedRect(const ImpellerRect& rect,
1580 const ImpellerRoundingRadii& radii,
1581 ImpellerClipOperation op) {
1582 gGlobalProcTable.ImpellerDisplayListBuilderClipRoundedRect(Get(), //
1583 &rect, //
1584 &radii, //
1585 op //
1586 );
1587 return *this;
1588 }
1589
1590 //----------------------------------------------------------------------------
1591 /// @see ImpellerDisplayListBuilderDrawDashedLine
1592 ///
1593 DisplayListBuilder& DrawDashedLine(const ImpellerPoint& from,
1594 const ImpellerPoint& to,
1595 float on_length,
1596 float off_length,
1597 const Paint& paint) {
1598 gGlobalProcTable.ImpellerDisplayListBuilderDrawDashedLine(Get(), //
1599 &from, //
1600 &to, //
1601 on_length, //
1602 off_length, //
1603 paint.Get());
1604 return *this;
1605 }
1606
1607 //----------------------------------------------------------------------------
1608 /// @see ImpellerDisplayListBuilderDrawDisplayList
1609 ///
1610 DisplayListBuilder& DrawDisplayList(const DisplayList& display_list,
1611 float opacity = 1.0f) {
1612 gGlobalProcTable.ImpellerDisplayListBuilderDrawDisplayList(
1613 Get(), display_list.Get(), opacity);
1614 return *this;
1615 }
1616
1617 //----------------------------------------------------------------------------
1618 /// @see ImpellerDisplayListBuilderDrawLine
1619 ///
1620 DisplayListBuilder& DrawLine(const ImpellerPoint& from,
1621 const ImpellerPoint& to,
1622 const Paint& paint) {
1623 gGlobalProcTable.ImpellerDisplayListBuilderDrawLine(Get(), //
1624 &from, //
1625 &to, //
1626 paint.Get() //
1627 );
1628 return *this;
1629 }
1630
1631 //----------------------------------------------------------------------------
1632 /// @see ImpellerDisplayListBuilderDrawOval
1633 ///
1634 DisplayListBuilder& DrawOval(const ImpellerRect& oval_bounds,
1635 const Paint& paint) {
1636 gGlobalProcTable.ImpellerDisplayListBuilderDrawOval(Get(), //
1637 &oval_bounds, //
1638 paint.Get() //
1639 );
1640 return *this;
1641 }
1642
1643 //----------------------------------------------------------------------------
1644 /// @see ImpellerDisplayListBuilderDrawPaint
1645 ///
1646 DisplayListBuilder& DrawPaint(const Paint& paint) {
1647 gGlobalProcTable.ImpellerDisplayListBuilderDrawPaint(Get(), paint.Get());
1648 return *this;
1649 }
1650
1651 //----------------------------------------------------------------------------
1652 /// @see ImpellerDisplayListBuilderDrawParagraph
1653 ///
1654 DisplayListBuilder& DrawParagraph(const Paragraph& paragraph,
1655 const ImpellerPoint& point) {
1656 gGlobalProcTable.ImpellerDisplayListBuilderDrawParagraph(
1657 Get(), paragraph.Get(), &point);
1658 return *this;
1659 }
1660
1661 //----------------------------------------------------------------------------
1662 /// @see ImpellerDisplayListBuilderDrawShadow
1663 ///
1664 DisplayListBuilder& DrawShadow(const Path& path,
1665 const ImpellerColor& shadow_color,
1666 float elevation,
1667 bool occluder_is_transparent,
1668 float device_pixel_ratio) {
1669 gGlobalProcTable.ImpellerDisplayListBuilderDrawShadow(
1670 Get(), path.Get(), &shadow_color, elevation, occluder_is_transparent,
1671 device_pixel_ratio);
1672 return *this;
1673 }
1674
1675 //----------------------------------------------------------------------------
1676 /// @see ImpellerDisplayListBuilderDrawPath
1677 ///
1678 DisplayListBuilder& DrawPath(const Path& path, const Paint& paint) {
1679 gGlobalProcTable.ImpellerDisplayListBuilderDrawPath(Get(), path.Get(),
1680 paint.Get());
1681 return *this;
1682 }
1683
1684 //----------------------------------------------------------------------------
1685 /// @see ImpellerDisplayListBuilderDrawRect
1686 ///
1687 DisplayListBuilder& DrawRect(const ImpellerRect& rect, const Paint& paint) {
1688 gGlobalProcTable.ImpellerDisplayListBuilderDrawRect(Get(), &rect,
1689 paint.Get());
1690 return *this;
1691 }
1692
1693 //----------------------------------------------------------------------------
1694 /// @see ImpellerDisplayListBuilderDrawRoundedRect
1695 ///
1696 DisplayListBuilder& DrawRoundedRect(const ImpellerRect& rect,
1697 const ImpellerRoundingRadii& radii,
1698 const Paint& paint) {
1699 gGlobalProcTable.ImpellerDisplayListBuilderDrawRoundedRect(Get(), //
1700 &rect, //
1701 &radii, //
1702 paint.Get());
1703 return *this;
1704 }
1705
1706 //----------------------------------------------------------------------------
1707 /// @see ImpellerDisplayListBuilderDrawRoundedRectDifference
1708 ///
1709 DisplayListBuilder& DrawRoundedRectDifference(
1710 const ImpellerRect& outer_rect,
1711 const ImpellerRoundingRadii& outer_radii,
1712 const ImpellerRect& inner_rect,
1713 const ImpellerRoundingRadii& inner_radii,
1714 const Paint& paint) {
1715 gGlobalProcTable.ImpellerDisplayListBuilderDrawRoundedRectDifference(
1716 Get(), //
1717 &outer_rect, //
1718 &outer_radii, //
1719 &inner_rect, //
1720 &inner_radii, //
1721 paint.Get());
1722 return *this;
1723 }
1724
1725 //----------------------------------------------------------------------------
1726 /// @see ImpellerDisplayListBuilderDrawTexture
1727 ///
1728 DisplayListBuilder& DrawTexture(const Texture& texture,
1729 const ImpellerPoint& point,
1730 ImpellerTextureSampling sampling,
1731 const Paint& paint) {
1732 gGlobalProcTable.ImpellerDisplayListBuilderDrawTexture(
1733 Get(), texture.Get(), &point, sampling, paint.Get());
1734 return *this;
1735 }
1736
1737 //----------------------------------------------------------------------------
1738 /// @see ImpellerDisplayListBuilderDrawTextureRect
1739 ///
1740 DisplayListBuilder& DrawTextureRect(const Texture& texture,
1741 const ImpellerRect& src_rect,
1742 const ImpellerRect& dst_rect,
1743 ImpellerTextureSampling sampling,
1744 const Paint& paint) {
1745 gGlobalProcTable.ImpellerDisplayListBuilderDrawTextureRect(
1746 Get(), texture.Get(), //
1747 &src_rect, //
1748 &dst_rect, //
1749 sampling, //
1750 paint.Get());
1751 return *this;
1752 }
1753
1754 //----------------------------------------------------------------------------
1755 /// @see ImpellerDisplayListBuilderGetSaveCount
1756 ///
1757 uint32_t GetSaveCount() {
1758 return gGlobalProcTable.ImpellerDisplayListBuilderGetSaveCount(Get());
1759 }
1760
1761 //----------------------------------------------------------------------------
1762 /// @see ImpellerDisplayListBuilderGetTransform
1763 ///
1764 ImpellerMatrix GetTransform() {
1765 ImpellerMatrix result;
1766 gGlobalProcTable.ImpellerDisplayListBuilderGetTransform(Get(), &result);
1767 return result;
1768 }
1769
1770 //----------------------------------------------------------------------------
1771 /// @see ImpellerDisplayListBuilderResetTransform
1772 ///
1773 DisplayListBuilder& ResetTransform() {
1774 gGlobalProcTable.ImpellerDisplayListBuilderResetTransform(Get());
1775 return *this;
1776 }
1777
1778 //----------------------------------------------------------------------------
1779 /// @see ImpellerDisplayListBuilderRestore
1780 ///
1781 DisplayListBuilder& Restore() {
1782 gGlobalProcTable.ImpellerDisplayListBuilderRestore(Get());
1783 return *this;
1784 }
1785
1786 //----------------------------------------------------------------------------
1787 /// @see ImpellerDisplayListBuilderRestoreToCount
1788 ///
1789 DisplayListBuilder& RestoreToCount(uint32_t count) {
1790 gGlobalProcTable.ImpellerDisplayListBuilderRestoreToCount(Get(), //
1791 count);
1792 return *this;
1793 }
1794
1795 //----------------------------------------------------------------------------
1796 /// @see ImpellerDisplayListBuilderRotate
1797 ///
1798 DisplayListBuilder& Rotate(float angle_degrees) {
1799 gGlobalProcTable.ImpellerDisplayListBuilderRotate(Get(), //
1800 angle_degrees);
1801 return *this;
1802 }
1803
1804 //----------------------------------------------------------------------------
1805 /// @see ImpellerDisplayListBuilderSave
1806 ///
1807 DisplayListBuilder& Save() {
1808 gGlobalProcTable.ImpellerDisplayListBuilderSave(Get());
1809 return *this;
1810 }
1811
1812 //----------------------------------------------------------------------------
1813 /// @see ImpellerDisplayListBuilderSaveLayer
1814 ///
1815 DisplayListBuilder& SaveLayer(const ImpellerRect& bounds,
1816 const Paint* paint = nullptr,
1817 const ImageFilter* backdrop = nullptr) {
1818 gGlobalProcTable.ImpellerDisplayListBuilderSaveLayer(
1819 Get(), //
1820 &bounds, //
1821 paint ? paint->Get() : NULL, //
1822 backdrop ? backdrop->Get() : NULL //
1823 );
1824 return *this;
1825 }
1826
1827 //----------------------------------------------------------------------------
1828 /// @see ImpellerDisplayListBuilderScale
1829 ///
1830 DisplayListBuilder& Scale(float x_scale, float y_scale) {
1831 gGlobalProcTable.ImpellerDisplayListBuilderScale(Get(), //
1832 x_scale, //
1833 y_scale);
1834 return *this;
1835 }
1836
1837 //----------------------------------------------------------------------------
1838 /// @see ImpellerDisplayListBuilderSetTransform
1839 ///
1840 DisplayListBuilder& SetTransform(const ImpellerMatrix& transform) {
1841 gGlobalProcTable.ImpellerDisplayListBuilderSetTransform(Get(), &transform);
1842 return *this;
1843 }
1844
1845 //----------------------------------------------------------------------------
1846 /// @see ImpellerDisplayListBuilderTransform
1847 ///
1848 DisplayListBuilder& Transform(const ImpellerMatrix& transform) {
1849 gGlobalProcTable.ImpellerDisplayListBuilderTransform(Get(), &transform);
1850 return *this;
1851 }
1852
1853 //----------------------------------------------------------------------------
1854 /// @see ImpellerDisplayListBuilderTranslate
1855 ///
1856 DisplayListBuilder& Translate(float x_translation, float y_translation) {
1857 gGlobalProcTable.ImpellerDisplayListBuilderTranslate(Get(), //
1858 x_translation, //
1859 y_translation //
1860 );
1861 return *this;
1862 }
1863 };
1864
1865 } // namespace IMPELLER_HPP_NAMESPACE
1866
1867 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
IMPELLER_HPP_NAMESPACE::ColorFilter
Definition: impeller.hpp:456
IMPELLER_HPP_NAMESPACE::ColorFilter::Blend
static ColorFilter Blend(const ImpellerColor &color, ImpellerBlendMode mode)
Definition: impeller.hpp:463
IMPELLER_HPP_NAMESPACE::ColorFilter::Matrix
static ColorFilter Matrix(const ImpellerColorMatrix &color_matrix)
Definition: impeller.hpp:472
IMPELLER_HPP_NAMESPACE::ColorFilter::ColorFilter
ColorFilter(ImpellerColorFilter filter, AdoptTag tag)
Definition: impeller.hpp:458
IMPELLER_HPP_NAMESPACE::ColorSource
Definition: impeller.hpp:505
IMPELLER_HPP_NAMESPACE::ColorSource::ColorSource
ColorSource(ImpellerColorSource source, AdoptTag tag)
Definition: impeller.hpp:507
IMPELLER_HPP_NAMESPACE::ColorSource::ConicalGradient
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)
Definition: impeller.hpp:512
IMPELLER_HPP_NAMESPACE::ColorSource::Image
static ColorSource Image(const Texture &image, ImpellerTileMode horizontal_tile_mode, ImpellerTileMode vertical_tile_mode, ImpellerTextureSampling sampling, const ImpellerMatrix *transformation=nullptr)
Definition: impeller.hpp:540
IMPELLER_HPP_NAMESPACE::ColorSource::SweepGradient
static ColorSource SweepGradient(const ImpellerPoint &center, float start, float end, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
Definition: impeller.hpp:606
IMPELLER_HPP_NAMESPACE::ColorSource::FragmentProgram
static ColorSource FragmentProgram(const Context &context, const FragmentProgram &program, const std::vector< ImpellerTexture > &samplers, const Mapping *uniform_data)
Definition: impeller.hpp:632
IMPELLER_HPP_NAMESPACE::ColorSource::LinearGradient
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)
Definition: impeller.hpp:558
IMPELLER_HPP_NAMESPACE::ColorSource::RadialGradient
static ColorSource RadialGradient(const ImpellerPoint &center, float radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
Definition: impeller.hpp:582
IMPELLER_HPP_NAMESPACE::Context
Definition: impeller.hpp:367
IMPELLER_HPP_NAMESPACE::Context::OpenGLES
static Context OpenGLES(const std::function< void *(const char *)> &gl_proc_address_resolver)
Definition: impeller.hpp:374
IMPELLER_HPP_NAMESPACE::Context::Context
Context(ImpellerContext context, AdoptTag tag)
Definition: impeller.hpp:369
IMPELLER_HPP_NAMESPACE::Context::GetVulkanInfo
bool GetVulkanInfo(ImpellerContextVulkanInfo &info) const
Definition: impeller.hpp:396
IMPELLER_HPP_NAMESPACE::DisplayListBuilder
Definition: impeller.hpp:1526
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Transform
DisplayListBuilder & Transform(const ImpellerMatrix &transform)
Definition: impeller.hpp:1848
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Build
DisplayList Build()
Definition: impeller.hpp:1538
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawRoundedRect
DisplayListBuilder & DrawRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, const Paint &paint)
Definition: impeller.hpp:1696
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Restore
DisplayListBuilder & Restore()
Definition: impeller.hpp:1781
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawLine
DisplayListBuilder & DrawLine(const ImpellerPoint &from, const ImpellerPoint &to, const Paint &paint)
Definition: impeller.hpp:1620
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Scale
DisplayListBuilder & Scale(float x_scale, float y_scale)
Definition: impeller.hpp:1830
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawRoundedRectDifference
DisplayListBuilder & DrawRoundedRectDifference(const ImpellerRect &outer_rect, const ImpellerRoundingRadii &outer_radii, const ImpellerRect &inner_rect, const ImpellerRoundingRadii &inner_radii, const Paint &paint)
Definition: impeller.hpp:1709
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Rotate
DisplayListBuilder & Rotate(float angle_degrees)
Definition: impeller.hpp:1798
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipRect
DisplayListBuilder & ClipRect(const ImpellerRect &rect, ImpellerClipOperation op)
Definition: impeller.hpp:1568
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawRect
DisplayListBuilder & DrawRect(const ImpellerRect &rect, const Paint &paint)
Definition: impeller.hpp:1687
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ResetTransform
DisplayListBuilder & ResetTransform()
Definition: impeller.hpp:1773
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawTextureRect
DisplayListBuilder & DrawTextureRect(const Texture &texture, const ImpellerRect &src_rect, const ImpellerRect &dst_rect, ImpellerTextureSampling sampling, const Paint &paint)
Definition: impeller.hpp:1740
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawParagraph
DisplayListBuilder & DrawParagraph(const Paragraph &paragraph, const ImpellerPoint &point)
Definition: impeller.hpp:1654
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawPaint
DisplayListBuilder & DrawPaint(const Paint &paint)
Definition: impeller.hpp:1646
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawDashedLine
DisplayListBuilder & DrawDashedLine(const ImpellerPoint &from, const ImpellerPoint &to, float on_length, float off_length, const Paint &paint)
Definition: impeller.hpp:1593
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawPath
DisplayListBuilder & DrawPath(const Path &path, const Paint &paint)
Definition: impeller.hpp:1678
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::GetSaveCount
uint32_t GetSaveCount()
Definition: impeller.hpp:1757
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipRoundedRect
DisplayListBuilder & ClipRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, ImpellerClipOperation op)
Definition: impeller.hpp:1579
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::SaveLayer
DisplayListBuilder & SaveLayer(const ImpellerRect &bounds, const Paint *paint=nullptr, const ImageFilter *backdrop=nullptr)
Definition: impeller.hpp:1815
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::GetTransform
ImpellerMatrix GetTransform()
Definition: impeller.hpp:1764
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::SetTransform
DisplayListBuilder & SetTransform(const ImpellerMatrix &transform)
Definition: impeller.hpp:1840
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const ImpellerRect *cull_rect=nullptr)
Definition: impeller.hpp:1531
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::RestoreToCount
DisplayListBuilder & RestoreToCount(uint32_t count)
Definition: impeller.hpp:1789
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawOval
DisplayListBuilder & DrawOval(const ImpellerRect &oval_bounds, const Paint &paint)
Definition: impeller.hpp:1634
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Save
DisplayListBuilder & Save()
Definition: impeller.hpp:1807
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawShadow
DisplayListBuilder & DrawShadow(const Path &path, const ImpellerColor &shadow_color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
Definition: impeller.hpp:1664
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Translate
DisplayListBuilder & Translate(float x_translation, float y_translation)
Definition: impeller.hpp:1856
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawTexture
DisplayListBuilder & DrawTexture(const Texture &texture, const ImpellerPoint &point, ImpellerTextureSampling sampling, const Paint &paint)
Definition: impeller.hpp:1728
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawDisplayList
DisplayListBuilder & DrawDisplayList(const DisplayList &display_list, float opacity=1.0f)
Definition: impeller.hpp:1610
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipPath
DisplayListBuilder & ClipPath(const Path &path, ImpellerClipOperation op)
Definition: impeller.hpp:1558
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipOval
DisplayListBuilder & ClipOval(const ImpellerRect &oval_bounds, ImpellerClipOperation op)
Definition: impeller.hpp:1547
IMPELLER_HPP_NAMESPACE::DisplayList
Definition: impeller.hpp:1435
IMPELLER_HPP_NAMESPACE::DisplayList::DisplayList
DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
Definition: impeller.hpp:1437
IMPELLER_HPP_NAMESPACE::FragmentProgram
Definition: impeller.hpp:483
IMPELLER_HPP_NAMESPACE::FragmentProgram::FragmentProgram
FragmentProgram(ImpellerFragmentProgram program, AdoptTag tag)
Definition: impeller.hpp:485
IMPELLER_HPP_NAMESPACE::FragmentProgram::WithData
static FragmentProgram WithData(std::unique_ptr< Mapping > data)
Definition: impeller.hpp:488
IMPELLER_HPP_NAMESPACE::GlyphInfo
Definition: impeller.hpp:748
IMPELLER_HPP_NAMESPACE::GlyphInfo::GetGraphemeClusterCodeUnitRangeEnd
size_t GetGraphemeClusterCodeUnitRangeEnd() const
Definition: impeller.hpp:763
IMPELLER_HPP_NAMESPACE::GlyphInfo::IsEllipsis
bool IsEllipsis() const
Definition: impeller.hpp:780
IMPELLER_HPP_NAMESPACE::GlyphInfo::GlyphInfo
GlyphInfo(ImpellerGlyphInfo info, AdoptTag tag)
Definition: impeller.hpp:750
IMPELLER_HPP_NAMESPACE::GlyphInfo::GetGraphemeClusterCodeUnitRangeBegin
size_t GetGraphemeClusterCodeUnitRangeBegin() const
Definition: impeller.hpp:755
IMPELLER_HPP_NAMESPACE::GlyphInfo::GetTextDirection
ImpellerTextDirection GetTextDirection() const
Definition: impeller.hpp:787
IMPELLER_HPP_NAMESPACE::GlyphInfo::GetGraphemeClusterBounds
ImpellerRect GetGraphemeClusterBounds() const
Definition: impeller.hpp:771
IMPELLER_HPP_NAMESPACE::ImageFilter
Definition: impeller.hpp:654
IMPELLER_HPP_NAMESPACE::ImageFilter::Compose
static ImageFilter Compose(const ImageFilter &outer, const ImageFilter &inner)
Definition: impeller.hpp:672
IMPELLER_HPP_NAMESPACE::ImageFilter::Dilate
static ImageFilter Dilate(float x_radius, float y_radius)
Definition: impeller.hpp:682
IMPELLER_HPP_NAMESPACE::ImageFilter::Matrix
static ImageFilter Matrix(const ImpellerMatrix &matrix, ImpellerTextureSampling sampling)
Definition: impeller.hpp:700
IMPELLER_HPP_NAMESPACE::ImageFilter::Blur
static ImageFilter Blur(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
Definition: impeller.hpp:661
IMPELLER_HPP_NAMESPACE::ImageFilter::FragmentProgram
static ImageFilter FragmentProgram(const Context &context, const FragmentProgram &program, const std::vector< ImpellerTexture > &samplers, const Mapping *uniform_data)
Definition: impeller.hpp:710
IMPELLER_HPP_NAMESPACE::ImageFilter::Erode
static ImageFilter Erode(float x_radius, float y_radius)
Definition: impeller.hpp:691
IMPELLER_HPP_NAMESPACE::ImageFilter::ImageFilter
ImageFilter(ImpellerImageFilter filter, AdoptTag tag)
Definition: impeller.hpp:656
IMPELLER_HPP_NAMESPACE::LineMetrics
Definition: impeller.hpp:796
IMPELLER_HPP_NAMESPACE::LineMetrics::IsHardbreak
bool IsHardbreak(size_t line) const
Definition: impeller.hpp:832
IMPELLER_HPP_NAMESPACE::LineMetrics::GetCodeUnitEndIndex
size_t GetCodeUnitEndIndex(size_t line) const
Definition: impeller.hpp:868
IMPELLER_HPP_NAMESPACE::LineMetrics::GetCodeUnitStartIndex
size_t GetCodeUnitStartIndex(size_t line) const
Definition: impeller.hpp:860
IMPELLER_HPP_NAMESPACE::LineMetrics::GetHeight
double GetHeight(size_t line) const
Definition: impeller.hpp:846
IMPELLER_HPP_NAMESPACE::LineMetrics::GetDescent
double GetDescent(size_t line) const
Definition: impeller.hpp:818
IMPELLER_HPP_NAMESPACE::LineMetrics::GetCodeUnitEndIndexExcludingWhitespace
size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const
Definition: impeller.hpp:875
IMPELLER_HPP_NAMESPACE::LineMetrics::GetUnscaledAscent
double GetUnscaledAscent(size_t line) const
Definition: impeller.hpp:804
IMPELLER_HPP_NAMESPACE::LineMetrics::GetWidth
double GetWidth(size_t line) const
Definition: impeller.hpp:839
IMPELLER_HPP_NAMESPACE::LineMetrics::GetCodeUnitEndIndexIncludingNewline
size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const
Definition: impeller.hpp:883
IMPELLER_HPP_NAMESPACE::LineMetrics::GetBaseline
double GetBaseline(size_t line) const
Definition: impeller.hpp:825
IMPELLER_HPP_NAMESPACE::LineMetrics::GetLeft
double GetLeft(size_t line) const
Definition: impeller.hpp:853
IMPELLER_HPP_NAMESPACE::LineMetrics::GetAscent
double GetAscent(size_t line) const
Definition: impeller.hpp:811
IMPELLER_HPP_NAMESPACE::LineMetrics::LineMetrics
LineMetrics(ImpellerLineMetrics metrics, AdoptTag tag)
Definition: impeller.hpp:798
IMPELLER_HPP_NAMESPACE::Mapping
Definition: impeller.hpp:339
IMPELLER_HPP_NAMESPACE::Mapping::GetMapping
const uint8_t * GetMapping() const
Definition: impeller.hpp:354
IMPELLER_HPP_NAMESPACE::Mapping::~Mapping
~Mapping()
Definition: impeller.hpp:348
IMPELLER_HPP_NAMESPACE::Mapping::Mapping
Mapping(const uint8_t *mapping, size_t size, std::function< void()> release_callback)
Definition: impeller.hpp:341
IMPELLER_HPP_NAMESPACE::Mapping::GetSize
size_t GetSize() const
Definition: impeller.hpp:356
IMPELLER_HPP_NAMESPACE::MaskFilter
Definition: impeller.hpp:731
IMPELLER_HPP_NAMESPACE::MaskFilter::Blur
static MaskFilter Blur(ImpellerBlurStyle style, float sigma)
Definition: impeller.hpp:738
IMPELLER_HPP_NAMESPACE::MaskFilter::MaskFilter
MaskFilter(ImpellerMaskFilter filter, AdoptTag tag)
Definition: impeller.hpp:733
IMPELLER_HPP_NAMESPACE::Object
Definition: impeller.hpp:254
IMPELLER_HPP_NAMESPACE::Object::Object
Object(T object)
Definition: impeller.hpp:258
IMPELLER_HPP_NAMESPACE::Object::Get
T Get() const
Definition: impeller.hpp:278
IMPELLER_HPP_NAMESPACE::Object::Object
Object(Object &&other)
Definition: impeller.hpp:264
IMPELLER_HPP_NAMESPACE::Object::operator=
Object & operator=(const Object &other)
Definition: impeller.hpp:273
IMPELLER_HPP_NAMESPACE::Object::operator=
Object & operator=(Object &&other)
Definition: impeller.hpp:268
IMPELLER_HPP_NAMESPACE::Object::Object
Object(T object, AdoptTag)
Definition: impeller.hpp:260
IMPELLER_HPP_NAMESPACE::Object::Object
Object(const Object &other)
Definition: impeller.hpp:266
IMPELLER_HPP_NAMESPACE::Object::~Object
~Object()
Definition: impeller.hpp:262
IMPELLER_HPP_NAMESPACE::Object::Object
Object()=default
IMPELLER_HPP_NAMESPACE::Paint
Definition: impeller.hpp:1000
IMPELLER_HPP_NAMESPACE::Paint::SetDrawStyle
Paint & SetDrawStyle(ImpellerDrawStyle style)
Definition: impeller.hpp:1023
IMPELLER_HPP_NAMESPACE::Paint::SetColor
Paint & SetColor(const ImpellerColor &color)
Definition: impeller.hpp:1007
IMPELLER_HPP_NAMESPACE::Paint::SetBlendMode
Paint & SetBlendMode(ImpellerBlendMode mode)
Definition: impeller.hpp:1015
IMPELLER_HPP_NAMESPACE::Paint::SetMaskFilter
Paint & SetMaskFilter(const MaskFilter &filter)
Definition: impeller.hpp:1087
IMPELLER_HPP_NAMESPACE::Paint::Paint
Paint()
Definition: impeller.hpp:1002
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeJoin
Paint & SetStrokeJoin(ImpellerStrokeJoin join)
Definition: impeller.hpp:1039
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeWidth
Paint & SetStrokeWidth(float width)
Definition: impeller.hpp:1047
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeCap
Paint & SetStrokeCap(ImpellerStrokeCap cap)
Definition: impeller.hpp:1031
IMPELLER_HPP_NAMESPACE::Paint::SetColorFilter
Paint & SetColorFilter(const ColorFilter &filter)
Definition: impeller.hpp:1063
IMPELLER_HPP_NAMESPACE::Paint::SetColorSource
Paint & SetColorSource(const ColorSource &source)
Definition: impeller.hpp:1071
IMPELLER_HPP_NAMESPACE::Paint::SetImageFilter
Paint & SetImageFilter(const ImageFilter &filter)
Definition: impeller.hpp:1079
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeMiter
Paint & SetStrokeMiter(float miter)
Definition: impeller.hpp:1055
IMPELLER_HPP_NAMESPACE::ParagraphBuilder
Definition: impeller.hpp:1246
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::Build
Paragraph Build(float width)
Definition: impeller.hpp:1255
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::PushStyle
ParagraphBuilder & PushStyle(const ParagraphStyle &style)
Definition: impeller.hpp:1266
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::PopStyle
ParagraphBuilder & PopStyle()
Definition: impeller.hpp:1274
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::ParagraphBuilder
ParagraphBuilder(const TypographyContext &context)
Definition: impeller.hpp:1248
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const std::string &string)
Definition: impeller.hpp:1290
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const std::string_view &string)
Definition: impeller.hpp:1298
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const uint8_t *utf8_data, uint32_t length)
Definition: impeller.hpp:1282
IMPELLER_HPP_NAMESPACE::Paragraph
Definition: impeller.hpp:892
IMPELLER_HPP_NAMESPACE::Paragraph::GetMaxIntrinsicWidth
float GetMaxIntrinsicWidth()
Definition: impeller.hpp:935
IMPELLER_HPP_NAMESPACE::Paragraph::GetLineMetrics
LineMetrics GetLineMetrics() const
Definition: impeller.hpp:956
IMPELLER_HPP_NAMESPACE::Paragraph::GlyphInfoAtParagraphCoordinates
GlyphInfo GlyphInfoAtParagraphCoordinates(double x, double y)
Definition: impeller.hpp:975
IMPELLER_HPP_NAMESPACE::Paragraph::GlyphInfoAtCodeUnitIndex
GlyphInfo GlyphInfoAtCodeUnitIndex(size_t code_unit_index)
Definition: impeller.hpp:965
IMPELLER_HPP_NAMESPACE::Paragraph::GetAlphabeticBaseline
float GetAlphabeticBaseline()
Definition: impeller.hpp:900
IMPELLER_HPP_NAMESPACE::Paragraph::GetWordBoundary
ImpellerRange GetWordBoundary(size_t code_unit_index)
Definition: impeller.hpp:989
IMPELLER_HPP_NAMESPACE::Paragraph::GetIdeographicBaseline
float GetIdeographicBaseline()
Definition: impeller.hpp:914
IMPELLER_HPP_NAMESPACE::Paragraph::GetHeight
float GetHeight()
Definition: impeller.hpp:907
IMPELLER_HPP_NAMESPACE::Paragraph::Paragraph
Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
Definition: impeller.hpp:894
IMPELLER_HPP_NAMESPACE::Paragraph::GetLongestLineWidth
float GetLongestLineWidth()
Definition: impeller.hpp:928
IMPELLER_HPP_NAMESPACE::Paragraph::GetMinIntrinsicWidth
float GetMinIntrinsicWidth()
Definition: impeller.hpp:949
IMPELLER_HPP_NAMESPACE::Paragraph::GetMaxWidth
float GetMaxWidth()
Definition: impeller.hpp:942
IMPELLER_HPP_NAMESPACE::Paragraph::GetLineCount
uint32_t GetLineCount()
Definition: impeller.hpp:921
IMPELLER_HPP_NAMESPACE::ParagraphStyle
Definition: impeller.hpp:1097
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetTextAlignment
ParagraphStyle & SetTextAlignment(ImpellerTextAlignment align)
Definition: impeller.hpp:1186
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetTextDirection
ParagraphStyle & SetTextDirection(ImpellerTextDirection direction)
Definition: impeller.hpp:1194
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetEllipsis
ParagraphStyle & SetEllipsis(const char *ellipsis)
Definition: impeller.hpp:1170
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetTextDecoration
ParagraphStyle & SetTextDecoration(const ImpellerTextDecoration &decoration)
Definition: impeller.hpp:1202
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontSize
ParagraphStyle & SetFontSize(float size)
Definition: impeller.hpp:1122
IMPELLER_HPP_NAMESPACE::ParagraphStyle::ParagraphStyle
ParagraphStyle()
Definition: impeller.hpp:1099
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetForeground
ParagraphStyle & SetForeground(const Paint &paint)
Definition: impeller.hpp:1146
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetLocale
ParagraphStyle & SetLocale(const char *locale)
Definition: impeller.hpp:1162
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetBackground
ParagraphStyle & SetBackground(const Paint &paint)
Definition: impeller.hpp:1106
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontStyle
ParagraphStyle & SetFontStyle(ImpellerFontStyle style)
Definition: impeller.hpp:1130
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontFamily
ParagraphStyle & SetFontFamily(const char *family_name)
Definition: impeller.hpp:1114
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontWeight
ParagraphStyle & SetFontWeight(ImpellerFontWeight weight)
Definition: impeller.hpp:1138
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetMaxLines
ParagraphStyle & SetMaxLines(uint32_t max_lines)
Definition: impeller.hpp:1178
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetHeight
ParagraphStyle & SetHeight(float height)
Definition: impeller.hpp:1154
IMPELLER_HPP_NAMESPACE::PathBuilder
Definition: impeller.hpp:1322
IMPELLER_HPP_NAMESPACE::PathBuilder::QuadraticCurveTo
PathBuilder & QuadraticCurveTo(const ImpellerPoint &control_point, const ImpellerPoint &end_point)
Definition: impeller.hpp:1423
IMPELLER_HPP_NAMESPACE::PathBuilder::AddRect
PathBuilder & AddRect(const ImpellerRect &rect)
Definition: impeller.hpp:1370
IMPELLER_HPP_NAMESPACE::PathBuilder::CubicCurveTo
PathBuilder & CubicCurveTo(const ImpellerPoint &control_point_1, const ImpellerPoint &control_point_2, const ImpellerPoint &end_point)
Definition: impeller.hpp:1396
IMPELLER_HPP_NAMESPACE::PathBuilder::BuildCopy
Path BuildCopy(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero) const
Definition: impeller.hpp:1330
IMPELLER_HPP_NAMESPACE::PathBuilder::AddArc
PathBuilder & AddArc(const ImpellerRect &oval_bounds, float start_angle_degrees, float end_angle_degrees)
Definition: impeller.hpp:1348
IMPELLER_HPP_NAMESPACE::PathBuilder::PathBuilder
PathBuilder()
Definition: impeller.hpp:1324
IMPELLER_HPP_NAMESPACE::PathBuilder::Build
Path Build(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero)
Definition: impeller.hpp:1339
IMPELLER_HPP_NAMESPACE::PathBuilder::MoveTo
PathBuilder & MoveTo(const ImpellerPoint &location)
Definition: impeller.hpp:1415
IMPELLER_HPP_NAMESPACE::PathBuilder::LineTo
PathBuilder & LineTo(const ImpellerPoint &location)
Definition: impeller.hpp:1407
IMPELLER_HPP_NAMESPACE::PathBuilder::AddOval
PathBuilder & AddOval(const ImpellerRect &oval_bounds)
Definition: impeller.hpp:1362
IMPELLER_HPP_NAMESPACE::PathBuilder::Close
PathBuilder & Close()
Definition: impeller.hpp:1388
IMPELLER_HPP_NAMESPACE::PathBuilder::AddRoundedRect
PathBuilder & AddRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &rounding_radii)
Definition: impeller.hpp:1378
IMPELLER_HPP_NAMESPACE::Path
Definition: impeller.hpp:1307
IMPELLER_HPP_NAMESPACE::Path::GetBounds
ImpellerRect GetBounds() const
Definition: impeller.hpp:1311
IMPELLER_HPP_NAMESPACE::Path::Path
Path(ImpellerPath path, AdoptTag tag)
Definition: impeller.hpp:1309
IMPELLER_HPP_NAMESPACE::Surface
Definition: impeller.hpp:1444
IMPELLER_HPP_NAMESPACE::Surface::Present
bool Present() const
Definition: impeller.hpp:1488
IMPELLER_HPP_NAMESPACE::Surface::WrapFBO
static Surface WrapFBO(const Context &context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize &size)
Definition: impeller.hpp:1453
IMPELLER_HPP_NAMESPACE::Surface::Surface
Surface(ImpellerSurface surface, AdoptTag tag)
Definition: impeller.hpp:1448
IMPELLER_HPP_NAMESPACE::Surface::Surface
Surface(ImpellerSurface surface)
Definition: impeller.hpp:1446
IMPELLER_HPP_NAMESPACE::Surface::Draw
bool Draw(const DisplayList &display_list) const
Definition: impeller.hpp:1480
IMPELLER_HPP_NAMESPACE::Surface::WrapMetalDrawable
static Surface WrapMetalDrawable(const Context &context, void *metal_drawable)
Definition: impeller.hpp:1469
IMPELLER_HPP_NAMESPACE::Texture
Definition: impeller.hpp:404
IMPELLER_HPP_NAMESPACE::Texture::Texture
Texture(ImpellerTexture texture, AdoptTag adopt)
Definition: impeller.hpp:406
IMPELLER_HPP_NAMESPACE::Texture::WithContents
static Texture WithContents(const Context &context, const ImpellerTextureDescriptor &descriptor, std::unique_ptr< Mapping > mapping=nullptr)
Definition: impeller.hpp:411
IMPELLER_HPP_NAMESPACE::Texture::WithOpenGLTexture
static Texture WithOpenGLTexture(const Context &context, const ImpellerTextureDescriptor &descriptor, uint64_t handle)
Definition: impeller.hpp:435
IMPELLER_HPP_NAMESPACE::Texture::GetOpenGLHandle
uint64_t GetOpenGLHandle() const
Definition: impeller.hpp:447
IMPELLER_HPP_NAMESPACE::TypographyContext
Definition: impeller.hpp:1213
IMPELLER_HPP_NAMESPACE::TypographyContext::TypographyContext
TypographyContext()
Definition: impeller.hpp:1215
IMPELLER_HPP_NAMESPACE::TypographyContext::RegisterFont
bool RegisterFont(std::unique_ptr< Mapping > mapping, const char *optional_family_name_alias=nullptr)
Definition: impeller.hpp:1222
IMPELLER_HPP_NAMESPACE::VulkanSwapchain
Definition: impeller.hpp:1497
IMPELLER_HPP_NAMESPACE::VulkanSwapchain::VulkanSwapchain
VulkanSwapchain(ImpellerVulkanSwapchain swapchain, AdoptTag tag)
Definition: impeller.hpp:1499
IMPELLER_HPP_NAMESPACE::VulkanSwapchain::Create
static VulkanSwapchain Create(const Context &context, void *vulkan_surface_khr)
Definition: impeller.hpp:1505
IMPELLER_HPP_NAMESPACE::VulkanSwapchain::AcquireNextSurface
Surface AcquireNextSurface() const
Definition: impeller.hpp:1515
location
uint32_t location
Definition: compiler_unittests.cc:129
x
int32_t x
Definition: dl_golden_unittests.cc:458
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:312
impeller.h
ImpellerFillType
ImpellerFillType
Definition: impeller.h:364
kImpellerFillTypeNonZero
@ kImpellerFillTypeNonZero
Definition: impeller.h:365
ImpellerTextDirection
ImpellerTextDirection
Definition: impeller.h:479
ImpellerTextureSampling
ImpellerTextureSampling
Definition: impeller.h:428
IMPELLER_MAKE_VERSION
#define IMPELLER_MAKE_VERSION(variant, major, minor, patch)
Pack a version in a uint32_t.
Definition: impeller.h:79
ImpellerPathBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE ImpellerPathBuilderNew()
Create a new path builder. Paths themselves are immutable. A builder builds these immutable paths.
ImpellerPaintNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE ImpellerPaintNew()
Create a new paint with default values.
ImpellerStrokeJoin
ImpellerStrokeJoin
Definition: impeller.h:418
ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew
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...
ImpellerBlendMode
ImpellerBlendMode
Definition: impeller.h:374
IMPELLER_VERSION
#define IMPELLER_VERSION
Definition: impeller.h:103
ImpellerFontWeight
ImpellerFontWeight
Definition: impeller.h:453
ImpellerProcAddressCallback
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:347
ImpellerStrokeCap
ImpellerStrokeCap
Definition: impeller.h:412
ImpellerDrawStyle
ImpellerDrawStyle
Definition: impeller.h:406
ImpellerTileMode
ImpellerTileMode
Definition: impeller.h:433
ImpellerParagraphStyleNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE ImpellerParagraphStyleNew()
Create a new paragraph style.
ImpellerTextAlignment
ImpellerTextAlignment
Definition: impeller.h:470
ImpellerTypographyContextNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE ImpellerTypographyContextNew()
Create a new typography contents.
ImpellerFontStyle
ImpellerFontStyle
Definition: impeller.h:465
ImpellerClipOperation
ImpellerClipOperation
Definition: impeller.h:369
ImpellerDisplayListBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE ImpellerDisplayListBuilderNew(const ImpellerRect *IMPELLER_NULLABLE cull_rect)
Create a new display list builder.
ImpellerBlurStyle
ImpellerBlurStyle
Definition: impeller.h:440
ImpellerPixelFormat
ImpellerPixelFormat
Definition: impeller.h:424
ImpellerParagraphBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context)
Create a new paragraph builder.
IMPELLER_HPP_PROC
#define IMPELLER_HPP_PROC(proc)
Definition: impeller.hpp:242
IMPELLER_HPP_EACH_PROC
#define IMPELLER_HPP_EACH_PROC(PROC)
Definition: impeller.hpp:48
IMPELLER_HPP_NAMESPACE
Definition: impeller.hpp:32
IMPELLER_HPP_NAMESPACE::AdoptTag
AdoptTag
Definition: impeller.hpp:249
IMPELLER_HPP_NAMESPACE::AdoptTag::kAdopt
@ kAdopt
IMPELLER_HPP_NAMESPACE::gGlobalProcTable
ProcTable gGlobalProcTable
Definition: playground_test.cc:25
IMPELLER_HPP_NAMESPACE::IMPELLER_HPP_DEFINE_TRAITS
IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter)
std
Definition: comparable.h:95
IMPELLER_HPP_NAMESPACE::Proc
Definition: impeller.hpp:35
IMPELLER_HPP_NAMESPACE::Proc::name
const char * name
Definition: impeller.hpp:38
IMPELLER_HPP_NAMESPACE::Proc::operator()
auto operator()(Args &&... args) const
Definition: impeller.hpp:43
IMPELLER_HPP_NAMESPACE::Proc::FunctionType
T FunctionType
Definition: impeller.hpp:36
IMPELLER_HPP_NAMESPACE::ProcTable
Definition: impeller.hpp:226
IMPELLER_HPP_NAMESPACE::ProcTable::Initialize
bool Initialize(const std::function< void *(const char *function_name)> &resolver)
Definition: impeller.hpp:227
ImpellerColor
Definition: impeller.h:612
ImpellerColorMatrix
Definition: impeller.h:601
ImpellerContextVulkanInfo
Definition: impeller.h:638
ImpellerISize
Definition: impeller.h:519
ImpellerMapping
Definition: impeller.h:626
ImpellerMapping::on_release
ImpellerCallback IMPELLER_NULLABLE on_release
Definition: impeller.h:629
ImpellerMapping::length
uint64_t length
Definition: impeller.h:628
ImpellerMapping::data
const uint8_t *IMPELLER_NONNULL data
Definition: impeller.h:627
ImpellerMatrix
Definition: impeller.h:539
ImpellerPoint
Definition: impeller.h:509
ImpellerRange
Definition: impeller.h:524
ImpellerRect
Definition: impeller.h:502
ImpellerRoundingRadii
Definition: impeller.h:605
ImpellerTextDecoration
Definition: impeller.h:646
ImpellerTextureDescriptor
Definition: impeller.h:620
start
const size_t start
Definition: tessellator_libtess.cc:62
end
const size_t end
Definition: tessellator_libtess.cc:63
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:69