| 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
14 #include "impeller.h"
15
16 //------------------------------------------------------------------------------
17 /// A C++ 17 wrapper to the C Impeller API. This is a convenience wrapper for
18 /// the C++ API and only depends on standard libc++ utilities in addition to
19 /// impeller.h
20 ///
21
22 #ifndef IMPELLER_HPP_NAMESPACE
23 #define IMPELLER_HPP_NAMESPACE impeller::hpp
24 #endif // IMPELLER_HPP_NAMESPACE
25
26 // Tripping this assertion means that the C++ wrapper needs to be updated to
27 // account for impeller.h changes as necessary.
28 static_assert(IMPELLER_VERSION == IMPELLER_MAKE_VERSION(1, 1, 2, 0),
29 "C++ bindings must be for the same version as the C API.");
30
31 namespace IMPELLER_HPP_NAMESPACE {
32
33 template <class T>
34 struct Proc {
35 using FunctionType = T;
36
37 const char* name = nullptr;
38
39 FunctionType* function = nullptr;
40
41 template <class... Args>
42 auto operator()(Args&&... args) const {
43 return function(std::forward<Args>(args)...);
44 }
45 };
46
47 #define IMPELLER_HPP_EACH_PROC(PROC) \
48 PROC(ImpellerColorFilterCreateBlendNew) \
49 PROC(ImpellerColorFilterCreateColorMatrixNew) \
50 PROC(ImpellerColorFilterRelease) \
51 PROC(ImpellerColorFilterRetain) \
52 PROC(ImpellerColorSourceCreateConicalGradientNew) \
53 PROC(ImpellerColorSourceCreateImageNew) \
54 PROC(ImpellerColorSourceCreateLinearGradientNew) \
55 PROC(ImpellerColorSourceCreateRadialGradientNew) \
56 PROC(ImpellerColorSourceCreateSweepGradientNew) \
57 PROC(ImpellerColorSourceRelease) \
58 PROC(ImpellerColorSourceRetain) \
59 PROC(ImpellerContextCreateOpenGLESNew) \
60 PROC(ImpellerContextRelease) \
61 PROC(ImpellerContextRetain) \
62 PROC(ImpellerDisplayListBuilderClipOval) \
63 PROC(ImpellerDisplayListBuilderClipPath) \
64 PROC(ImpellerDisplayListBuilderClipRect) \
65 PROC(ImpellerDisplayListBuilderClipRoundedRect) \
66 PROC(ImpellerDisplayListBuilderCreateDisplayListNew) \
67 PROC(ImpellerDisplayListBuilderDrawDashedLine) \
68 PROC(ImpellerDisplayListBuilderDrawDisplayList) \
69 PROC(ImpellerDisplayListBuilderDrawLine) \
70 PROC(ImpellerDisplayListBuilderDrawOval) \
71 PROC(ImpellerDisplayListBuilderDrawPaint) \
72 PROC(ImpellerDisplayListBuilderDrawParagraph) \
73 PROC(ImpellerDisplayListBuilderDrawPath) \
74 PROC(ImpellerDisplayListBuilderDrawRect) \
75 PROC(ImpellerDisplayListBuilderDrawRoundedRect) \
76 PROC(ImpellerDisplayListBuilderDrawRoundedRectDifference) \
77 PROC(ImpellerDisplayListBuilderDrawTexture) \
78 PROC(ImpellerDisplayListBuilderDrawTextureRect) \
79 PROC(ImpellerDisplayListBuilderGetSaveCount) \
80 PROC(ImpellerDisplayListBuilderGetTransform) \
81 PROC(ImpellerDisplayListBuilderNew) \
82 PROC(ImpellerDisplayListBuilderRelease) \
83 PROC(ImpellerDisplayListBuilderResetTransform) \
84 PROC(ImpellerDisplayListBuilderRestore) \
85 PROC(ImpellerDisplayListBuilderRestoreToCount) \
86 PROC(ImpellerDisplayListBuilderRetain) \
87 PROC(ImpellerDisplayListBuilderRotate) \
88 PROC(ImpellerDisplayListBuilderSave) \
89 PROC(ImpellerDisplayListBuilderSaveLayer) \
90 PROC(ImpellerDisplayListBuilderScale) \
91 PROC(ImpellerDisplayListBuilderSetTransform) \
92 PROC(ImpellerDisplayListBuilderTransform) \
93 PROC(ImpellerDisplayListBuilderTranslate) \
94 PROC(ImpellerDisplayListRelease) \
95 PROC(ImpellerDisplayListRetain) \
96 PROC(ImpellerGetVersion) \
97 PROC(ImpellerImageFilterCreateBlurNew) \
98 PROC(ImpellerImageFilterCreateComposeNew) \
99 PROC(ImpellerImageFilterCreateDilateNew) \
100 PROC(ImpellerImageFilterCreateErodeNew) \
101 PROC(ImpellerImageFilterCreateMatrixNew) \
102 PROC(ImpellerImageFilterRelease) \
103 PROC(ImpellerImageFilterRetain) \
104 PROC(ImpellerMaskFilterCreateBlurNew) \
105 PROC(ImpellerMaskFilterRelease) \
106 PROC(ImpellerMaskFilterRetain) \
107 PROC(ImpellerPaintNew) \
108 PROC(ImpellerPaintRelease) \
109 PROC(ImpellerPaintRetain) \
110 PROC(ImpellerPaintSetBlendMode) \
111 PROC(ImpellerPaintSetColor) \
112 PROC(ImpellerPaintSetColorFilter) \
113 PROC(ImpellerPaintSetColorSource) \
114 PROC(ImpellerPaintSetDrawStyle) \
115 PROC(ImpellerPaintSetImageFilter) \
116 PROC(ImpellerPaintSetMaskFilter) \
117 PROC(ImpellerPaintSetStrokeCap) \
118 PROC(ImpellerPaintSetStrokeJoin) \
119 PROC(ImpellerPaintSetStrokeMiter) \
120 PROC(ImpellerPaintSetStrokeWidth) \
121 PROC(ImpellerParagraphBuilderAddText) \
122 PROC(ImpellerParagraphBuilderBuildParagraphNew) \
123 PROC(ImpellerParagraphBuilderNew) \
124 PROC(ImpellerParagraphBuilderPopStyle) \
125 PROC(ImpellerParagraphBuilderPushStyle) \
126 PROC(ImpellerParagraphBuilderRelease) \
127 PROC(ImpellerParagraphBuilderRetain) \
128 PROC(ImpellerParagraphGetAlphabeticBaseline) \
129 PROC(ImpellerParagraphGetHeight) \
130 PROC(ImpellerParagraphGetIdeographicBaseline) \
131 PROC(ImpellerParagraphGetLineCount) \
132 PROC(ImpellerParagraphGetLongestLineWidth) \
133 PROC(ImpellerParagraphGetMaxIntrinsicWidth) \
134 PROC(ImpellerParagraphGetMaxWidth) \
135 PROC(ImpellerParagraphGetMinIntrinsicWidth) \
136 PROC(ImpellerParagraphRelease) \
137 PROC(ImpellerParagraphRetain) \
138 PROC(ImpellerParagraphStyleNew) \
139 PROC(ImpellerParagraphStyleRelease) \
140 PROC(ImpellerParagraphStyleRetain) \
141 PROC(ImpellerParagraphStyleSetBackground) \
142 PROC(ImpellerParagraphStyleSetFontFamily) \
143 PROC(ImpellerParagraphStyleSetFontSize) \
144 PROC(ImpellerParagraphStyleSetFontStyle) \
145 PROC(ImpellerParagraphStyleSetFontWeight) \
146 PROC(ImpellerParagraphStyleSetForeground) \
147 PROC(ImpellerParagraphStyleSetHeight) \
148 PROC(ImpellerParagraphStyleSetLocale) \
149 PROC(ImpellerParagraphStyleSetMaxLines) \
150 PROC(ImpellerParagraphStyleSetTextAlignment) \
151 PROC(ImpellerParagraphStyleSetTextDirection) \
152 PROC(ImpellerPathBuilderAddArc) \
153 PROC(ImpellerPathBuilderAddOval) \
154 PROC(ImpellerPathBuilderAddRect) \
155 PROC(ImpellerPathBuilderAddRoundedRect) \
156 PROC(ImpellerPathBuilderClose) \
157 PROC(ImpellerPathBuilderCopyPathNew) \
158 PROC(ImpellerPathBuilderCubicCurveTo) \
159 PROC(ImpellerPathBuilderLineTo) \
160 PROC(ImpellerPathBuilderMoveTo) \
161 PROC(ImpellerPathBuilderNew) \
162 PROC(ImpellerPathBuilderQuadraticCurveTo) \
163 PROC(ImpellerPathBuilderRelease) \
164 PROC(ImpellerPathBuilderRetain) \
165 PROC(ImpellerPathBuilderTakePathNew) \
166 PROC(ImpellerPathRelease) \
167 PROC(ImpellerPathRetain) \
168 PROC(ImpellerSurfaceCreateWrappedFBONew) \
169 PROC(ImpellerSurfaceDrawDisplayList) \
170 PROC(ImpellerSurfaceRelease) \
171 PROC(ImpellerSurfaceRetain) \
172 PROC(ImpellerTextureCreateWithContentsNew) \
173 PROC(ImpellerTextureCreateWithOpenGLTextureHandleNew) \
174 PROC(ImpellerTextureGetOpenGLHandle) \
175 PROC(ImpellerTextureRelease) \
176 PROC(ImpellerTextureRetain) \
177 PROC(ImpellerTypographyContextNew) \
178 PROC(ImpellerTypographyContextRegisterFont) \
179 PROC(ImpellerTypographyContextRelease) \
180 PROC(ImpellerTypographyContextRetain)
181
182 struct ProcTable {
183 bool Initialize(
184 const std::function<void*(const char* function_name)>& resolver) {
185 #define IMPELLER_HPP_PROC(proc) \
186 { \
187 proc.function = \
188 reinterpret_cast<decltype(proc.function)>(resolver(proc.name)); \
189 if (proc.function == nullptr) { \
190 return false; \
191 } \
192 }
193 IMPELLER_HPP_EACH_PROC(IMPELLER_HPP_PROC)
194 #undef IMPELLER_HPP_PROC
195 return true;
196 }
197
198 #define IMPELLER_HPP_PROC(name) Proc<decltype(name)> name = {#name, nullptr};
199 IMPELLER_HPP_EACH_PROC(IMPELLER_HPP_PROC)
200 #undef IMPELLER_HPP_PROC
201 };
202
203 extern ProcTable gGlobalProcTable;
204
205 enum class AdoptTag {
206 kAdopt,
207 };
208
209 template <class T, class Traits>
210 class Object {
211 public:
212 Object() = default;
213
214 explicit Object(T object) { Reset(object); }
215
216 Object(T object, AdoptTag) : object_(object) {}
217
218 ~Object() { Reset(); }
219
220 Object(Object&& other) { std::swap(object_, other.object_); }
221
222 Object(const Object& other) { Reset(other.Get()); }
223
224 Object& operator=(Object&& other) {
225 std::swap(object_, other.object_);
226 return *this;
227 }
228
229 Object& operator=(const Object& other) {
230 Reset(other.Get());
231 return *this;
232 }
233
234 T Get() const { return object_; }
235
236 explicit operator bool() const { return object_ != nullptr; }
237
238 private:
239 T object_ = nullptr;
240
241 void Reset(T other = nullptr) {
242 if (object_ == other) {
243 return;
244 }
245 if (object_) {
246 Traits::Release(object_);
247 object_ = nullptr;
248 }
249 if (other) {
250 Traits::Retain(other);
251 object_ = other;
252 }
253 }
254
255 [[nodiscard]] T Leak() {
256 T result = object_;
257 object_ = nullptr;
258 return result;
259 }
260 };
261
262 #define IMPELLER_HPP_DEFINE_TRAITS(object) \
263 struct object##Traits { \
264 static void Retain(object ctx) { \
265 gGlobalProcTable.object##Retain(ctx); \
266 } \
267 static void Release(object ctx) { \
268 gGlobalProcTable.object##Release(ctx); \
269 } \
270 };
271
272 IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter);
273 IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorSource);
274 IMPELLER_HPP_DEFINE_TRAITS(ImpellerContext);
275 IMPELLER_HPP_DEFINE_TRAITS(ImpellerDisplayList);
276 IMPELLER_HPP_DEFINE_TRAITS(ImpellerDisplayListBuilder);
277 IMPELLER_HPP_DEFINE_TRAITS(ImpellerImageFilter);
278 IMPELLER_HPP_DEFINE_TRAITS(ImpellerMaskFilter);
279 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPaint);
280 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraph);
281 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraphBuilder);
282 IMPELLER_HPP_DEFINE_TRAITS(ImpellerParagraphStyle);
283 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPath);
284 IMPELLER_HPP_DEFINE_TRAITS(ImpellerPathBuilder);
285 IMPELLER_HPP_DEFINE_TRAITS(ImpellerSurface);
286 IMPELLER_HPP_DEFINE_TRAITS(ImpellerTexture);
287 IMPELLER_HPP_DEFINE_TRAITS(ImpellerTypographyContext);
288
289 #undef IMPELLER_HPP_DEFINE_TRAITS
290
291 class Mapping final {
292 public:
293 Mapping(const uint8_t* mapping,
294 size_t size,
295 std::function<void()> release_callback)
296 : mapping_(mapping),
297 size_(size),
298 release_callback_(std::move(release_callback)) {}
299
300 const uint8_t* GetMapping() const { return mapping_; }
301
302 size_t GetSize() const { return size_; }
303
304 private:
305 const uint8_t* mapping_ = nullptr;
306 size_t size_ = 0u;
307 std::function<void()> release_callback_;
308 };
309
310 //------------------------------------------------------------------------------
311 /// @see ImpellerContext
312 ///
313 class Context final : public Object<ImpellerContext, ImpellerContextTraits> {
314 public:
315 Context(ImpellerContext context, AdoptTag tag) : Object(context, tag) {}
316
317 //----------------------------------------------------------------------------
318 /// @see ImpellerContextCreateOpenGLESNew
319 ///
320 static Context OpenGLES(
321 const std::function<void*(const char*)>& gl_proc_address_resolver) {
322 struct UserData {
323 std::function<void*(const char*)> resolver;
324 };
325 UserData user_data;
326 user_data.resolver = gl_proc_address_resolver;
327 ImpellerProcAddressCallback callback = [](const char* proc_name,
328 void* user_data) -> void* {
329 return reinterpret_cast<UserData*>(user_data)->resolver(proc_name);
330 };
331 return Context(
332 gGlobalProcTable.ImpellerContextCreateOpenGLESNew(IMPELLER_VERSION, //
333 callback, //
334 &user_data //
335 ),
336 AdoptTag::kAdopt);
337 }
338 };
339
340 //------------------------------------------------------------------------------
341 /// @see ImpellerTexture
342 ///
343 class Texture final : public Object<ImpellerTexture, ImpellerTextureTraits> {
344 public:
345 Texture(ImpellerTexture texture, AdoptTag adopt) : Object(texture, adopt) {}
346
347 //----------------------------------------------------------------------------
348 /// @see ImpellerTextureCreateWithContentsNew
349 ///
350 static Texture WithContents(const Context& context,
351 const ImpellerTextureDescriptor& descriptor,
352 std::unique_ptr<Mapping> mapping = nullptr) {
353 if (mapping == nullptr) {
354 mapping = std::make_unique<Mapping>(nullptr, 0u, nullptr);
355 }
356 ImpellerMapping c_mapping = {};
357 c_mapping.data = mapping->GetMapping();
358 c_mapping.length = mapping->GetSize();
359 c_mapping.on_release = [](void* user_data) -> void {
360 delete reinterpret_cast<Mapping*>(user_data);
361 };
362 return Texture(gGlobalProcTable.ImpellerTextureCreateWithContentsNew(
363 context.Get(), //
364 &descriptor, //
365 &c_mapping, //
366 mapping.release() //
367 ),
368 AdoptTag::kAdopt);
369 }
370
371 //----------------------------------------------------------------------------
372 /// @see ImpellerTextureCreateWithOpenGLTextureHandleNew
373 ///
374 static Texture WithOpenGLTexture(const Context& context,
375 const ImpellerTextureDescriptor& descriptor,
376 uint64_t handle) {
377 return Texture(
378 gGlobalProcTable.ImpellerTextureCreateWithOpenGLTextureHandleNew(
379 context.Get(), //
380 &descriptor, //
381 handle //
382 ),
383 AdoptTag::kAdopt);
384 }
385
386 uint64_t GetOpenGLHandle() const {
387 return gGlobalProcTable.ImpellerTextureGetOpenGLHandle(Get());
388 }
389 };
390
391 //------------------------------------------------------------------------------
392 /// @see ImpellerColorFilter
393 ///
394 class ColorFilter final
395 : public Object<ImpellerColorFilter, ImpellerColorFilterTraits> {
396 public:
397 ColorFilter(ImpellerColorFilter filter, AdoptTag tag) : Object(filter, tag) {}
398
399 //----------------------------------------------------------------------------
400 /// @see ImpellerColorFilterCreateBlendNew
401 ///
402 static ColorFilter Blend(const ImpellerColor& color, ImpellerBlendMode mode) {
403 return ColorFilter(
404 gGlobalProcTable.ImpellerColorFilterCreateBlendNew(&color, mode),
405 AdoptTag::kAdopt);
406 }
407
408 //----------------------------------------------------------------------------
409 /// @see ImpellerColorFilterCreateColorMatrixNew
410 ///
411 static ColorFilter Matrix(const ImpellerColorMatrix& color_matrix) {
412 return ColorFilter(
413 gGlobalProcTable.ImpellerColorFilterCreateColorMatrixNew(&color_matrix),
414 AdoptTag::kAdopt);
415 }
416 };
417
418 //------------------------------------------------------------------------------
419 /// @see ImpellerColorSource
420 ///
421 class ColorSource final
422 : public Object<ImpellerColorSource, ImpellerColorSourceTraits> {
423 public:
424 ColorSource(ImpellerColorSource source, AdoptTag tag) : Object(source, tag) {}
425
426 //----------------------------------------------------------------------------
427 /// @see ImpellerColorSourceCreateConicalGradientNew
428 ///
429 static ColorSource ConicalGradient(
430 const ImpellerPoint& start_center,
431 float start_radius,
432 const ImpellerPoint& end_center,
433 float end_radius,
434 uint32_t stop_count,
435 const ImpellerColor* colors,
436 const float* stops,
437 ImpellerTileMode tile_mode,
438 const ImpellerMatrix* transformation = nullptr) {
439 return ColorSource(
440 gGlobalProcTable.ImpellerColorSourceCreateConicalGradientNew(
441 &start_center, //
442 start_radius, //
443 &end_center, //
444 end_radius, //
445 stop_count, //
446 colors, //
447 stops, //
448 tile_mode, //
449 transformation //
450 ),
451 AdoptTag::kAdopt);
452 }
453
454 //----------------------------------------------------------------------------
455 /// @see ImpellerColorSourceCreateImageNew
456 ///
457 static ColorSource Image(const Texture& image,
458 ImpellerTileMode horizontal_tile_mode,
459 ImpellerTileMode vertical_tile_mode,
460 ImpellerTextureSampling sampling,
461 const ImpellerMatrix* transformation = nullptr) {
462 return ColorSource(gGlobalProcTable.ImpellerColorSourceCreateImageNew(
463 image.Get(), //
464 horizontal_tile_mode, //
465 vertical_tile_mode, //
466 sampling, //
467 transformation //
468 ),
469 AdoptTag::kAdopt);
470 }
471
472 //----------------------------------------------------------------------------
473 /// @see ImpellerColorSourceCreateLinearGradientNew
474 ///
475 static ColorSource LinearGradient(
476 const ImpellerPoint& start_point,
477 const ImpellerPoint& end_point,
478 uint32_t stop_count,
479 const ImpellerColor* colors,
480 const float* stops,
481 ImpellerTileMode tile_mode,
482 const ImpellerMatrix* transformation = nullptr) {
483 return ColorSource(
484 gGlobalProcTable.ImpellerColorSourceCreateLinearGradientNew(
485 &start_point,
486 &end_point, //
487 stop_count, //
488 colors, //
489 stops, //
490 tile_mode, //
491 transformation //
492 ),
493 AdoptTag::kAdopt);
494 }
495
496 //----------------------------------------------------------------------------
497 /// @see ImpellerColorSourceCreateRadialGradientNew
498 ///
499 static ColorSource RadialGradient(
500 const ImpellerPoint& center,
501 float radius,
502 uint32_t stop_count,
503 const ImpellerColor* colors,
504 const float* stops,
505 ImpellerTileMode tile_mode,
506 const ImpellerMatrix* transformation = nullptr) {
507 return ColorSource(
508 gGlobalProcTable.ImpellerColorSourceCreateRadialGradientNew(
509 &center, //
510 radius, //
511 stop_count, //
512 colors, //
513 stops, //
514 tile_mode, //
515 transformation //
516 ),
517 AdoptTag::kAdopt);
518 }
519
520 //----------------------------------------------------------------------------
521 /// @see ImpellerColorSourceCreateSweepGradientNew
522 ///
523 static ColorSource SweepGradient(
524 const ImpellerPoint& center,
525 float start,
526 float end,
527 uint32_t stop_count,
528 const ImpellerColor* colors,
529 const float* stops,
530 ImpellerTileMode tile_mode,
531 const ImpellerMatrix* transformation = nullptr) {
532 return ColorSource(
533 gGlobalProcTable.ImpellerColorSourceCreateSweepGradientNew(
534 &center, //
535 start, //
536 end, //
537 stop_count, //
538 colors, //
539 stops, //
540 tile_mode, //
541 transformation //
542 ),
543 AdoptTag::kAdopt);
544 }
545 };
546
547 //------------------------------------------------------------------------------
548 /// @see ImpellerImageFilter
549 ///
550 class ImageFilter final
551 : public Object<ImpellerImageFilter, ImpellerImageFilterTraits> {
552 public:
553 ImageFilter(ImpellerImageFilter filter, AdoptTag tag) : Object(filter, tag) {}
554
555 //----------------------------------------------------------------------------
556 /// @see ImpellerImageFilterCreateBlurNew
557 ///
558 static ImageFilter Blur(float x_sigma,
559 float y_sigma,
560 ImpellerTileMode tile_mode) {
561 return ImageFilter(gGlobalProcTable.ImpellerImageFilterCreateBlurNew(
562 x_sigma, y_sigma, tile_mode),
563 AdoptTag::kAdopt);
564 }
565
566 //----------------------------------------------------------------------------
567 /// @see ImpellerImageFilterCreateComposeNew
568 ///
569 static ImageFilter Compose(const ImageFilter& outer,
570 const ImageFilter& inner) {
571 return ImageFilter(gGlobalProcTable.ImpellerImageFilterCreateComposeNew(
572 outer.Get(), inner.Get()),
573 AdoptTag::kAdopt);
574 }
575
576 //----------------------------------------------------------------------------
577 /// @see ImpellerImageFilterCreateDilateNew
578 ///
579 static ImageFilter Dilate(float x_radius, float y_radius) {
580 return ImageFilter(
581 gGlobalProcTable.ImpellerImageFilterCreateDilateNew(x_radius, y_radius),
582 AdoptTag::kAdopt);
583 }
584
585 //----------------------------------------------------------------------------
586 /// @see ImpellerImageFilterCreateErodeNew
587 ///
588 static ImageFilter Erode(float x_radius, float y_radius) {
589 return ImageFilter(
590 gGlobalProcTable.ImpellerImageFilterCreateErodeNew(x_radius, y_radius),
591 AdoptTag::kAdopt);
592 }
593
594 //----------------------------------------------------------------------------
595 /// @see ImpellerImageFilterCreateMatrixNew
596 ///
597 static ImageFilter Matrix(const ImpellerMatrix& matrix,
598 ImpellerTextureSampling sampling) {
599 return ImageFilter(
600 gGlobalProcTable.ImpellerImageFilterCreateMatrixNew(&matrix, sampling),
601 AdoptTag::kAdopt);
602 }
603 };
604
605 //------------------------------------------------------------------------------
606 /// @see ImpellerMaskFilter
607 ///
608 class MaskFilter final
609 : public Object<ImpellerMaskFilter, ImpellerMaskFilterTraits> {
610 public:
611 MaskFilter(ImpellerMaskFilter filter, AdoptTag tag) : Object(filter, tag) {}
612
613 //----------------------------------------------------------------------------
614 /// @see ImpellerMaskFilterCreateBlurNew
615 ///
616 static MaskFilter Blur(ImpellerBlurStyle style, float sigma) {
617 return MaskFilter(
618 gGlobalProcTable.ImpellerMaskFilterCreateBlurNew(style, sigma),
619 AdoptTag::kAdopt);
620 }
621 };
622
623 //------------------------------------------------------------------------------
624 /// @see ImpellerParagraph
625 ///
626 class Paragraph final
627 : public Object<ImpellerParagraph, ImpellerParagraphTraits> {
628 public:
629 Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
630 : Object(paragraph, AdoptTag::kAdopt) {}
631
632 //----------------------------------------------------------------------------
633 /// @see ImpellerParagraphGetAlphabeticBaseline
634 ///
635 float GetAlphabeticBaseline() {
636 return gGlobalProcTable.ImpellerParagraphGetAlphabeticBaseline(Get());
637 }
638
639 //----------------------------------------------------------------------------
640 /// @see ImpellerParagraphGetHeight
641 ///
642 float GetHeight() {
643 return gGlobalProcTable.ImpellerParagraphGetHeight(Get());
644 }
645
646 //----------------------------------------------------------------------------
647 /// @see ImpellerParagraphGetIdeographicBaseline
648 ///
649 float GetIdeographicBaseline() {
650 return gGlobalProcTable.ImpellerParagraphGetIdeographicBaseline(Get());
651 }
652
653 //----------------------------------------------------------------------------
654 /// @see ImpellerParagraphGetLineCount
655 ///
656 uint32_t GetLineCount() {
657 return gGlobalProcTable.ImpellerParagraphGetLineCount(Get());
658 }
659
660 //----------------------------------------------------------------------------
661 /// @see ImpellerParagraphGetLongestLineWidth
662 ///
663 float GetLongestLineWidth() {
664 return gGlobalProcTable.ImpellerParagraphGetLongestLineWidth(Get());
665 }
666
667 //----------------------------------------------------------------------------
668 /// @see ImpellerParagraphGetMaxIntrinsicWidth
669 ///
670 float GetMaxIntrinsicWidth() {
671 return gGlobalProcTable.ImpellerParagraphGetMaxIntrinsicWidth(Get());
672 }
673
674 //----------------------------------------------------------------------------
675 /// @see ImpellerParagraphGetMaxWidth
676 ///
677 float GetMaxWidth() {
678 return gGlobalProcTable.ImpellerParagraphGetMaxWidth(Get());
679 }
680
681 //----------------------------------------------------------------------------
682 /// @see ImpellerParagraphGetMinIntrinsicWidth
683 ///
684 float GetMinIntrinsicWidth() {
685 return gGlobalProcTable.ImpellerParagraphGetMinIntrinsicWidth(Get());
686 }
687 };
688
689 //------------------------------------------------------------------------------
690 /// @see ImpellerPaint
691 ///
692 class Paint final : public Object<ImpellerPaint, ImpellerPaintTraits> {
693 public:
694 Paint() : Object(gGlobalProcTable.ImpellerPaintNew(), AdoptTag::kAdopt) {}
695
696 //----------------------------------------------------------------------------
697 /// @see ImpellerPaintSetColor
698 ///
699 Paint& SetColor(const ImpellerColor& color) {
700 gGlobalProcTable.ImpellerPaintSetColor(Get(), &color);
701 return *this;
702 }
703
704 //----------------------------------------------------------------------------
705 /// @see ImpellerPaintSetBlendMode
706 ///
707 Paint& SetBlendMode(ImpellerBlendMode mode) {
708 gGlobalProcTable.ImpellerPaintSetBlendMode(Get(), mode);
709 return *this;
710 }
711
712 //----------------------------------------------------------------------------
713 /// @see ImpellerPaintSetDrawStyle
714 ///
715 Paint& SetDrawStyle(ImpellerDrawStyle style) {
716 gGlobalProcTable.ImpellerPaintSetDrawStyle(Get(), style);
717 return *this;
718 }
719
720 //----------------------------------------------------------------------------
721 /// @see ImpellerPaintSetStrokeCap
722 ///
723 Paint& SetStrokeCap(ImpellerStrokeCap cap) {
724 gGlobalProcTable.ImpellerPaintSetStrokeCap(Get(), cap);
725 return *this;
726 }
727
728 //----------------------------------------------------------------------------
729 /// @see ImpellerPaintSetStrokeJoin
730 ///
731 Paint& SetStrokeJoin(ImpellerStrokeJoin join) {
732 gGlobalProcTable.ImpellerPaintSetStrokeJoin(Get(), join);
733 return *this;
734 }
735
736 //----------------------------------------------------------------------------
737 /// @see ImpellerPaintSetStrokeWidth
738 ///
739 Paint& SetStrokeWidth(float width) {
740 gGlobalProcTable.ImpellerPaintSetStrokeWidth(Get(), width);
741 return *this;
742 }
743
744 //----------------------------------------------------------------------------
745 /// @see ImpellerPaintSetStrokeMiter
746 ///
747 Paint& SetStrokeMiter(float miter) {
748 gGlobalProcTable.ImpellerPaintSetStrokeMiter(Get(), miter);
749 return *this;
750 }
751
752 //----------------------------------------------------------------------------
753 /// @see ImpellerPaintSetColorFilter
754 ///
755 Paint& SetColorFilter(const ColorFilter& filter) {
756 gGlobalProcTable.ImpellerPaintSetColorFilter(Get(), filter.Get());
757 return *this;
758 }
759
760 //----------------------------------------------------------------------------
761 /// @see ImpellerPaintSetColorSource
762 ///
763 Paint& SetColorSource(const ColorSource& source) {
764 gGlobalProcTable.ImpellerPaintSetColorSource(Get(), source.Get());
765 return *this;
766 }
767
768 //----------------------------------------------------------------------------
769 /// @see ImpellerPaintSetImageFilter
770 ///
771 Paint& SetImageFilter(const ImageFilter& filter) {
772 gGlobalProcTable.ImpellerPaintSetImageFilter(Get(), filter.Get());
773 return *this;
774 }
775
776 //----------------------------------------------------------------------------
777 /// @see ImpellerPaintSetMaskFilter
778 ///
779 Paint& SetMaskFilter(const MaskFilter& filter) {
780 gGlobalProcTable.ImpellerPaintSetMaskFilter(Get(), filter.Get());
781 return *this;
782 }
783 };
784
785 //------------------------------------------------------------------------------
786 /// @see ImpellerParagraphStyle
787 ///
788 class ParagraphStyle final
789 : public Object<ImpellerParagraphStyle, ImpellerParagraphStyleTraits> {
790 public:
791 ParagraphStyle()
792 : Object(gGlobalProcTable.ImpellerParagraphStyleNew(), AdoptTag::kAdopt) {
793 }
794
795 //----------------------------------------------------------------------------
796 /// @see ImpellerParagraphStyleSetBackground
797 ///
798 ParagraphStyle& SetBackground(const Paint& paint) {
799 gGlobalProcTable.ImpellerParagraphStyleSetBackground(Get(), paint.Get());
800 return *this;
801 }
802
803 //----------------------------------------------------------------------------
804 /// @see ImpellerParagraphStyleSetFontFamily
805 ///
806 ParagraphStyle& SetFontFamily(const char* family_name) {
807 gGlobalProcTable.ImpellerParagraphStyleSetFontFamily(Get(), family_name);
808 return *this;
809 }
810
811 //----------------------------------------------------------------------------
812 /// @see ImpellerParagraphStyleSetFontSize
813 ///
814 ParagraphStyle& SetFontSize(float size) {
815 gGlobalProcTable.ImpellerParagraphStyleSetFontSize(Get(), size);
816 return *this;
817 }
818
819 //----------------------------------------------------------------------------
820 /// @see ImpellerParagraphStyleSetFontStyle
821 ///
822 ParagraphStyle& SetFontStyle(ImpellerFontStyle style) {
823 gGlobalProcTable.ImpellerParagraphStyleSetFontStyle(Get(), style);
824 return *this;
825 }
826
827 //----------------------------------------------------------------------------
828 /// @see ImpellerParagraphStyleSetFontWeight
829 ///
830 ParagraphStyle& SetFontWeight(ImpellerFontWeight weight) {
831 gGlobalProcTable.ImpellerParagraphStyleSetFontWeight(Get(), weight);
832 return *this;
833 }
834
835 //----------------------------------------------------------------------------
836 /// @see ImpellerParagraphStyleSetForeground
837 ///
838 ParagraphStyle& SetForeground(const Paint& paint) {
839 gGlobalProcTable.ImpellerParagraphStyleSetForeground(Get(), paint.Get());
840 return *this;
841 }
842
843 //----------------------------------------------------------------------------
844 /// @see ImpellerParagraphStyleSetHeight
845 ///
846 ParagraphStyle& SetHeight(float height) {
847 gGlobalProcTable.ImpellerParagraphStyleSetHeight(Get(), height);
848 return *this;
849 }
850
851 //----------------------------------------------------------------------------
852 /// @see ImpellerParagraphStyleSetLocale
853 ///
854 ParagraphStyle& SetLocale(const char* locale) {
855 gGlobalProcTable.ImpellerParagraphStyleSetLocale(Get(), locale);
856 return *this;
857 }
858
859 //----------------------------------------------------------------------------
860 /// @see ImpellerParagraphStyleSetMaxLines
861 ///
862 ParagraphStyle& SetMaxLines(uint32_t max_lines) {
863 gGlobalProcTable.ImpellerParagraphStyleSetMaxLines(Get(), max_lines);
864 return *this;
865 }
866
867 //----------------------------------------------------------------------------
868 /// @see ImpellerParagraphStyleSetTextAlignment
869 ///
870 ParagraphStyle& SetTextAlignment(ImpellerTextAlignment align) {
871 gGlobalProcTable.ImpellerParagraphStyleSetTextAlignment(Get(), align);
872 return *this;
873 }
874
875 //----------------------------------------------------------------------------
876 /// @see ImpellerParagraphStyleSetTextDirection
877 ///
878 ParagraphStyle& SetTextDirection(ImpellerTextDirection direction) {
879 gGlobalProcTable.ImpellerParagraphStyleSetTextDirection(Get(), direction);
880 return *this;
881 }
882 };
883
884 //------------------------------------------------------------------------------
885 /// @see ImpellerTypographyContext
886 ///
887 class TypographyContext final : public Object<ImpellerTypographyContext,
888 ImpellerTypographyContextTraits> {
889 public:
890 TypographyContext()
891 : Object(gGlobalProcTable.ImpellerTypographyContextNew(),
892 AdoptTag::kAdopt) {}
893
894 //----------------------------------------------------------------------------
895 /// @see ImpellerTypographyContextRegisterFont
896 ///
897 bool RegisterFont(std::unique_ptr<Mapping> mapping,
898 const char* optional_family_name_alias = nullptr) {
899 if (!mapping) {
900 return false;
901 }
902 ImpellerMapping c_mapping = {};
903 c_mapping.data = mapping->GetMapping();
904 c_mapping.length = mapping->GetSize();
905 c_mapping.on_release = [](void* user_data) {
906 delete reinterpret_cast<Mapping*>(user_data);
907 };
908 return gGlobalProcTable.ImpellerTypographyContextRegisterFont(
909 Get(), //
910 &c_mapping, //
911 mapping.release(), //
912 optional_family_name_alias //
913 );
914 }
915 };
916
917 //------------------------------------------------------------------------------
918 /// @see ImpellerParagraphBuilder
919 ///
920 class ParagraphBuilder final
921 : public Object<ImpellerParagraphBuilder, ImpellerParagraphBuilderTraits> {
922 public:
923 explicit ParagraphBuilder(const TypographyContext& context)
924 : Object(gGlobalProcTable.ImpellerParagraphBuilderNew(context.Get()),
925 AdoptTag::kAdopt) {}
926
927 //----------------------------------------------------------------------------
928 /// @see ImpellerParagraphBuilderBuildParagraphNew
929 ///
930 Paragraph Build(float width) {
931 return Paragraph(
932 gGlobalProcTable.ImpellerParagraphBuilderBuildParagraphNew(Get(), //
933 width //
934 ),
935 AdoptTag::kAdopt);
936 }
937
938 //----------------------------------------------------------------------------
939 /// @see ImpellerParagraphBuilderPushStyle
940 ///
941 ParagraphBuilder& PushStyle(const ParagraphStyle& style) {
942 gGlobalProcTable.ImpellerParagraphBuilderPushStyle(Get(), style.Get());
943 return *this;
944 }
945
946 //----------------------------------------------------------------------------
947 /// @see ImpellerParagraphBuilderPopStyle
948 ///
949 ParagraphBuilder& PopStyle() {
950 gGlobalProcTable.ImpellerParagraphBuilderPopStyle(Get());
951 return *this;
952 }
953
954 //----------------------------------------------------------------------------
955 /// @see ImpellerParagraphBuilderAddText
956 ///
957 ParagraphBuilder& AddText(const uint8_t* utf8_data, uint32_t length) {
958 gGlobalProcTable.ImpellerParagraphBuilderAddText(Get(), utf8_data, length);
959 return *this;
960 }
961
962 //----------------------------------------------------------------------------
963 /// @see ImpellerParagraphBuilderAddText
964 ///
965 ParagraphBuilder& AddText(const std::string& string) {
966 return AddText(reinterpret_cast<const uint8_t*>(string.data()),
967 string.size());
968 }
969
970 //----------------------------------------------------------------------------
971 /// @see ImpellerParagraphBuilderAddText
972 ///
973 ParagraphBuilder& AddText(const std::string_view& string) {
974 return AddText(reinterpret_cast<const uint8_t*>(string.data()),
975 string.size());
976 }
977 };
978
979 //------------------------------------------------------------------------------
980 /// @see ImpellerPath
981 ///
982 class Path final : public Object<ImpellerPath, ImpellerPathTraits> {
983 public:
984 Path(ImpellerPath path, AdoptTag tag) : Object(path, tag) {}
985 };
986
987 //------------------------------------------------------------------------------
988 /// @see ImpellerPathBuilder
989 ///
990 class PathBuilder final
991 : public Object<ImpellerPathBuilder, ImpellerPathBuilderTraits> {
992 public:
993 PathBuilder()
994 : Object(gGlobalProcTable.ImpellerPathBuilderNew(), AdoptTag::kAdopt) {}
995
996 //----------------------------------------------------------------------------
997 /// @see ImpellerPathBuilderCopyPathNew
998 ///
999 Path BuildCopy(ImpellerFillType fill =
1000 ImpellerFillType::kImpellerFillTypeNonZero) const {
1001 return Path(gGlobalProcTable.ImpellerPathBuilderCopyPathNew(Get(), fill),
1002 AdoptTag::kAdopt);
1003 }
1004
1005 //----------------------------------------------------------------------------
1006 /// @see ImpellerPathBuilderTakePathNew
1007 ///
1008 Path Build(
1009 ImpellerFillType fill = ImpellerFillType::kImpellerFillTypeNonZero) {
1010 return Path(gGlobalProcTable.ImpellerPathBuilderTakePathNew(Get(), fill),
1011 AdoptTag::kAdopt);
1012 }
1013
1014 //----------------------------------------------------------------------------
1015 /// @see ImpellerPathBuilderAddArc
1016 ///
1017 PathBuilder& AddArc(const ImpellerRect& oval_bounds,
1018 float start_angle_degrees,
1019 float end_angle_degrees) {
1020 gGlobalProcTable.ImpellerPathBuilderAddArc(Get(), //
1021 &oval_bounds, //
1022 start_angle_degrees, //
1023 end_angle_degrees //
1024 );
1025 return *this;
1026 }
1027
1028 //----------------------------------------------------------------------------
1029 /// @see ImpellerPathBuilderAddOval
1030 ///
1031 PathBuilder& AddOval(const ImpellerRect& oval_bounds) {
1032 gGlobalProcTable.ImpellerPathBuilderAddOval(Get(), &oval_bounds);
1033 return *this;
1034 }
1035
1036 //----------------------------------------------------------------------------
1037 /// @see ImpellerPathBuilderAddRect
1038 ///
1039 PathBuilder& AddRect(const ImpellerRect& rect) {
1040 gGlobalProcTable.ImpellerPathBuilderAddRect(Get(), &rect);
1041 return *this;
1042 }
1043
1044 //----------------------------------------------------------------------------
1045 /// @see ImpellerPathBuilderAddRoundedRect
1046 ///
1047 PathBuilder& AddRoundedRect(const ImpellerRect& rect,
1048 const ImpellerRoundingRadii& rounding_radii) {
1049 gGlobalProcTable.ImpellerPathBuilderAddRoundedRect(Get(), &rect,
1050 &rounding_radii);
1051 return *this;
1052 }
1053
1054 //----------------------------------------------------------------------------
1055 /// @see ImpellerPathBuilderClose
1056 ///
1057 PathBuilder& Close() {
1058 gGlobalProcTable.ImpellerPathBuilderClose(Get());
1059 return *this;
1060 }
1061
1062 //----------------------------------------------------------------------------
1063 /// @see ImpellerPathBuilderCubicCurveTo
1064 ///
1065 PathBuilder& CubicCurveTo(const ImpellerPoint& control_point_1,
1066 const ImpellerPoint& control_point_2,
1067 const ImpellerPoint& end_point) {
1068 gGlobalProcTable.ImpellerPathBuilderCubicCurveTo(
1069 Get(), &control_point_1, &control_point_2, &end_point);
1070 return *this;
1071 }
1072
1073 //----------------------------------------------------------------------------
1074 /// @see ImpellerPathBuilderLineTo
1075 ///
1076 PathBuilder& LineTo(const ImpellerPoint& location) {
1077 gGlobalProcTable.ImpellerPathBuilderLineTo(Get(), &location);
1078 return *this;
1079 }
1080
1081 //----------------------------------------------------------------------------
1082 /// @see ImpellerPathBuilderMoveTo
1083 ///
1084 PathBuilder& MoveTo(const ImpellerPoint& location) {
1085 gGlobalProcTable.ImpellerPathBuilderMoveTo(Get(), &location);
1086 return *this;
1087 }
1088
1089 //----------------------------------------------------------------------------
1090 /// @see ImpellerPathBuilderQuadraticCurveTo
1091 ///
1092 PathBuilder& QuadraticCurveTo(const ImpellerPoint& control_point,
1093 const ImpellerPoint& end_point) {
1094 gGlobalProcTable.ImpellerPathBuilderQuadraticCurveTo(Get(), &control_point,
1095 &end_point);
1096 return *this;
1097 }
1098 };
1099
1100 //------------------------------------------------------------------------------
1101 /// @see ImpellerDisplayList
1102 ///
1103 class DisplayList final
1104 : public Object<ImpellerDisplayList, ImpellerDisplayListTraits> {
1105 public:
1106 DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
1107 : Object(display_list, tag) {}
1108 };
1109
1110 //------------------------------------------------------------------------------
1111 /// @see ImpellerSurface
1112 ///
1113 class Surface final : public Object<ImpellerSurface, ImpellerSurfaceTraits> {
1114 public:
1115 explicit Surface(ImpellerSurface surface) : Object(surface) {}
1116
1117 Surface(ImpellerSurface surface, AdoptTag tag) : Object(surface, tag) {}
1118
1119 //----------------------------------------------------------------------------
1120 /// @see ImpellerSurfaceCreateWrappedFBONew
1121 ///
1122 static Surface WrapFBO(const Context& context,
1123 uint64_t fbo,
1124 ImpellerPixelFormat format,
1125 const ImpellerISize& size) {
1126 return Surface(
1127 gGlobalProcTable.ImpellerSurfaceCreateWrappedFBONew(context.Get(), //
1128 fbo, //
1129 format, //
1130 &size //
1131 ),
1132 AdoptTag::kAdopt);
1133 }
1134
1135 //----------------------------------------------------------------------------
1136 /// @see ImpellerSurfaceDrawDisplayList
1137 ///
1138 bool Draw(const DisplayList& display_list) {
1139 return gGlobalProcTable.ImpellerSurfaceDrawDisplayList(Get(),
1140 display_list.Get());
1141 }
1142 };
1143
1144 //------------------------------------------------------------------------------
1145 /// @see ImpellerDisplayListBuilder
1146 ///
1147 class DisplayListBuilder final
1148 : public Object<ImpellerDisplayListBuilder,
1149 ImpellerDisplayListBuilderTraits> {
1150 public:
1151 //----------------------------------------------------------------------------
1152 /// @see ImpellerDisplayListBuilderNew
1153 ///
1154 explicit DisplayListBuilder(const ImpellerRect* cull_rect = nullptr)
1155 : Object(gGlobalProcTable.ImpellerDisplayListBuilderNew(cull_rect),
1156 AdoptTag::kAdopt) {}
1157
1158 //----------------------------------------------------------------------------
1159 /// @see ImpellerDisplayListBuilderCreateDisplayListNew
1160 ///
1161 DisplayList Build() {
1162 return DisplayList(
1163 gGlobalProcTable.ImpellerDisplayListBuilderCreateDisplayListNew(Get()),
1164 AdoptTag::kAdopt);
1165 }
1166
1167 //----------------------------------------------------------------------------
1168 /// @see ImpellerDisplayListBuilderClipOval
1169 ///
1170 DisplayListBuilder& ClipOval(const ImpellerRect& oval_bounds,
1171 ImpellerClipOperation op) {
1172 gGlobalProcTable.ImpellerDisplayListBuilderClipOval(Get(), //
1173 &oval_bounds, //
1174 op);
1175 return *this;
1176 }
1177
1178 //----------------------------------------------------------------------------
1179 /// @see ImpellerDisplayListBuilderClipPath
1180 ///
1181 DisplayListBuilder& ClipPath(const Path& path, ImpellerClipOperation op) {
1182 gGlobalProcTable.ImpellerDisplayListBuilderClipPath(Get(), //
1183 path.Get(), //
1184 op);
1185 return *this;
1186 }
1187
1188 //----------------------------------------------------------------------------
1189 /// @see ImpellerDisplayListBuilderClipRect
1190 ///
1191 DisplayListBuilder& ClipRect(const ImpellerRect& rect,
1192 ImpellerClipOperation op) {
1193 gGlobalProcTable.ImpellerDisplayListBuilderClipRect(Get(), //
1194 &rect, //
1195 op);
1196 return *this;
1197 }
1198
1199 //----------------------------------------------------------------------------
1200 /// @see ImpellerDisplayListBuilderClipRoundedRect
1201 ///
1202 DisplayListBuilder& ClipRoundedRect(const ImpellerRect& rect,
1203 const ImpellerRoundingRadii& radii,
1204 ImpellerClipOperation op) {
1205 gGlobalProcTable.ImpellerDisplayListBuilderClipRoundedRect(Get(), //
1206 &rect, //
1207 &radii, //
1208 op //
1209 );
1210 return *this;
1211 }
1212
1213 //----------------------------------------------------------------------------
1214 /// @see ImpellerDisplayListBuilderDrawDashedLine
1215 ///
1216 DisplayListBuilder& DrawDashedLine(const ImpellerPoint& from,
1217 const ImpellerPoint& to,
1218 float on_length,
1219 float off_length,
1220 const Paint& paint) {
1221 gGlobalProcTable.ImpellerDisplayListBuilderDrawDashedLine(Get(), //
1222 &from, //
1223 &to, //
1224 on_length, //
1225 off_length, //
1226 paint.Get());
1227 return *this;
1228 }
1229
1230 //----------------------------------------------------------------------------
1231 /// @see ImpellerDisplayListBuilderDrawDisplayList
1232 ///
1233 DisplayListBuilder& DrawDisplayList(const DisplayList& display_list,
1234 float opacity = 1.0f) {
1235 gGlobalProcTable.ImpellerDisplayListBuilderDrawDisplayList(
1236 Get(), display_list.Get(), opacity);
1237 return *this;
1238 }
1239
1240 //----------------------------------------------------------------------------
1241 /// @see ImpellerDisplayListBuilderDrawLine
1242 ///
1243 DisplayListBuilder& DrawLine(const ImpellerPoint& from,
1244 const ImpellerPoint& to,
1245 const Paint& paint) {
1246 gGlobalProcTable.ImpellerDisplayListBuilderDrawLine(Get(), //
1247 &from, //
1248 &to, //
1249 paint.Get() //
1250 );
1251 return *this;
1252 }
1253
1254 //----------------------------------------------------------------------------
1255 /// @see ImpellerDisplayListBuilderDrawOval
1256 ///
1257 DisplayListBuilder& DrawOval(const ImpellerRect& oval_bounds,
1258 const Paint& paint) {
1259 gGlobalProcTable.ImpellerDisplayListBuilderDrawOval(Get(), //
1260 &oval_bounds, //
1261 paint.Get() //
1262 );
1263 return *this;
1264 }
1265
1266 //----------------------------------------------------------------------------
1267 /// @see ImpellerDisplayListBuilderDrawPaint
1268 ///
1269 DisplayListBuilder& DrawPaint(const Paint& paint) {
1270 gGlobalProcTable.ImpellerDisplayListBuilderDrawPaint(Get(), paint.Get());
1271 return *this;
1272 }
1273
1274 //----------------------------------------------------------------------------
1275 /// @see ImpellerDisplayListBuilderDrawParagraph
1276 ///
1277 DisplayListBuilder& DrawParagraph(const Paragraph& paragraph,
1278 const ImpellerPoint& point) {
1279 gGlobalProcTable.ImpellerDisplayListBuilderDrawParagraph(
1280 Get(), paragraph.Get(), &point);
1281 return *this;
1282 }
1283
1284 //----------------------------------------------------------------------------
1285 /// @see ImpellerDisplayListBuilderDrawPath
1286 ///
1287 DisplayListBuilder& DrawPath(const Path& path, const Paint& paint) {
1288 gGlobalProcTable.ImpellerDisplayListBuilderDrawPath(Get(), path.Get(),
1289 paint.Get());
1290 return *this;
1291 }
1292
1293 //----------------------------------------------------------------------------
1294 /// @see ImpellerDisplayListBuilderDrawRect
1295 ///
1296 DisplayListBuilder& DrawRect(const ImpellerRect& rect, const Paint& paint) {
1297 gGlobalProcTable.ImpellerDisplayListBuilderDrawRect(Get(), &rect,
1298 paint.Get());
1299 return *this;
1300 }
1301
1302 //----------------------------------------------------------------------------
1303 /// @see ImpellerDisplayListBuilderDrawRoundedRect
1304 ///
1305 DisplayListBuilder& DrawRoundedRect(const ImpellerRect& rect,
1306 const ImpellerRoundingRadii& radii,
1307 const Paint& paint) {
1308 gGlobalProcTable.ImpellerDisplayListBuilderDrawRoundedRect(Get(), //
1309 &rect, //
1310 &radii, //
1311 paint.Get());
1312 return *this;
1313 }
1314
1315 //----------------------------------------------------------------------------
1316 /// @see ImpellerDisplayListBuilderDrawRoundedRectDifference
1317 ///
1318 DisplayListBuilder& DrawRoundedRectDifference(
1319 const ImpellerRect& outer_rect,
1320 const ImpellerRoundingRadii& outer_radii,
1321 const ImpellerRect& inner_rect,
1322 const ImpellerRoundingRadii& inner_radii,
1323 const Paint& paint) {
1324 gGlobalProcTable.ImpellerDisplayListBuilderDrawRoundedRectDifference(
1325 Get(), //
1326 &outer_rect, //
1327 &outer_radii, //
1328 &inner_rect, //
1329 &inner_radii, //
1330 paint.Get());
1331 return *this;
1332 }
1333
1334 //----------------------------------------------------------------------------
1335 /// @see ImpellerDisplayListBuilderDrawTexture
1336 ///
1337 DisplayListBuilder& DrawTexture(const Texture& texture,
1338 const ImpellerPoint& point,
1339 ImpellerTextureSampling sampling,
1340 const Paint& paint) {
1341 gGlobalProcTable.ImpellerDisplayListBuilderDrawTexture(
1342 Get(), texture.Get(), &point, sampling, paint.Get());
1343 return *this;
1344 }
1345
1346 //----------------------------------------------------------------------------
1347 /// @see ImpellerDisplayListBuilderDrawTextureRect
1348 ///
1349 DisplayListBuilder& DrawTextureRect(const Texture& texture,
1350 const ImpellerRect& src_rect,
1351 const ImpellerRect& dst_rect,
1352 ImpellerTextureSampling sampling,
1353 const Paint& paint) {
1354 gGlobalProcTable.ImpellerDisplayListBuilderDrawTextureRect(
1355 Get(), texture.Get(), //
1356 &src_rect, //
1357 &dst_rect, //
1358 sampling, //
1359 paint.Get());
1360 return *this;
1361 }
1362
1363 //----------------------------------------------------------------------------
1364 /// @see ImpellerDisplayListBuilderGetSaveCount
1365 ///
1366 uint32_t GetSaveCount() {
1367 return gGlobalProcTable.ImpellerDisplayListBuilderGetSaveCount(Get());
1368 }
1369
1370 //----------------------------------------------------------------------------
1371 /// @see ImpellerDisplayListBuilderGetTransform
1372 ///
1373 ImpellerMatrix GetTransform() {
1374 ImpellerMatrix result;
1375 gGlobalProcTable.ImpellerDisplayListBuilderGetTransform(Get(), &result);
1376 return result;
1377 }
1378
1379 //----------------------------------------------------------------------------
1380 /// @see ImpellerDisplayListBuilderResetTransform
1381 ///
1382 DisplayListBuilder& ResetTransform() {
1383 gGlobalProcTable.ImpellerDisplayListBuilderResetTransform(Get());
1384 return *this;
1385 }
1386
1387 //----------------------------------------------------------------------------
1388 /// @see ImpellerDisplayListBuilderRestore
1389 ///
1390 DisplayListBuilder& Restore() {
1391 gGlobalProcTable.ImpellerDisplayListBuilderRestore(Get());
1392 return *this;
1393 }
1394
1395 //----------------------------------------------------------------------------
1396 /// @see ImpellerDisplayListBuilderRestoreToCount
1397 ///
1398 DisplayListBuilder& RestoreToCount(uint32_t count) {
1399 gGlobalProcTable.ImpellerDisplayListBuilderRestoreToCount(Get(), //
1400 count);
1401 return *this;
1402 }
1403
1404 //----------------------------------------------------------------------------
1405 /// @see ImpellerDisplayListBuilderRotate
1406 ///
1407 DisplayListBuilder& Rotate(float angle_degrees) {
1408 gGlobalProcTable.ImpellerDisplayListBuilderRotate(Get(), //
1409 angle_degrees);
1410 return *this;
1411 }
1412
1413 //----------------------------------------------------------------------------
1414 /// @see ImpellerDisplayListBuilderSave
1415 ///
1416 DisplayListBuilder& Save() {
1417 gGlobalProcTable.ImpellerDisplayListBuilderSave(Get());
1418 return *this;
1419 }
1420
1421 //----------------------------------------------------------------------------
1422 /// @see ImpellerDisplayListBuilderSaveLayer
1423 ///
1424 DisplayListBuilder& SaveLayer(const ImpellerRect& bounds,
1425 const Paint* paint = nullptr,
1426 const ImageFilter* backdrop = nullptr) {
1427 gGlobalProcTable.ImpellerDisplayListBuilderSaveLayer(
1428 Get(), //
1429 &bounds, //
1430 paint ? paint->Get() : NULL, //
1431 backdrop ? backdrop->Get() : NULL //
1432 );
1433 return *this;
1434 }
1435
1436 //----------------------------------------------------------------------------
1437 /// @see ImpellerDisplayListBuilderScale
1438 ///
1439 DisplayListBuilder& Scale(float x_scale, float y_scale) {
1440 gGlobalProcTable.ImpellerDisplayListBuilderScale(Get(), //
1441 x_scale, //
1442 y_scale);
1443 return *this;
1444 }
1445
1446 //----------------------------------------------------------------------------
1447 /// @see ImpellerDisplayListBuilderSetTransform
1448 ///
1449 DisplayListBuilder& SetTransform(const ImpellerMatrix& transform) {
1450 gGlobalProcTable.ImpellerDisplayListBuilderSetTransform(Get(), &transform);
1451 return *this;
1452 }
1453
1454 //----------------------------------------------------------------------------
1455 /// @see ImpellerDisplayListBuilderTransform
1456 ///
1457 DisplayListBuilder& Transform(const ImpellerMatrix& transform) {
1458 gGlobalProcTable.ImpellerDisplayListBuilderTransform(Get(), &transform);
1459 return *this;
1460 }
1461
1462 //----------------------------------------------------------------------------
1463 /// @see ImpellerDisplayListBuilderTranslate
1464 ///
1465 DisplayListBuilder& Translate(float x_translation, float y_translation) {
1466 gGlobalProcTable.ImpellerDisplayListBuilderTranslate(Get(), //
1467 x_translation, //
1468 y_translation //
1469 );
1470 return *this;
1471 }
1472 };
1473
1474 } // namespace IMPELLER_HPP_NAMESPACE
1475
1476 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
ImpellerPoint
Definition: impeller.h:447
IMPELLER_HPP_NAMESPACE::Paragraph
Definition: impeller.hpp:626
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetForeground
ParagraphStyle & SetForeground(const Paint &paint)
Definition: impeller.hpp:838
IMPELLER_HPP_NAMESPACE::MaskFilter::Blur
static MaskFilter Blur(ImpellerBlurStyle style, float sigma)
Definition: impeller.hpp:616
IMPELLER_HPP_NAMESPACE::Paragraph::GetLongestLineWidth
float GetLongestLineWidth()
Definition: impeller.hpp:663
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::PushStyle
ParagraphBuilder & PushStyle(const ParagraphStyle &style)
Definition: impeller.hpp:941
IMPELLER_HPP_NAMESPACE::Texture::GetOpenGLHandle
uint64_t GetOpenGLHandle() const
Definition: impeller.hpp:386
IMPELLER_HPP_NAMESPACE::Mapping::GetMapping
const uint8_t * GetMapping() const
Definition: impeller.hpp:300
IMPELLER_HPP_NAMESPACE::ProcTable::Initialize
bool Initialize(const std::function< void *(const char *function_name)> &resolver)
Definition: impeller.hpp:183
impeller.h
IMPELLER_HPP_NAMESPACE::ColorFilter::Blend
static ColorFilter Blend(const ImpellerColor &color, ImpellerBlendMode mode)
Definition: impeller.hpp:402
ImpellerTextureDescriptor
Definition: impeller.h:553
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetHeight
ParagraphStyle & SetHeight(float height)
Definition: impeller.hpp:846
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawRoundedRect
DisplayListBuilder & DrawRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, const Paint &paint)
Definition: impeller.hpp:1305
IMPELLER_HPP_NAMESPACE::ParagraphBuilder
Definition: impeller.hpp:920
ImpellerBlurStyle
ImpellerBlurStyle
Definition: impeller.h:393
ImpellerFontStyle
ImpellerFontStyle
Definition: impeller.h:418
IMPELLER_HPP_NAMESPACE::ColorFilter
Definition: impeller.hpp:394
IMPELLER_HPP_NAMESPACE::gGlobalProcTable
ProcTable gGlobalProcTable
Definition: playground_test.cc:10
IMPELLER_HPP_NAMESPACE::DisplayListBuilder
Definition: impeller.hpp:1147
ImpellerMapping::length
uint64_t length
Definition: impeller.h:561
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetMaxLines
ParagraphStyle & SetMaxLines(uint32_t max_lines)
Definition: impeller.hpp:862
IMPELLER_HPP_NAMESPACE::Paragraph::GetHeight
float GetHeight()
Definition: impeller.hpp:642
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:475
IMPELLER_HPP_NAMESPACE::TypographyContext::TypographyContext
TypographyContext()
Definition: impeller.hpp:890
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:1318
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::ParagraphBuilder
ParagraphBuilder(const TypographyContext &context)
Definition: impeller.hpp:923
IMPELLER_HPP_NAMESPACE::Surface::Surface
Surface(ImpellerSurface surface, AdoptTag tag)
Definition: impeller.hpp:1117
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Translate
DisplayListBuilder & Translate(float x_translation, float y_translation)
Definition: impeller.hpp:1465
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Build
DisplayList Build()
Definition: impeller.hpp:1161
ImpellerClipOperation
ImpellerClipOperation
Definition: impeller.h:322
IMPELLER_HPP_NAMESPACE::Paint::SetColorFilter
Paint & SetColorFilter(const ColorFilter &filter)
Definition: impeller.hpp:755
ImpellerMapping::on_release
ImpellerCallback IMPELLER_NULLABLE on_release
Definition: impeller.h:562
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:64
ImpellerISize
Definition: impeller.h:457
IMPELLER_HPP_NAMESPACE::TypographyContext
Definition: impeller.hpp:887
IMPELLER_HPP_NAMESPACE::ImageFilter::Dilate
static ImageFilter Dilate(float x_radius, float y_radius)
Definition: impeller.hpp:579
IMPELLER_HPP_NAMESPACE::Paint::SetBlendMode
Paint & SetBlendMode(ImpellerBlendMode mode)
Definition: impeller.hpp:707
ImpellerMapping
Definition: impeller.h:559
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawOval
DisplayListBuilder & DrawOval(const ImpellerRect &oval_bounds, const Paint &paint)
Definition: impeller.hpp:1257
IMPELLER_HPP_NAMESPACE::Context::OpenGLES
static Context OpenGLES(const std::function< void *(const char *)> &gl_proc_address_resolver)
Definition: impeller.hpp:320
IMPELLER_HPP_NAMESPACE::Paint::Paint
Paint()
Definition: impeller.hpp:694
ImpellerTypographyContextNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE ImpellerTypographyContextNew()
Create a new typography contents.
Definition: impeller.cc:1119
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::SetTransform
DisplayListBuilder & SetTransform(const ImpellerMatrix &transform)
Definition: impeller.hpp:1449
ImpellerColor
Definition: impeller.h:545
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipRoundedRect
DisplayListBuilder & ClipRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, ImpellerClipOperation op)
Definition: impeller.hpp:1202
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipPath
DisplayListBuilder & ClipPath(const Path &path, ImpellerClipOperation op)
Definition: impeller.hpp:1181
IMPELLER_HPP_NAMESPACE::PathBuilder::AddRoundedRect
PathBuilder & AddRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &rounding_radii)
Definition: impeller.hpp:1047
IMPELLER_HPP_NAMESPACE::AdoptTag::kAdopt
@ kAdopt
ImpellerRect
Definition: impeller.h:440
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontWeight
ParagraphStyle & SetFontWeight(ImpellerFontWeight weight)
Definition: impeller.hpp:830
IMPELLER_HPP_NAMESPACE::Path
Definition: impeller.hpp:982
IMPELLER_HPP_NAMESPACE::PathBuilder::CubicCurveTo
PathBuilder & CubicCurveTo(const ImpellerPoint &control_point_1, const ImpellerPoint &control_point_2, const ImpellerPoint &end_point)
Definition: impeller.hpp:1065
ImpellerTileMode
ImpellerTileMode
Definition: impeller.h:386
IMPELLER_HPP_NAMESPACE::TypographyContext::RegisterFont
bool RegisterFont(std::unique_ptr< Mapping > mapping, const char *optional_family_name_alias=nullptr)
Definition: impeller.hpp:897
IMPELLER_HPP_NAMESPACE::ImageFilter::Blur
static ImageFilter Blur(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
Definition: impeller.hpp:558
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::PopStyle
ParagraphBuilder & PopStyle()
Definition: impeller.hpp:949
IMPELLER_HPP_NAMESPACE::Object::Get
T Get() const
Definition: impeller.hpp:234
IMPELLER_HPP_NAMESPACE::Proc
Definition: impeller.hpp:34
IMPELLER_HPP_EACH_PROC
#define IMPELLER_HPP_EACH_PROC(PROC)
Definition: impeller.hpp:47
IMPELLER_HPP_NAMESPACE::ColorSource
Definition: impeller.hpp:421
IMPELLER_HPP_NAMESPACE::ImageFilter::Matrix
static ImageFilter Matrix(const ImpellerMatrix &matrix, ImpellerTextureSampling sampling)
Definition: impeller.hpp:597
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::SaveLayer
DisplayListBuilder & SaveLayer(const ImpellerRect &bounds, const Paint *paint=nullptr, const ImageFilter *backdrop=nullptr)
Definition: impeller.hpp:1424
IMPELLER_HPP_NAMESPACE::ImageFilter::ImageFilter
ImageFilter(ImpellerImageFilter filter, AdoptTag tag)
Definition: impeller.hpp:553
ImpellerStrokeCap
ImpellerStrokeCap
Definition: impeller.h:365
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawPath
DisplayListBuilder & DrawPath(const Path &path, const Paint &paint)
Definition: impeller.hpp:1287
IMPELLER_HPP_NAMESPACE::PathBuilder::PathBuilder
PathBuilder()
Definition: impeller.hpp:993
IMPELLER_HPP_NAMESPACE::ProcTable
Definition: impeller.hpp:182
IMPELLER_HPP_NAMESPACE::Proc::name
const char * name
Definition: impeller.hpp:37
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Save
DisplayListBuilder & Save()
Definition: impeller.hpp:1416
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Rotate
DisplayListBuilder & Rotate(float angle_degrees)
Definition: impeller.hpp:1407
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::GetSaveCount
uint32_t GetSaveCount()
Definition: impeller.hpp:1366
IMPELLER_HPP_NAMESPACE::Paint::SetMaskFilter
Paint & SetMaskFilter(const MaskFilter &filter)
Definition: impeller.hpp:779
IMPELLER_HPP_NAMESPACE::Paragraph::GetMaxWidth
float GetMaxWidth()
Definition: impeller.hpp:677
IMPELLER_HPP_NAMESPACE::MaskFilter::MaskFilter
MaskFilter(ImpellerMaskFilter filter, AdoptTag tag)
Definition: impeller.hpp:611
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipOval
DisplayListBuilder & ClipOval(const ImpellerRect &oval_bounds, ImpellerClipOperation op)
Definition: impeller.hpp:1170
IMPELLER_HPP_NAMESPACE::Object::operator=
Object & operator=(const Object &other)
Definition: impeller.hpp:229
IMPELLER_HPP_NAMESPACE::ParagraphStyle::ParagraphStyle
ParagraphStyle()
Definition: impeller.hpp:791
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetTextDirection
ParagraphStyle & SetTextDirection(ImpellerTextDirection direction)
Definition: impeller.hpp:878
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Restore
DisplayListBuilder & Restore()
Definition: impeller.hpp:1390
ImpellerMatrix
Definition: impeller.h:472
IMPELLER_HPP_NAMESPACE::Object
Definition: impeller.hpp:210
IMPELLER_HPP_NAMESPACE::Surface::WrapFBO
static Surface WrapFBO(const Context &context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize &size)
Definition: impeller.hpp:1122
IMPELLER_HPP_NAMESPACE::ImageFilter::Compose
static ImageFilter Compose(const ImageFilter &outer, const ImageFilter &inner)
Definition: impeller.hpp:569
ImpellerPixelFormat
ImpellerPixelFormat
Definition: impeller.h:377
ImpellerRoundingRadii
Definition: impeller.h:538
IMPELLER_HPP_NAMESPACE::PathBuilder
Definition: impeller.hpp:990
IMPELLER_HPP_NAMESPACE::ImageFilter
Definition: impeller.hpp:550
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const std::string_view &string)
Definition: impeller.hpp:973
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:429
IMPELLER_HPP_NAMESPACE::Paint::SetColor
Paint & SetColor(const ImpellerColor &color)
Definition: impeller.hpp:699
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::GetTransform
ImpellerMatrix GetTransform()
Definition: impeller.hpp:1373
IMPELLER_HPP_NAMESPACE::Object::Object
Object(T object)
Definition: impeller.hpp:214
IMPELLER_HPP_NAMESPACE::Surface
Definition: impeller.hpp:1113
IMPELLER_HPP_NAMESPACE::Surface::Draw
bool Draw(const DisplayList &display_list)
Definition: impeller.hpp:1138
IMPELLER_HPP_NAMESPACE::Mapping::GetSize
size_t GetSize() const
Definition: impeller.hpp:302
IMPELLER_HPP_NAMESPACE::MaskFilter
Definition: impeller.hpp:608
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontSize
ParagraphStyle & SetFontSize(float size)
Definition: impeller.hpp:814
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:499
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:523
ImpellerStrokeJoin
ImpellerStrokeJoin
Definition: impeller.h:371
ImpellerDrawStyle
ImpellerDrawStyle
Definition: impeller.h:359
IMPELLER_HPP_NAMESPACE::Proc::operator()
auto operator()(Args &&... args) const
Definition: impeller.hpp:42
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeMiter
Paint & SetStrokeMiter(float miter)
Definition: impeller.hpp:747
ImpellerBlendMode
ImpellerBlendMode
Definition: impeller.h:327
IMPELLER_HPP_NAMESPACE::Texture::WithContents
static Texture WithContents(const Context &context, const ImpellerTextureDescriptor &descriptor, std::unique_ptr< Mapping > mapping=nullptr)
Definition: impeller.hpp:350
IMPELLER_HPP_NAMESPACE::PathBuilder::AddOval
PathBuilder & AddOval(const ImpellerRect &oval_bounds)
Definition: impeller.hpp:1031
IMPELLER_HPP_NAMESPACE::Object::Object
Object()=default
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeJoin
Paint & SetStrokeJoin(ImpellerStrokeJoin join)
Definition: impeller.hpp:731
IMPELLER_HPP_NAMESPACE::ColorFilter::Matrix
static ColorFilter Matrix(const ImpellerColorMatrix &color_matrix)
Definition: impeller.hpp:411
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:457
IMPELLER_HPP_NAMESPACE::Paint
Definition: impeller.hpp:692
IMPELLER_HPP_NAMESPACE::AdoptTag
AdoptTag
Definition: impeller.hpp:205
IMPELLER_HPP_NAMESPACE::PathBuilder::LineTo
PathBuilder & LineTo(const ImpellerPoint &location)
Definition: impeller.hpp:1076
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::RestoreToCount
DisplayListBuilder & RestoreToCount(uint32_t count)
Definition: impeller.hpp:1398
IMPELLER_HPP_NAMESPACE::Texture::WithOpenGLTexture
static Texture WithOpenGLTexture(const Context &context, const ImpellerTextureDescriptor &descriptor, uint64_t handle)
Definition: impeller.hpp:374
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ClipRect
DisplayListBuilder & ClipRect(const ImpellerRect &rect, ImpellerClipOperation op)
Definition: impeller.hpp:1191
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetBackground
ParagraphStyle & SetBackground(const Paint &paint)
Definition: impeller.hpp:798
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawTexture
DisplayListBuilder & DrawTexture(const Texture &texture, const ImpellerPoint &point, ImpellerTextureSampling sampling, const Paint &paint)
Definition: impeller.hpp:1337
IMPELLER_HPP_NAMESPACE::ColorSource::ColorSource
ColorSource(ImpellerColorSource source, AdoptTag tag)
Definition: impeller.hpp:424
IMPELLER_HPP_NAMESPACE::Object::Object
Object(T object, AdoptTag)
Definition: impeller.hpp:216
IMPELLER_HPP_NAMESPACE::Context::Context
Context(ImpellerContext context, AdoptTag tag)
Definition: impeller.hpp:315
IMPELLER_HPP_NAMESPACE::Proc::FunctionType
T FunctionType
Definition: impeller.hpp:35
IMPELLER_HPP_NAMESPACE::Object::~Object
~Object()
Definition: impeller.hpp:218
IMPELLER_HPP_NAMESPACE::Object::operator=
Object & operator=(Object &&other)
Definition: impeller.hpp:224
ImpellerDisplayListBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE ImpellerDisplayListBuilderNew(const ImpellerRect *IMPELLER_NULLABLE cull_rect)
Create a new display list builder.
IMPELLER_VERSION
#define IMPELLER_VERSION
Definition: impeller.h:101
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Scale
DisplayListBuilder & Scale(float x_scale, float y_scale)
Definition: impeller.hpp:1439
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawParagraph
DisplayListBuilder & DrawParagraph(const Paragraph &paragraph, const ImpellerPoint &point)
Definition: impeller.hpp:1277
IMPELLER_HPP_NAMESPACE::DisplayList::DisplayList
DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
Definition: impeller.hpp:1106
IMPELLER_MAKE_VERSION
#define IMPELLER_MAKE_VERSION(variant, major, minor, patch)
Pack a version in a uint32_t.
Definition: impeller.h:77
IMPELLER_HPP_NAMESPACE::ParagraphStyle
Definition: impeller.hpp:788
IMPELLER_HPP_NAMESPACE::Path::Path
Path(ImpellerPath path, AdoptTag tag)
Definition: impeller.hpp:984
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const std::string &string)
Definition: impeller.hpp:965
ImpellerTextDirection
ImpellerTextDirection
Definition: impeller.h:432
IMPELLER_HPP_NAMESPACE::Paint::SetDrawStyle
Paint & SetDrawStyle(ImpellerDrawStyle style)
Definition: impeller.hpp:715
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeWidth
Paint & SetStrokeWidth(float width)
Definition: impeller.hpp:739
IMPELLER_HPP_NAMESPACE::Object::Object
Object(const Object &other)
Definition: impeller.hpp:222
ImpellerTextureSampling
ImpellerTextureSampling
Definition: impeller.h:381
std
Definition: comparable.h:95
IMPELLER_HPP_NAMESPACE::PathBuilder::Close
PathBuilder & Close()
Definition: impeller.hpp:1057
IMPELLER_HPP_NAMESPACE::IMPELLER_HPP_DEFINE_TRAITS
IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter)
ImpellerPaintNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE ImpellerPaintNew()
Create a new paint with default values.
Definition: impeller.cc:340
IMPELLER_HPP_PROC
#define IMPELLER_HPP_PROC(proc)
Definition: impeller.hpp:198
IMPELLER_HPP_NAMESPACE::Object::Object
Object(Object &&other)
Definition: impeller.hpp:220
IMPELLER_HPP_NAMESPACE::PathBuilder::MoveTo
PathBuilder & MoveTo(const ImpellerPoint &location)
Definition: impeller.hpp:1084
ImpellerPathBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE ImpellerPathBuilderNew()
Create a new path builder. Paths themselves are immutable. A builder builds these immutable paths.
Definition: impeller.cc:212
IMPELLER_HPP_NAMESPACE::PathBuilder::AddArc
PathBuilder & AddArc(const ImpellerRect &oval_bounds, float start_angle_degrees, float end_angle_degrees)
Definition: impeller.hpp:1017
ImpellerParagraphStyleNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE ImpellerParagraphStyleNew()
Create a new paragraph style.
Definition: impeller.cc:915
IMPELLER_HPP_NAMESPACE::ColorFilter::ColorFilter
ColorFilter(ImpellerColorFilter filter, AdoptTag tag)
Definition: impeller.hpp:397
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::Transform
DisplayListBuilder & Transform(const ImpellerMatrix &transform)
Definition: impeller.hpp:1457
kImpellerFillTypeNonZero
@ kImpellerFillTypeNonZero
Definition: impeller.h:318
IMPELLER_HPP_NAMESPACE::Paragraph::GetMinIntrinsicWidth
float GetMinIntrinsicWidth()
Definition: impeller.hpp:684
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawRect
DisplayListBuilder & DrawRect(const ImpellerRect &rect, const Paint &paint)
Definition: impeller.hpp:1296
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawDisplayList
DisplayListBuilder & DrawDisplayList(const DisplayList &display_list, float opacity=1.0f)
Definition: impeller.hpp:1233
IMPELLER_HPP_NAMESPACE::Paragraph::GetLineCount
uint32_t GetLineCount()
Definition: impeller.hpp:656
IMPELLER_HPP_NAMESPACE::Mapping
Definition: impeller.hpp:291
ImpellerFillType
ImpellerFillType
Definition: impeller.h:317
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontFamily
ParagraphStyle & SetFontFamily(const char *family_name)
Definition: impeller.hpp:806
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:1349
IMPELLER_HPP_NAMESPACE::PathBuilder::AddRect
PathBuilder & AddRect(const ImpellerRect &rect)
Definition: impeller.hpp:1039
IMPELLER_HPP_NAMESPACE::Paragraph::GetAlphabeticBaseline
float GetAlphabeticBaseline()
Definition: impeller.hpp:635
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawLine
DisplayListBuilder & DrawLine(const ImpellerPoint &from, const ImpellerPoint &to, const Paint &paint)
Definition: impeller.hpp:1243
ImpellerParagraphBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context)
Create a new paragraph builder.
ImpellerFontWeight
ImpellerFontWeight
Definition: impeller.h:406
IMPELLER_HPP_NAMESPACE::Paragraph::Paragraph
Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
Definition: impeller.hpp:629
IMPELLER_HPP_NAMESPACE::Paint::SetStrokeCap
Paint & SetStrokeCap(ImpellerStrokeCap cap)
Definition: impeller.hpp:723
IMPELLER_HPP_NAMESPACE::Paint::SetColorSource
Paint & SetColorSource(const ColorSource &source)
Definition: impeller.hpp:763
ImpellerMapping::data
const uint8_t *IMPELLER_NONNULL data
Definition: impeller.h:560
IMPELLER_HPP_NAMESPACE::DisplayList
Definition: impeller.hpp:1103
IMPELLER_HPP_NAMESPACE::Paragraph::GetIdeographicBaseline
float GetIdeographicBaseline()
Definition: impeller.hpp:649
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DrawPaint
DisplayListBuilder & DrawPaint(const Paint &paint)
Definition: impeller.hpp:1269
IMPELLER_HPP_NAMESPACE::ImageFilter::Erode
static ImageFilter Erode(float x_radius, float y_radius)
Definition: impeller.hpp:588
IMPELLER_HPP_NAMESPACE::PathBuilder::QuadraticCurveTo
PathBuilder & QuadraticCurveTo(const ImpellerPoint &control_point, const ImpellerPoint &end_point)
Definition: impeller.hpp:1092
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetTextAlignment
ParagraphStyle & SetTextAlignment(ImpellerTextAlignment align)
Definition: impeller.hpp:870
ImpellerProcAddressCallback
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:310
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const ImpellerRect *cull_rect=nullptr)
Definition: impeller.hpp:1154
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetLocale
ParagraphStyle & SetLocale(const char *locale)
Definition: impeller.hpp:854
IMPELLER_HPP_NAMESPACE::Texture
Definition: impeller.hpp:343
IMPELLER_HPP_NAMESPACE::ParagraphStyle::SetFontStyle
ParagraphStyle & SetFontStyle(ImpellerFontStyle style)
Definition: impeller.hpp:822
ImpellerColorMatrix
Definition: impeller.h:534
IMPELLER_HPP_NAMESPACE::Paint::SetImageFilter
Paint & SetImageFilter(const ImageFilter &filter)
Definition: impeller.hpp:771
ImpellerTextAlignment
ImpellerTextAlignment
Definition: impeller.h:423
IMPELLER_HPP_NAMESPACE::Mapping::Mapping
Mapping(const uint8_t *mapping, size_t size, std::function< void()> release_callback)
Definition: impeller.hpp:293
IMPELLER_HPP_NAMESPACE::DisplayListBuilder::ResetTransform
DisplayListBuilder & ResetTransform()
Definition: impeller.hpp:1382
IMPELLER_HPP_NAMESPACE::PathBuilder::Build
Path Build(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero)
Definition: impeller.hpp:1008
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::AddText
ParagraphBuilder & AddText(const uint8_t *utf8_data, uint32_t length)
Definition: impeller.hpp:957
IMPELLER_HPP_NAMESPACE
Definition: impeller.hpp:31
IMPELLER_HPP_NAMESPACE::Texture::Texture
Texture(ImpellerTexture texture, AdoptTag adopt)
Definition: impeller.hpp:345
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:1216
IMPELLER_HPP_NAMESPACE::Surface::Surface
Surface(ImpellerSurface surface)
Definition: impeller.hpp:1115
IMPELLER_HPP_NAMESPACE::Context
Definition: impeller.hpp:313
IMPELLER_HPP_NAMESPACE::ParagraphBuilder::Build
Paragraph Build(float width)
Definition: impeller.hpp:930
IMPELLER_HPP_NAMESPACE::PathBuilder::BuildCopy
Path BuildCopy(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero) const
Definition: impeller.hpp:999
IMPELLER_HPP_NAMESPACE::Paragraph::GetMaxIntrinsicWidth
float GetMaxIntrinsicWidth()
Definition: impeller.hpp:670