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