| Flutter Impeller |

impeller.h
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_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_H_
7
8 // NOLINTBEGIN(google-objc-function-naming)
9
10 #include <stdbool.h>
11 #include <stddef.h>
12 #include <stdint.h>
13
14 ///-----------------------------------------------------------------------------
15 ///-----------------------------------------------------------------------------
16 /// ------- ___ _ _ _ ____ ___ --------
17 /// ------- |_ _|_ __ ___ _ __ ___| | | ___ _ __ / \ | _ \_ _| --------
18 /// ------- | || '_ ` _ \| '_ \ / _ \ | |/ _ \ '__| / _ \ | |_) | | --------
19 /// ------- | || | | | | | |_) | __/ | | __/ | / ___ \| __/| | --------
20 /// ------- |___|_| |_| |_| .__/ \___|_|_|\___|_| /_/ \_\_| |___| --------
21 /// ------- |_| --------
22 ///-----------------------------------------------------------------------------
23 ///-----------------------------------------------------------------------------
24 ///
25 /// This file describes a high-level, single-header, dependency-free, 2D
26 /// graphics API.
27 ///
28 /// The API fundamentals that include details about the object model, reference
29 /// counting, and null-safety are described in the README.
30 ///
31 #if defined(__cplusplus)
32 #define IMPELLER_EXTERN_C extern "C"
33 #define IMPELLER_EXTERN_C_BEGIN IMPELLER_EXTERN_C {
34 #define IMPELLER_EXTERN_C_END }
35 #else // defined(__cplusplus)
36 #define IMPELLER_EXTERN_C
37 #define IMPELLER_EXTERN_C_BEGIN
38 #define IMPELLER_EXTERN_C_END
39 #endif // defined(__cplusplus)
40
41 #ifdef _WIN32
42 #define IMPELLER_EXPORT_DECORATION __declspec(dllexport)
43 #else
44 #define IMPELLER_EXPORT_DECORATION __attribute__((visibility("default")))
45 #endif
46
47 #ifndef IMPELLER_NO_EXPORT
48 #define IMPELLER_EXPORT IMPELLER_EXPORT_DECORATION
49 #else // IMPELLER_NO_EXPORT
50 #define IMPELLER_EXPORT
51 #endif // IMPELLER_NO_EXPORT
52
53 #ifdef __clang__
54 #define IMPELLER_NULLABLE _Nullable
55 #define IMPELLER_NONNULL _Nonnull
56 #else // __clang__
57 #define IMPELLER_NULLABLE
58 #define IMPELLER_NONNULL
59 #endif // __clang__
60
61 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
62 #define IMPELLER_NODISCARD [[nodiscard]]
63 #else // defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
64 #define IMPELLER_NODISCARD
65 #endif // defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
66
67 IMPELLER_EXTERN_C_BEGIN
68
69 //------------------------------------------------------------------------------
70 /// @brief Pack a version in a uint32_t.
71 ///
72 /// @param[in] variant The version variant.
73 /// @param[in] major The major version.
74 /// @param[in] minor The minor version.
75 /// @param[in] patch The patch version.
76 ///
77 /// @return The packed version number.
78 ///
79 #define IMPELLER_MAKE_VERSION(variant, major, minor, patch) \
80 ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | \
81 (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch)))
82
83 #define IMPELLER_VERSION_VARIANT 1
84 #define IMPELLER_VERSION_MAJOR 1
85 #define IMPELLER_VERSION_MINOR 3
86 #define IMPELLER_VERSION_PATCH 0
87
88 //------------------------------------------------------------------------------
89 /// The current Impeller API version.
90 ///
91 /// This version must be passed to APIs that create top-level objects like
92 /// graphics contexts. Construction of the context may fail if the API version
93 /// expected by the caller is not supported by the library.
94 ///
95 /// The version currently supported by the library is returned by a call to
96 /// `ImpellerGetVersion`
97 ///
98 /// Since there are no API stability guarantees today, passing a version that is
99 /// different to the one returned by `ImpellerGetVersion` will always fail.
100 ///
101 /// @see `ImpellerGetVersion`
102 ///
103 #define IMPELLER_VERSION \
104 IMPELLER_MAKE_VERSION(IMPELLER_VERSION_VARIANT, IMPELLER_VERSION_MAJOR, \
105 IMPELLER_VERSION_MINOR, IMPELLER_VERSION_PATCH)
106
107 //------------------------------------------------------------------------------
108 /// @param[in] version The packed version.
109 ///
110 /// @return The version variant.
111 ///
112 #define IMPELLER_VERSION_GET_VARIANT(version) ((uint32_t)(version) >> 29U)
113
114 //------------------------------------------------------------------------------
115 /// @param[in] version The packed version.
116 ///
117 /// @return The major version.
118 ///
119 #define IMPELLER_VERSION_GET_MAJOR(version) \
120 (((uint32_t)(version) >> 22U) & 0x7FU)
121
122 //------------------------------------------------------------------------------
123 /// @param[in] version The packed version.
124 ///
125 /// @return The minor version.
126 ///
127 #define IMPELLER_VERSION_GET_MINOR(version) \
128 (((uint32_t)(version) >> 12U) & 0x3FFU)
129
130 //------------------------------------------------------------------------------
131 /// @param[in] version The packed version.
132 ///
133 /// @return The patch version.
134 ///
135 #define IMPELLER_VERSION_GET_PATCH(version) ((uint32_t)(version) & 0xFFFU)
136
137 //------------------------------------------------------------------------------
138 // Handles
139 //------------------------------------------------------------------------------
140
141 #define IMPELLER_INTERNAL_HANDLE_NAME(handle) handle##_
142 #define IMPELLER_DEFINE_HANDLE(handle) \
143 typedef struct IMPELLER_INTERNAL_HANDLE_NAME(handle) * handle;
144
145 //------------------------------------------------------------------------------
146 /// An Impeller graphics context. Contexts are platform and client-rendering-API
147 /// specific.
148 ///
149 /// Contexts are thread-safe objects that are expensive to create. Most
150 /// applications will only ever create a single context during their lifetimes.
151 /// Once setup, Impeller is ready to render frames as performantly as possible.
152 ///
153 /// During setup, context create the underlying graphics pipelines, allocators,
154 /// worker threads, etc...
155 ///
156 /// The general guidance is to create as few contexts as possible (typically
157 /// just one) and share them as much as possible.
158 ///
159 IMPELLER_DEFINE_HANDLE(ImpellerContext);
160
161 //------------------------------------------------------------------------------
162 /// Display lists represent encoded rendering intent. These objects are
163 /// immutable, reusable, thread-safe, and context-agnostic.
164 ///
165 /// While it is perfectly fine to create new display lists per frame, there may
166 /// be opportunities for optimization when display lists are reused multiple
167 /// times.
168 ///
169 IMPELLER_DEFINE_HANDLE(ImpellerDisplayList);
170
171 //------------------------------------------------------------------------------
172 /// Display list builders allow for the incremental creation of display lists.
173 ///
174 /// Display list builders are context-agnostic.
175 ///
176 IMPELLER_DEFINE_HANDLE(ImpellerDisplayListBuilder);
177
178 //------------------------------------------------------------------------------
179 /// Paints control the behavior of draw calls encoded in a display list.
180 ///
181 /// Like display lists, paints are context-agnostic.
182 ///
183 IMPELLER_DEFINE_HANDLE(ImpellerPaint);
184
185 //------------------------------------------------------------------------------
186 /// Color filters are functions that take two colors and mix them to produce a
187 /// single color. This color is then merged with the destination during
188 /// blending.
189 ///
190 IMPELLER_DEFINE_HANDLE(ImpellerColorFilter);
191
192 //------------------------------------------------------------------------------
193 /// Color sources are functions that generate colors for each texture element
194 /// covered by a draw call. The colors for each element can be generated using a
195 /// mathematical function (to produce gradients for example) or sampled from a
196 /// texture.
197 ///
198 IMPELLER_DEFINE_HANDLE(ImpellerColorSource);
199
200 //------------------------------------------------------------------------------
201 /// Image filters are functions that are applied regions of a texture to produce
202 /// a single color. Contrast this with color filters that operate independently
203 /// on a per-pixel basis. The generated color is then merged with the
204 /// destination during blending.
205 ///
206 IMPELLER_DEFINE_HANDLE(ImpellerImageFilter);
207
208 //------------------------------------------------------------------------------
209 /// Mask filters are functions that are applied over a shape after it has been
210 /// drawn but before it has been blended into the final image.
211 ///
212 IMPELLER_DEFINE_HANDLE(ImpellerMaskFilter);
213
214 //------------------------------------------------------------------------------
215 /// Typography contexts allow for the layout and rendering of text.
216 ///
217 /// These are typically expensive to create and applications will only ever need
218 /// to create a single one of these during their lifetimes.
219 ///
220 /// Unlike graphics context, typograhy contexts are not thread-safe. These must
221 /// be created, used, and collected on a single thread.
222 ///
223 IMPELLER_DEFINE_HANDLE(ImpellerTypographyContext);
224
225 //------------------------------------------------------------------------------
226 /// An immutable, fully laid out paragraph.
227 ///
228 IMPELLER_DEFINE_HANDLE(ImpellerParagraph);
229
230 //------------------------------------------------------------------------------
231 /// Paragraph builders allow for the creation of fully laid out paragraphs
232 /// (which themselves are immutable).
233 ///
234 /// To build a paragraph, users push/pop paragraph styles onto a stack then add
235 /// UTF-8 encoded text. The properties on the top of paragraph style stack when
236 /// the text is added are used to layout and shape that subset of the paragraph.
237 ///
238 /// @see `ImpellerParagraphStyle`
239 ///
240 IMPELLER_DEFINE_HANDLE(ImpellerParagraphBuilder);
241
242 //------------------------------------------------------------------------------
243 /// Specified when building a paragraph, paragraph styles are managed in a stack
244 /// with specify text properties to apply to text that is added to the paragraph
245 /// builder.
246 ///
247 IMPELLER_DEFINE_HANDLE(ImpellerParagraphStyle);
248
249 //------------------------------------------------------------------------------
250 /// Describes the metrics of lines in a fully laid out paragraph.
251 ///
252 /// Regardless of how the string of text is specified to the paragraph builder,
253 /// offsets into buffers that are returned by line metrics are always assumed to
254 /// be into buffers of UTF-16 code units.
255 ///
256 IMPELLER_DEFINE_HANDLE(ImpellerLineMetrics);
257
258 //------------------------------------------------------------------------------
259 /// Describes the metrics of glyphs in a paragraph line.
260 ///
261 IMPELLER_DEFINE_HANDLE(ImpellerGlyphInfo);
262
263 //------------------------------------------------------------------------------
264 /// Represents a two-dimensional path that is immutable and graphics context
265 /// agnostic.
266 ///
267 /// Paths in Impeller consist of linear, cubic Bézier curve, and quadratic
268 /// Bézier curve segments. All other shapes are approximations using these
269 /// building blocks.
270 ///
271 /// Paths are created using path builder that allow for the configuration of the
272 /// path segments, how they are filled, and/or stroked.
273 ///
274 IMPELLER_DEFINE_HANDLE(ImpellerPath);
275
276 //------------------------------------------------------------------------------
277 /// Path builders allow for the incremental building up of paths.
278 ///
279 IMPELLER_DEFINE_HANDLE(ImpellerPathBuilder);
280
281 //------------------------------------------------------------------------------
282 /// A surface represents a render target for Impeller to direct the rendering
283 /// intent specified the form of display lists to.
284 ///
285 /// Render targets are how Impeller API users perform Window System Integration
286 /// (WSI). Users wrap swapchain images as surfaces and draw display lists onto
287 /// these surfaces to present content.
288 ///
289 /// Creating surfaces is typically platform and client-rendering-API specific.
290 ///
291 IMPELLER_DEFINE_HANDLE(ImpellerSurface);
292
293 //------------------------------------------------------------------------------
294 /// A reference to a texture whose data is resident on the GPU. These can be
295 /// referenced in draw calls and paints.
296 ///
297 /// Creating textures is extremely expensive. Creating a single one can
298 /// typically comfortably blow the frame budget of an application. Textures
299 /// should be created on background threads.
300 ///
301 /// @warning While textures themselves are thread safe, some context types
302 /// (like OpenGL) may need extra configuration to be able to operate
303 /// from multiple threads.
304 ///
305 IMPELLER_DEFINE_HANDLE(ImpellerTexture);
306
307 //------------------------------------------------------------------------------
308 /// The primary form of WSI when using a Vulkan context, these swapchains use
309 /// the `VK_KHR_surface` Vulkan extension.
310 ///
311 /// Creating a swapchain is extremely expensive. One must be created at
312 /// application startup and re-used throughout the application lifecycle.
313 ///
314 /// Swapchains are resilient to the underlying surfaces being resized. The
315 /// swapchain images will be re-created as necessary on-demand.
316 ///
317 IMPELLER_DEFINE_HANDLE(ImpellerVulkanSwapchain);
318
319 //------------------------------------------------------------------------------
320 // Signatures
321 //------------------------------------------------------------------------------
322
323 //------------------------------------------------------------------------------
324 /// A callback invoked by Impeller that passes a user supplied baton back to the
325 /// user. Impeller does not interpret the baton in any way. The way the baton is
326 /// specified and the thread on which the callback is invoked depends on how the
327 /// user supplies the callback to Impeller.
328 ///
329 typedef void (*ImpellerCallback)(void* IMPELLER_NULLABLE user_data);
330
331 //------------------------------------------------------------------------------
332 /// A callback used by Impeller to allow the user to resolve function pointers.
333 /// A user supplied baton that is uninterpreted by Impeller is passed back to
334 /// the user in the callback. How the baton is specified to Impeller and the
335 /// thread on which the callback is invoked depends on how the callback is
336 /// specified to Impeller.
337 ///
338 typedef void* IMPELLER_NULLABLE (*ImpellerProcAddressCallback)(
339 const char* IMPELLER_NONNULL proc_name,
340 void* IMPELLER_NULLABLE user_data);
341
342 //------------------------------------------------------------------------------
343 /// A callback used by Impeller to allow the user to resolve Vulkan function
344 /// pointers. A user supplied baton that is uninterpreted by Impeller is passed
345 /// back to the user in the callback.
346 ///
347 typedef void* IMPELLER_NULLABLE (*ImpellerVulkanProcAddressCallback)(
348 void* IMPELLER_NULLABLE vulkan_instance,
349 const char* IMPELLER_NONNULL vulkan_proc_name,
350 void* IMPELLER_NULLABLE user_data);
351
352 //------------------------------------------------------------------------------
353 // Enumerations
354 // -----------------------------------------------------------------------------
355 typedef enum ImpellerFillType {
356 kImpellerFillTypeNonZero,
357 kImpellerFillTypeOdd,
358 } ImpellerFillType;
359
360 typedef enum ImpellerClipOperation {
361 kImpellerClipOperationDifference,
362 kImpellerClipOperationIntersect,
363 } ImpellerClipOperation;
364
365 typedef enum ImpellerBlendMode {
366 kImpellerBlendModeClear,
367 kImpellerBlendModeSource,
368 kImpellerBlendModeDestination,
369 kImpellerBlendModeSourceOver,
370 kImpellerBlendModeDestinationOver,
371 kImpellerBlendModeSourceIn,
372 kImpellerBlendModeDestinationIn,
373 kImpellerBlendModeSourceOut,
374 kImpellerBlendModeDestinationOut,
375 kImpellerBlendModeSourceATop,
376 kImpellerBlendModeDestinationATop,
377 kImpellerBlendModeXor,
378 kImpellerBlendModePlus,
379 kImpellerBlendModeModulate,
380 kImpellerBlendModeScreen,
381 kImpellerBlendModeOverlay,
382 kImpellerBlendModeDarken,
383 kImpellerBlendModeLighten,
384 kImpellerBlendModeColorDodge,
385 kImpellerBlendModeColorBurn,
386 kImpellerBlendModeHardLight,
387 kImpellerBlendModeSoftLight,
388 kImpellerBlendModeDifference,
389 kImpellerBlendModeExclusion,
390 kImpellerBlendModeMultiply,
391 kImpellerBlendModeHue,
392 kImpellerBlendModeSaturation,
393 kImpellerBlendModeColor,
394 kImpellerBlendModeLuminosity,
395 } ImpellerBlendMode;
396
397 typedef enum ImpellerDrawStyle {
398 kImpellerDrawStyleFill,
399 kImpellerDrawStyleStroke,
400 kImpellerDrawStyleStrokeAndFill,
401 } ImpellerDrawStyle;
402
403 typedef enum ImpellerStrokeCap {
404 kImpellerStrokeCapButt,
405 kImpellerStrokeCapRound,
406 kImpellerStrokeCapSquare,
407 } ImpellerStrokeCap;
408
409 typedef enum ImpellerStrokeJoin {
410 kImpellerStrokeJoinMiter,
411 kImpellerStrokeJoinRound,
412 kImpellerStrokeJoinBevel,
413 } ImpellerStrokeJoin;
414
415 typedef enum ImpellerPixelFormat {
416 kImpellerPixelFormatRGBA8888,
417 } ImpellerPixelFormat;
418
419 typedef enum ImpellerTextureSampling {
420 kImpellerTextureSamplingNearestNeighbor,
421 kImpellerTextureSamplingLinear,
422 } ImpellerTextureSampling;
423
424 typedef enum ImpellerTileMode {
425 kImpellerTileModeClamp,
426 kImpellerTileModeRepeat,
427 kImpellerTileModeMirror,
428 kImpellerTileModeDecal,
429 } ImpellerTileMode;
430
431 typedef enum ImpellerBlurStyle {
432 kImpellerBlurStyleNormal,
433 kImpellerBlurStyleSolid,
434 kImpellerBlurStyleOuter,
435 kImpellerBlurStyleInner,
436 } ImpellerBlurStyle;
437
438 typedef enum ImpellerColorSpace {
439 kImpellerColorSpaceSRGB,
440 kImpellerColorSpaceExtendedSRGB,
441 kImpellerColorSpaceDisplayP3,
442 } ImpellerColorSpace;
443
444 typedef enum ImpellerFontWeight {
445 kImpellerFontWeight100, // Thin
446 kImpellerFontWeight200, // Extra-Light
447 kImpellerFontWeight300, // Light
448 kImpellerFontWeight400, // Normal/Regular
449 kImpellerFontWeight500, // Medium
450 kImpellerFontWeight600, // Semi-bold
451 kImpellerFontWeight700, // Bold
452 kImpellerFontWeight800, // Extra-Bold
453 kImpellerFontWeight900, // Black
454 } ImpellerFontWeight;
455
456 typedef enum ImpellerFontStyle {
457 kImpellerFontStyleNormal,
458 kImpellerFontStyleItalic,
459 } ImpellerFontStyle;
460
461 typedef enum ImpellerTextAlignment {
462 kImpellerTextAlignmentLeft,
463 kImpellerTextAlignmentRight,
464 kImpellerTextAlignmentCenter,
465 kImpellerTextAlignmentJustify,
466 kImpellerTextAlignmentStart,
467 kImpellerTextAlignmentEnd,
468 } ImpellerTextAlignment;
469
470 typedef enum ImpellerTextDirection {
471 kImpellerTextDirectionRTL,
472 kImpellerTextDirectionLTR,
473 } ImpellerTextDirection;
474
475 //------------------------------------------------------------------------------
476 // Non-opaque structs
477 // -----------------------------------------------------------------------------
478 typedef struct ImpellerRect {
479 float x;
480 float y;
481 float width;
482 float height;
483 } ImpellerRect;
484
485 typedef struct ImpellerPoint {
486 float x;
487 float y;
488 } ImpellerPoint;
489
490 typedef struct ImpellerSize {
491 float width;
492 float height;
493 } ImpellerSize;
494
495 typedef struct ImpellerISize {
496 int64_t width;
497 int64_t height;
498 } ImpellerISize;
499
500 typedef struct ImpellerRange {
501 uint64_t start;
502 uint64_t end;
503 } ImpellerRange;
504
505 //------------------------------------------------------------------------------
506 /// A 4x4 transformation matrix using column-major storage.
507 ///
508 /// ```
509 /// | m[0] m[4] m[8] m[12] |
510 /// | m[1] m[5] m[9] m[13] |
511 /// | m[2] m[6] m[10] m[14] |
512 /// | m[3] m[7] m[11] m[15] |
513 /// ```
514 ///
515 typedef struct ImpellerMatrix {
516 float m[16];
517 } ImpellerMatrix;
518
519 //------------------------------------------------------------------------------
520 /// A 4x5 matrix using row-major storage used for transforming color values.
521 ///
522 /// To transform color values, a 5x5 matrix is constructed with the 5th row
523 /// being identity. Then the following transformation is performed:
524 ///
525 /// ```
526 /// | R' | | m[0] m[1] m[2] m[3] m[4] | | R |
527 /// | G' | | m[5] m[6] m[7] m[8] m[9] | | G |
528 /// | B' | = | m[10] m[11] m[12] m[13] m[14] | * | B |
529 /// | A' | | m[15] m[16] m[17] m[18] m[19] | | A |
530 /// | 1 | | 0 0 0 0 1 | | 1 |
531 /// ```
532 ///
533 /// The translation column (m[4], m[9], m[14], m[19]) must be specified in
534 /// non-normalized 8-bit unsigned integer space (0 to 255). Values outside this
535 /// range will produce undefined results.
536 ///
537 /// The identity transformation is thus:
538 ///
539 /// ```
540 /// 1, 0, 0, 0, 0,
541 /// 0, 1, 0, 0, 0,
542 /// 0, 0, 1, 0, 0,
543 /// 0, 0, 0, 1, 0,
544 /// ```
545 ///
546 /// Some examples:
547 ///
548 /// To invert all colors:
549 ///
550 /// ```
551 /// -1, 0, 0, 0, 255,
552 /// 0, -1, 0, 0, 255,
553 /// 0, 0, -1, 0, 255,
554 /// 0, 0, 0, 1, 0,
555 /// ```
556 ///
557 /// To apply a sepia filter:
558 ///
559 /// ```
560 /// 0.393, 0.769, 0.189, 0, 0,
561 /// 0.349, 0.686, 0.168, 0, 0,
562 /// 0.272, 0.534, 0.131, 0, 0,
563 /// 0, 0, 0, 1, 0,
564 /// ```
565 ///
566 /// To apply a grayscale conversion filter:
567 ///
568 /// ```
569 /// 0.2126, 0.7152, 0.0722, 0, 0,
570 /// 0.2126, 0.7152, 0.0722, 0, 0,
571 /// 0.2126, 0.7152, 0.0722, 0, 0,
572 /// 0, 0, 0, 1, 0,
573 /// ```
574 ///
575 /// @see ImpellerColorFilter
576 ///
577 typedef struct ImpellerColorMatrix {
578 float m[20];
579 } ImpellerColorMatrix;
580
581 typedef struct ImpellerRoundingRadii {
582 ImpellerPoint top_left;
583 ImpellerPoint bottom_left;
584 ImpellerPoint top_right;
585 ImpellerPoint bottom_right;
586 } ImpellerRoundingRadii;
587
588 typedef struct ImpellerColor {
589 float red;
590 float green;
591 float blue;
592 float alpha;
593 ImpellerColorSpace color_space;
594 } ImpellerColor;
595
596 typedef struct ImpellerTextureDescriptor {
597 ImpellerPixelFormat pixel_format;
598 ImpellerISize size;
599 uint32_t mip_count;
600 } ImpellerTextureDescriptor;
601
602 typedef struct ImpellerMapping {
603 const uint8_t* IMPELLER_NONNULL data;
604 uint64_t length;
605 ImpellerCallback IMPELLER_NULLABLE on_release;
606 } ImpellerMapping;
607
608 typedef struct ImpellerContextVulkanSettings {
609 void* IMPELLER_NULLABLE user_data;
610 ImpellerVulkanProcAddressCallback IMPELLER_NONNULL proc_address_callback;
611 bool enable_vulkan_validation;
612 } ImpellerContextVulkanSettings;
613
614 typedef struct ImpellerContextVulkanInfo {
615 void* IMPELLER_NULLABLE vk_instance;
616 void* IMPELLER_NULLABLE vk_physical_device;
617 void* IMPELLER_NULLABLE vk_logical_device;
618 uint32_t graphics_queue_family_index;
619 uint32_t graphics_queue_index;
620 } ImpellerContextVulkanInfo;
621
622 //------------------------------------------------------------------------------
623 // Version
624 //------------------------------------------------------------------------------
625
626 //------------------------------------------------------------------------------
627 /// @brief Get the version of Impeller standalone API. This is the API that
628 /// will be accepted for validity checks when provided to the
629 /// context creation methods.
630 ///
631 /// The current version of the API is denoted by the
632 /// `IMPELLER_VERSION` macro. This version must be passed to APIs
633 /// that create top-level objects like graphics contexts.
634 /// Construction of the context may fail if the API version expected
635 /// by the caller is not supported by the library.
636 ///
637 /// Since there are no API stability guarantees today, passing a
638 /// version that is different to the one returned by
639 /// `ImpellerGetVersion` will always fail.
640 ///
641 /// @see `ImpellerContextCreateOpenGLESNew`
642 ///
643 /// @return The version of the standalone API.
644 ///
645 IMPELLER_EXPORT
646 uint32_t ImpellerGetVersion();
647
648 //------------------------------------------------------------------------------
649 // Context
650 //------------------------------------------------------------------------------
651
652 //------------------------------------------------------------------------------
653 /// @brief Create an OpenGL(ES) Impeller context.
654 ///
655 /// @warning Unlike other context types, the OpenGL ES context can only be
656 /// created, used, and collected on the calling thread. This
657 /// restriction may be lifted in the future once reactor workers are
658 /// exposed in the API. No other context types have threading
659 /// restrictions. Till reactor workers can be used, using the
660 /// context on a background thread will cause a stall of OpenGL
661 /// operations.
662 ///
663 /// @param[in] version The version of the Impeller
664 /// standalone API. See `ImpellerGetVersion`. If the
665 /// specified here is not compatible with the version
666 /// of the library, context creation will fail and NULL
667 /// context returned from this call.
668 /// @param[in] gl_proc_address_callback
669 /// The gl proc address callback. For instance,
670 /// `eglGetProcAddress`.
671 /// @param[in] gl_proc_address_callback_user_data
672 /// The gl proc address callback user data baton. This
673 /// pointer is not interpreted by Impeller and will be
674 /// returned as user data in the proc address callback.
675 /// user data.
676 ///
677 /// @return The context or NULL if one cannot be created.
678 ///
679 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
680 ImpellerContextCreateOpenGLESNew(
681 uint32_t version,
682 ImpellerProcAddressCallback IMPELLER_NONNULL gl_proc_address_callback,
683 void* IMPELLER_NULLABLE gl_proc_address_callback_user_data);
684
685 //------------------------------------------------------------------------------
686 /// @brief Create a Metal context using the system default Metal device.
687 ///
688 /// @param[in] version The version specified in the IMPELLER_VERSION macro.
689 ///
690 /// @return The Metal context or NULL if one cannot be created.
691 ///
692 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
693 ImpellerContextCreateMetalNew(uint32_t version);
694
695 //------------------------------------------------------------------------------
696 /// @brief Create a Vulkan context using the provided Vulkan Settings.
697 ///
698 /// @param[in] version The version specified in the IMPELLER_VERSION macro.
699 /// @param[in] settings The Vulkan settings.
700 ///
701 /// @return The Vulkan context or NULL if one cannot be created.
702 ///
703 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
704 ImpellerContextCreateVulkanNew(
705 uint32_t version,
706 const ImpellerContextVulkanSettings* IMPELLER_NONNULL settings);
707
708 //------------------------------------------------------------------------------
709 /// @brief Retain a strong reference to the object. The object can be NULL
710 /// in which case this method is a no-op.
711 ///
712 /// @param[in] context The context.
713 ///
714 IMPELLER_EXPORT
715 void ImpellerContextRetain(ImpellerContext IMPELLER_NULLABLE context);
716
717 //------------------------------------------------------------------------------
718 /// @brief Release a previously retained reference to the object. The
719 /// object can be NULL in which case this method is a no-op.
720 ///
721 /// @param[in] context The context.
722 ///
723 IMPELLER_EXPORT
724 void ImpellerContextRelease(ImpellerContext IMPELLER_NULLABLE context);
725
726 //------------------------------------------------------------------------------
727 /// @brief Get internal Vulkan handles managed by the given Vulkan context.
728 /// Ownership of the handles is still maintained by Impeller. This
729 /// accessor is just available so embedders can create resources
730 /// using the same device and instance as Impeller for interop.
731 ///
732 /// @warning If the context is not a Vulkan context, False is returned with
733 /// the [out] argument unaffected.
734 ///
735 /// @param[in] context The context
736 /// @param[out] out_vulkan_info The out vulkan information
737 ///
738 /// @return If the Vulkan info could be fetched from the context.
739 ///
740 IMPELLER_EXPORT
741 bool ImpellerContextGetVulkanInfo(
742 ImpellerContext IMPELLER_NONNULL context,
743 ImpellerContextVulkanInfo* IMPELLER_NONNULL out_vulkan_info);
744
745 //------------------------------------------------------------------------------
746 // Vulkan Swapchain
747 //------------------------------------------------------------------------------
748
749 //------------------------------------------------------------------------------
750 /// @brief Create a new Vulkan swapchain using a VkSurfaceKHR instance.
751 /// Ownership of the surface is transferred over to Impeller. The
752 /// Vulkan instance the surface is created from must the same as the
753 /// context provided.
754 ///
755 /// @param[in] context The context. Must be a Vulkan context whose
756 /// instance is the same used to create the
757 /// surface passed into the next argument.
758 /// @param vulkan_surface_khr The vulkan surface.
759 ///
760 /// @return The vulkan swapchain.
761 ///
762 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerVulkanSwapchain IMPELLER_NULLABLE
763 ImpellerVulkanSwapchainCreateNew(ImpellerContext IMPELLER_NONNULL context,
764 void* IMPELLER_NONNULL vulkan_surface_khr);
765
766 //------------------------------------------------------------------------------
767 /// @brief Retain a strong reference to the object. The object can be NULL
768 /// in which case this method is a no-op.
769 ///
770 /// @param[in] swapchain The swapchain.
771 ///
772 IMPELLER_EXPORT
773 void ImpellerVulkanSwapchainRetain(
774 ImpellerVulkanSwapchain IMPELLER_NULLABLE swapchain);
775
776 //------------------------------------------------------------------------------
777 /// @brief Release a previously retained reference to the object. The
778 /// object can be NULL in which case this method is a no-op.
779 ///
780 /// @param[in] swapchain The swapchain.
781 ///
782 IMPELLER_EXPORT
783 void ImpellerVulkanSwapchainRelease(
784 ImpellerVulkanSwapchain IMPELLER_NULLABLE swapchain);
785
786 //------------------------------------------------------------------------------
787 /// @brief A potentially blocking operation, acquires the next surface to
788 /// render to. Since this may block, surface acquisition must be
789 /// delayed for as long as possible to avoid an idle wait on the
790 /// CPU.
791 ///
792 /// @param[in] swapchain The swapchain.
793 ///
794 /// @return The surface if one could be obtained, NULL otherwise.
795 ///
796 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
797 ImpellerVulkanSwapchainAcquireNextSurfaceNew(
798 ImpellerVulkanSwapchain IMPELLER_NONNULL swapchain);
799
800 //------------------------------------------------------------------------------
801 // Surface
802 //------------------------------------------------------------------------------
803
804 //------------------------------------------------------------------------------
805 /// @brief Create a new surface by wrapping an existing framebuffer object.
806 /// The framebuffer must be complete as determined by
807 /// `glCheckFramebufferStatus`. The framebuffer is still owned by
808 /// the caller and it must be collected once the surface is
809 /// collected.
810 ///
811 /// @param[in] context The context.
812 /// @param[in] fbo The framebuffer object handle.
813 /// @param[in] format The format of the framebuffer.
814 /// @param[in] size The size of the framebuffer is texels.
815 ///
816 /// @return The surface if once can be created, NULL otherwise.
817 ///
818 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
819 ImpellerSurfaceCreateWrappedFBONew(ImpellerContext IMPELLER_NONNULL context,
820 uint64_t fbo,
821 ImpellerPixelFormat format,
822 const ImpellerISize* IMPELLER_NONNULL size);
823
824 //------------------------------------------------------------------------------
825 /// @brief Create a surface by wrapping a Metal drawable. This is useful
826 /// during WSI when the drawable is the backing store of the Metal
827 /// layer being drawn to.
828 ///
829 /// The Metal layer must be using the same device managed by the
830 /// underlying context.
831 ///
832 /// @param[in] context The context. The Metal device managed by this
833 /// context must be the same used to create the
834 /// drawable that is being wrapped.
835 /// @param metal_drawable The drawable to wrap as a surface.
836 ///
837 /// @return The surface if one could be wrapped, NULL otherwise.
838 ///
839 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
840 ImpellerSurfaceCreateWrappedMetalDrawableNew(
841 ImpellerContext IMPELLER_NONNULL context,
842 void* IMPELLER_NONNULL metal_drawable);
843
844 //------------------------------------------------------------------------------
845 /// @brief Retain a strong reference to the object. The object can be NULL
846 /// in which case this method is a no-op.
847 ///
848 /// @param[in] surface The surface.
849 ///
850 IMPELLER_EXPORT
851 void ImpellerSurfaceRetain(ImpellerSurface IMPELLER_NULLABLE surface);
852
853 //------------------------------------------------------------------------------
854 /// @brief Release a previously retained reference to the object. The
855 /// object can be NULL in which case this method is a no-op.
856 ///
857 /// @param[in] surface The surface.
858 ///
859 IMPELLER_EXPORT
860 void ImpellerSurfaceRelease(ImpellerSurface IMPELLER_NULLABLE surface);
861
862 //------------------------------------------------------------------------------
863 /// @brief Draw a display list onto the surface. The same display list can
864 /// be drawn multiple times to different surfaces.
865 ///
866 /// @warning In the OpenGL backend, Impeller will not make an effort to
867 /// preserve the OpenGL state that is current in the context.
868 /// Embedders that perform additional OpenGL operations in the
869 /// context should expect the reset state after control transitions
870 /// back to them. Key state to watch out for would be the viewports,
871 /// stencil rects, test toggles, resource (texture, framebuffer,
872 /// buffer) bindings, etc...
873 ///
874 /// @param[in] surface The surface to draw the display list to.
875 /// @param[in] display_list The display list to draw onto the surface.
876 ///
877 /// @return If the display list could be drawn onto the surface.
878 ///
879 IMPELLER_EXPORT
880 bool ImpellerSurfaceDrawDisplayList(
881 ImpellerSurface IMPELLER_NONNULL surface,
882 ImpellerDisplayList IMPELLER_NONNULL display_list);
883
884 //------------------------------------------------------------------------------
885 /// @brief Present the surface to the underlying window system.
886 ///
887 /// @param[in] surface The surface to present.
888 ///
889 /// @return True if the surface could be presented.
890 ///
891 IMPELLER_EXPORT
892 bool ImpellerSurfacePresent(ImpellerSurface IMPELLER_NONNULL surface);
893
894 //------------------------------------------------------------------------------
895 // Path
896 //------------------------------------------------------------------------------
897
898 //------------------------------------------------------------------------------
899 /// @brief Retain a strong reference to the object. The object can be NULL
900 /// in which case this method is a no-op.
901 ///
902 /// @param[in] path The path.
903 ///
904 IMPELLER_EXPORT
905 void ImpellerPathRetain(ImpellerPath IMPELLER_NULLABLE path);
906
907 //------------------------------------------------------------------------------
908 /// @brief Release a previously retained reference to the object. The
909 /// object can be NULL in which case this method is a no-op.
910 ///
911 /// @param[in] path The path.
912 ///
913 IMPELLER_EXPORT
914 void ImpellerPathRelease(ImpellerPath IMPELLER_NULLABLE path);
915
916 //------------------------------------------------------------------------------
917 // Path Builder
918 //------------------------------------------------------------------------------
919
920 //------------------------------------------------------------------------------
921 /// @brief Create a new path builder. Paths themselves are immutable.
922 /// A builder builds these immutable paths.
923 ///
924 /// @return The path builder.
925 ///
926 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE
927 ImpellerPathBuilderNew();
928
929 //------------------------------------------------------------------------------
930 /// @brief Retain a strong reference to the object. The object can be NULL
931 /// in which case this method is a no-op.
932 ///
933 /// @param[in] builder The builder.
934 ///
935 IMPELLER_EXPORT
936 void ImpellerPathBuilderRetain(ImpellerPathBuilder IMPELLER_NULLABLE builder);
937
938 //------------------------------------------------------------------------------
939 /// @brief Release a previously retained reference to the object. The
940 /// object can be NULL in which case this method is a no-op.
941 ///
942 /// @param[in] builder The builder.
943 ///
944 IMPELLER_EXPORT
945 void ImpellerPathBuilderRelease(ImpellerPathBuilder IMPELLER_NULLABLE builder);
946
947 //------------------------------------------------------------------------------
948 /// @brief Move the cursor to the specified location.
949 ///
950 /// @param[in] builder The builder.
951 /// @param[in] location The location.
952 ///
953 IMPELLER_EXPORT
954 void ImpellerPathBuilderMoveTo(ImpellerPathBuilder IMPELLER_NONNULL builder,
955 const ImpellerPoint* IMPELLER_NONNULL location);
956
957 //------------------------------------------------------------------------------
958 /// @brief Add a line segment from the current cursor location to the given
959 /// location. The cursor location is updated to be at the endpoint.
960 ///
961 /// @param[in] builder The builder.
962 /// @param[in] location The location.
963 ///
964 IMPELLER_EXPORT
965 void ImpellerPathBuilderLineTo(ImpellerPathBuilder IMPELLER_NONNULL builder,
966 const ImpellerPoint* IMPELLER_NONNULL location);
967
968 //------------------------------------------------------------------------------
969 /// @brief Add a quadratic curve from whose start point is the cursor to
970 /// the specified end point using the a single control point.
971 ///
972 /// The new location of the cursor after this call is the end point.
973 ///
974 /// @param[in] builder The builder.
975 /// @param[in] control_point The control point.
976 /// @param[in] end_point The end point.
977 ///
978 IMPELLER_EXPORT
979 void ImpellerPathBuilderQuadraticCurveTo(
980 ImpellerPathBuilder IMPELLER_NONNULL builder,
981 const ImpellerPoint* IMPELLER_NONNULL control_point,
982 const ImpellerPoint* IMPELLER_NONNULL end_point);
983
984 //------------------------------------------------------------------------------
985 /// @brief Add a cubic curve whose start point is current cursor location
986 /// to the specified end point using the two specified control
987 /// points.
988 ///
989 /// The new location of the cursor after this call is the end point
990 /// supplied.
991 ///
992 /// @param[in] builder The builder
993 /// @param[in] control_point_1 The control point 1
994 /// @param[in] control_point_2 The control point 2
995 /// @param[in] end_point The end point
996 ///
997 IMPELLER_EXPORT
998 void ImpellerPathBuilderCubicCurveTo(
999 ImpellerPathBuilder IMPELLER_NONNULL builder,
1000 const ImpellerPoint* IMPELLER_NONNULL control_point_1,
1001 const ImpellerPoint* IMPELLER_NONNULL control_point_2,
1002 const ImpellerPoint* IMPELLER_NONNULL end_point);
1003
1004 //------------------------------------------------------------------------------
1005 /// @brief Adds a rectangle to the path.
1006 ///
1007 /// @param[in] builder The builder.
1008 /// @param[in] rect The rectangle.
1009 ///
1010 IMPELLER_EXPORT
1011 void ImpellerPathBuilderAddRect(ImpellerPathBuilder IMPELLER_NONNULL builder,
1012 const ImpellerRect* IMPELLER_NONNULL rect);
1013
1014 //------------------------------------------------------------------------------
1015 /// @brief Add an arc to the path.
1016 ///
1017 /// @param[in] builder The builder.
1018 /// @param[in] oval_bounds The oval bounds.
1019 /// @param[in] start_angle_degrees The start angle in degrees.
1020 /// @param[in] end_angle_degrees The end angle in degrees.
1021 ///
1022 IMPELLER_EXPORT
1023 void ImpellerPathBuilderAddArc(ImpellerPathBuilder IMPELLER_NONNULL builder,
1024 const ImpellerRect* IMPELLER_NONNULL oval_bounds,
1025 float start_angle_degrees,
1026 float end_angle_degrees);
1027
1028 //------------------------------------------------------------------------------
1029 /// @brief Add an oval to the path.
1030 ///
1031 /// @param[in] builder The builder.
1032 /// @param[in] oval_bounds The oval bounds.
1033 ///
1034 IMPELLER_EXPORT
1035 void ImpellerPathBuilderAddOval(
1036 ImpellerPathBuilder IMPELLER_NONNULL builder,
1037 const ImpellerRect* IMPELLER_NONNULL oval_bounds);
1038
1039 //------------------------------------------------------------------------------
1040 /// @brief Add a rounded rect with potentially non-uniform radii to the
1041 /// path.
1042 ///
1043 /// @param[in] builder The builder.
1044 /// @param[in] rect The rectangle.
1045 /// @param[in] rounding_radii The rounding radii.
1046 ///
1047 IMPELLER_EXPORT
1048 void ImpellerPathBuilderAddRoundedRect(
1049 ImpellerPathBuilder IMPELLER_NONNULL builder,
1050 const ImpellerRect* IMPELLER_NONNULL rect,
1051 const ImpellerRoundingRadii* IMPELLER_NONNULL rounding_radii);
1052
1053 //------------------------------------------------------------------------------
1054 /// @brief Close the path.
1055 ///
1056 /// @param[in] builder The builder.
1057 ///
1058 IMPELLER_EXPORT
1059 void ImpellerPathBuilderClose(ImpellerPathBuilder IMPELLER_NONNULL builder);
1060
1061 //------------------------------------------------------------------------------
1062 /// @brief Create a new path by copying the existing built-up path. The
1063 /// existing path can continue being added to.
1064 ///
1065 /// @param[in] builder The builder.
1066 /// @param[in] fill The fill.
1067 ///
1068 /// @return The impeller path.
1069 ///
1070 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE
1071 ImpellerPathBuilderCopyPathNew(ImpellerPathBuilder IMPELLER_NONNULL builder,
1072 ImpellerFillType fill);
1073
1074 //------------------------------------------------------------------------------
1075 /// @brief Create a new path using the existing built-up path. The existing
1076 /// path builder now contains an empty path.
1077 ///
1078 /// @param[in] builder The builder.
1079 /// @param[in] fill The fill.
1080 ///
1081 /// @return The impeller path.
1082 ///
1083 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE
1084 ImpellerPathBuilderTakePathNew(ImpellerPathBuilder IMPELLER_NONNULL builder,
1085 ImpellerFillType fill);
1086
1087 //------------------------------------------------------------------------------
1088 // Paint
1089 //------------------------------------------------------------------------------
1090
1091 //------------------------------------------------------------------------------
1092 /// @brief Create a new paint with default values.
1093 ///
1094 /// @return The impeller paint.
1095 ///
1096 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE
1097 ImpellerPaintNew();
1098
1099 //------------------------------------------------------------------------------
1100 /// @brief Retain a strong reference to the object. The object can be NULL
1101 /// in which case this method is a no-op.
1102 ///
1103 /// @param[in] paint The paint.
1104 ///
1105 IMPELLER_EXPORT
1106 void ImpellerPaintRetain(ImpellerPaint IMPELLER_NULLABLE paint);
1107
1108 //------------------------------------------------------------------------------
1109 /// @brief Release a previously retained reference to the object. The
1110 /// object can be NULL in which case this method is a no-op.
1111 ///
1112 /// @param[in] paint The paint.
1113 ///
1114 IMPELLER_EXPORT
1115 void ImpellerPaintRelease(ImpellerPaint IMPELLER_NULLABLE paint);
1116
1117 //------------------------------------------------------------------------------
1118 /// @brief Set the paint color.
1119 ///
1120 /// @param[in] paint The paint.
1121 /// @param[in] color The color.
1122 ///
1123 IMPELLER_EXPORT
1124 void ImpellerPaintSetColor(ImpellerPaint IMPELLER_NONNULL paint,
1125 const ImpellerColor* IMPELLER_NONNULL color);
1126
1127 //------------------------------------------------------------------------------
1128 /// @brief Set the paint blend mode. The blend mode controls how the new
1129 /// paints contents are mixed with the values already drawn using
1130 /// previous draw calls.
1131 ///
1132 /// @param[in] paint The paint.
1133 /// @param[in] mode The mode.
1134 ///
1135 IMPELLER_EXPORT
1136 void ImpellerPaintSetBlendMode(ImpellerPaint IMPELLER_NONNULL paint,
1137 ImpellerBlendMode mode);
1138
1139 //------------------------------------------------------------------------------
1140 /// @brief Set the paint draw style. The style controls if the closed
1141 /// shapes are filled and/or stroked.
1142 ///
1143 /// @param[in] paint The paint.
1144 /// @param[in] style The style.
1145 ///
1146 IMPELLER_EXPORT
1147 void ImpellerPaintSetDrawStyle(ImpellerPaint IMPELLER_NONNULL paint,
1148 ImpellerDrawStyle style);
1149
1150 //------------------------------------------------------------------------------
1151 /// @brief Sets how strokes rendered using this paint are capped.
1152 ///
1153 /// @param[in] paint The paint.
1154 /// @param[in] cap The stroke cap style.
1155 ///
1156 IMPELLER_EXPORT
1157 void ImpellerPaintSetStrokeCap(ImpellerPaint IMPELLER_NONNULL paint,
1158 ImpellerStrokeCap cap);
1159
1160 //------------------------------------------------------------------------------
1161 /// @brief Sets how strokes rendered using this paint are joined.
1162 ///
1163 /// @param[in] paint The paint.
1164 /// @param[in] join The join.
1165 ///
1166 IMPELLER_EXPORT
1167 void ImpellerPaintSetStrokeJoin(ImpellerPaint IMPELLER_NONNULL paint,
1168 ImpellerStrokeJoin join);
1169
1170 //------------------------------------------------------------------------------
1171 /// @brief Set the width of the strokes rendered using this paint.
1172 ///
1173 /// @param[in] paint The paint.
1174 /// @param[in] width The width.
1175 ///
1176 IMPELLER_EXPORT
1177 void ImpellerPaintSetStrokeWidth(ImpellerPaint IMPELLER_NONNULL paint,
1178 float width);
1179
1180 //------------------------------------------------------------------------------
1181 /// @brief Set the miter limit of the strokes rendered using this paint.
1182 ///
1183 /// @param[in] paint The paint.
1184 /// @param[in] miter The miter limit.
1185 ///
1186 IMPELLER_EXPORT
1187 void ImpellerPaintSetStrokeMiter(ImpellerPaint IMPELLER_NONNULL paint,
1188 float miter);
1189
1190 //------------------------------------------------------------------------------
1191 /// @brief Set the color filter of the paint.
1192 ///
1193 /// Color filters are functions that take two colors and mix them to
1194 /// produce a single color. This color is then usually merged with
1195 /// the destination during blending.
1196 ///
1197 /// @param[in] paint The paint.
1198 /// @param[in] color_filter The color filter.
1199 ///
1200 IMPELLER_EXPORT
1201 void ImpellerPaintSetColorFilter(
1202 ImpellerPaint IMPELLER_NONNULL paint,
1203 ImpellerColorFilter IMPELLER_NONNULL color_filter);
1204
1205 //------------------------------------------------------------------------------
1206 /// @brief Set the color source of the paint.
1207 ///
1208 /// Color sources are functions that generate colors for each
1209 /// texture element covered by a draw call.
1210 ///
1211 /// @param[in] paint The paint.
1212 /// @param[in] color_source The color source.
1213 ///
1214 IMPELLER_EXPORT
1215 void ImpellerPaintSetColorSource(
1216 ImpellerPaint IMPELLER_NONNULL paint,
1217 ImpellerColorSource IMPELLER_NONNULL color_source);
1218
1219 //------------------------------------------------------------------------------
1220 /// @brief Set the image filter of a paint.
1221 ///
1222 /// Image filters are functions that are applied to regions of a
1223 /// texture to produce a single color.
1224 ///
1225 /// @param[in] paint The paint.
1226 /// @param[in] image_filter The image filter.
1227 ///
1228 IMPELLER_EXPORT
1229 void ImpellerPaintSetImageFilter(
1230 ImpellerPaint IMPELLER_NONNULL paint,
1231 ImpellerImageFilter IMPELLER_NONNULL image_filter);
1232
1233 //------------------------------------------------------------------------------
1234 /// @brief Set the mask filter of a paint.
1235 ///
1236 /// @param[in] paint The paint.
1237 /// @param[in] mask_filter The mask filter.
1238 ///
1239 IMPELLER_EXPORT
1240 void ImpellerPaintSetMaskFilter(
1241 ImpellerPaint IMPELLER_NONNULL paint,
1242 ImpellerMaskFilter IMPELLER_NONNULL mask_filter);
1243
1244 //------------------------------------------------------------------------------
1245 // Texture
1246 //------------------------------------------------------------------------------
1247
1248 //------------------------------------------------------------------------------
1249 /// @brief Create a texture with decompressed bytes.
1250 ///
1251 /// Impeller will do its best to perform the transfer of this data
1252 /// to GPU memory with a minimal number of copies. Towards this
1253 /// end, it may need to send this data to a different thread for
1254 /// preparation and transfer. To facilitate this transfer, it is
1255 /// recommended that the content mapping have a release callback
1256 /// attach to it. When there is a release callback, Impeller assumes
1257 /// that collection of the data can be deferred till texture upload
1258 /// is done and can happen on a background thread. When there is no
1259 /// release callback, Impeller may try to perform an eager copy of
1260 /// the data if it needs to perform data preparation and transfer on
1261 /// a background thread.
1262 ///
1263 /// Whether an extra data copy actually occurs will always depend on
1264 /// the rendering backend in use. But it is best practice to provide
1265 /// a release callback and be resilient to the data being released
1266 /// in a deferred manner on a background thread.
1267 ///
1268 /// @warning Do **not** supply compressed image data directly (PNG, JPEG,
1269 /// etc...). This function only works with tightly packed
1270 /// decompressed data.
1271 ///
1272 /// @param[in] context The context.
1273 /// @param[in] descriptor The texture descriptor.
1274 /// @param[in] contents The contents.
1275 /// @param[in] contents_on_release_user_data The baton passes to the contents
1276 /// release callback if one exists.
1277 ///
1278 /// @return The texture if one can be created using the provided data, NULL
1279 /// otherwise.
1280 ///
1281 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE
1282 ImpellerTextureCreateWithContentsNew(
1283 ImpellerContext IMPELLER_NONNULL context,
1284 const ImpellerTextureDescriptor* IMPELLER_NONNULL descriptor,
1285 const ImpellerMapping* IMPELLER_NONNULL contents,
1286 void* IMPELLER_NULLABLE contents_on_release_user_data);
1287
1288 //------------------------------------------------------------------------------
1289 /// @brief Create a texture with an externally created OpenGL texture
1290 /// handle.
1291 ///
1292 /// Ownership of the handle is transferred over to Impeller after a
1293 /// successful call to this method. Impeller is responsible for
1294 /// calling glDeleteTextures on this handle. Do **not** collect this
1295 /// handle yourself as this will lead to a double-free.
1296 ///
1297 /// The handle must be created in the same context as the one used
1298 /// by Impeller. If a different context is used, that context must
1299 /// be in the same sharegroup as Impellers OpenGL context and all
1300 /// synchronization of texture contents must already be complete.
1301 ///
1302 /// If the context is not an OpenGL context, this call will always
1303 /// fail.
1304 ///
1305 /// @param[in] context The context
1306 /// @param[in] descriptor The descriptor
1307 /// @param[in] handle The handle
1308 ///
1309 /// @return The texture if one could be created by adopting the supplied
1310 /// texture handle, NULL otherwise.
1311 ///
1312 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE
1313 ImpellerTextureCreateWithOpenGLTextureHandleNew(
1314 ImpellerContext IMPELLER_NONNULL context,
1315 const ImpellerTextureDescriptor* IMPELLER_NONNULL descriptor,
1316 uint64_t handle // transfer-in ownership
1317 );
1318
1319 //------------------------------------------------------------------------------
1320 /// @brief Retain a strong reference to the object. The object can be NULL
1321 /// in which case this method is a no-op.
1322 ///
1323 /// @param[in] texture The texture.
1324 ///
1325 IMPELLER_EXPORT
1326 void ImpellerTextureRetain(ImpellerTexture IMPELLER_NULLABLE texture);
1327
1328 //------------------------------------------------------------------------------
1329 /// @brief Release a previously retained reference to the object. The
1330 /// object can be NULL in which case this method is a no-op.
1331 ///
1332 /// @param[in] texture The texture.
1333 ///
1334 IMPELLER_EXPORT
1335 void ImpellerTextureRelease(ImpellerTexture IMPELLER_NULLABLE texture);
1336
1337 //------------------------------------------------------------------------------
1338 /// @brief Get the OpenGL handle associated with this texture. If this is
1339 /// not an OpenGL texture, this method will always return 0.
1340 ///
1341 /// OpenGL handles are lazily created, this method will return
1342 /// GL_NONE is no OpenGL handle is available. To ensure that this
1343 /// call eagerly creates an OpenGL texture, call this on a thread
1344 /// where Impeller knows there is an OpenGL context available.
1345 ///
1346 /// @param[in] texture The texture.
1347 ///
1348 /// @return The OpenGL handle if one is available, GL_NONE otherwise.
1349 ///
1350 IMPELLER_EXPORT
1351 uint64_t ImpellerTextureGetOpenGLHandle(
1352 ImpellerTexture IMPELLER_NONNULL texture);
1353
1354 //------------------------------------------------------------------------------
1355 // Color Sources
1356 //------------------------------------------------------------------------------
1357
1358 //------------------------------------------------------------------------------
1359 /// @brief Retain a strong reference to the object. The object can be NULL
1360 /// in which case this method is a no-op.
1361 ///
1362 /// @param[in] color_source The color source.
1363 ///
1364
1365 IMPELLER_EXPORT
1366 void ImpellerColorSourceRetain(
1367 ImpellerColorSource IMPELLER_NULLABLE color_source);
1368
1369 //------------------------------------------------------------------------------
1370 /// @brief Release a previously retained reference to the object. The
1371 /// object can be NULL in which case this method is a no-op.
1372 ///
1373 /// @param[in] color_source The color source.
1374 ///
1375 IMPELLER_EXPORT
1376 void ImpellerColorSourceRelease(
1377 ImpellerColorSource IMPELLER_NULLABLE color_source);
1378
1379 //------------------------------------------------------------------------------
1380 /// @brief Create a color source that forms a linear gradient.
1381 ///
1382 /// @param[in] start_point The start point.
1383 /// @param[in] end_point The end point.
1384 /// @param[in] stop_count The stop count.
1385 /// @param[in] colors The colors.
1386 /// @param[in] stops The stops.
1387 /// @param[in] tile_mode The tile mode.
1388 /// @param[in] transformation The transformation.
1389 ///
1390 /// @return The color source.
1391 ///
1392 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
1393 ImpellerColorSourceCreateLinearGradientNew(
1394 const ImpellerPoint* IMPELLER_NONNULL start_point,
1395 const ImpellerPoint* IMPELLER_NONNULL end_point,
1396 uint32_t stop_count,
1397 const ImpellerColor* IMPELLER_NONNULL colors,
1398 const float* IMPELLER_NONNULL stops,
1399 ImpellerTileMode tile_mode,
1400 const ImpellerMatrix* IMPELLER_NULLABLE transformation);
1401
1402 //------------------------------------------------------------------------------
1403 /// @brief Create a color source that forms a radial gradient.
1404 ///
1405 /// @param[in] center The center.
1406 /// @param[in] radius The radius.
1407 /// @param[in] stop_count The stop count.
1408 /// @param[in] colors The colors.
1409 /// @param[in] stops The stops.
1410 /// @param[in] tile_mode The tile mode.
1411 /// @param[in] transformation The transformation.
1412 ///
1413 /// @return The color source.
1414 ///
1415 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
1416 ImpellerColorSourceCreateRadialGradientNew(
1417 const ImpellerPoint* IMPELLER_NONNULL center,
1418 float radius,
1419 uint32_t stop_count,
1420 const ImpellerColor* IMPELLER_NONNULL colors,
1421 const float* IMPELLER_NONNULL stops,
1422 ImpellerTileMode tile_mode,
1423 const ImpellerMatrix* IMPELLER_NULLABLE transformation);
1424
1425 //------------------------------------------------------------------------------
1426 /// @brief Create a color source that forms a conical gradient.
1427 ///
1428 /// @param[in] start_center The start center.
1429 /// @param[in] start_radius The start radius.
1430 /// @param[in] end_center The end center.
1431 /// @param[in] end_radius The end radius.
1432 /// @param[in] stop_count The stop count.
1433 /// @param[in] colors The colors.
1434 /// @param[in] stops The stops.
1435 /// @param[in] tile_mode The tile mode.
1436 /// @param[in] transformation The transformation.
1437 ///
1438 /// @return The color source.
1439 ///
1440 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
1441 ImpellerColorSourceCreateConicalGradientNew(
1442 const ImpellerPoint* IMPELLER_NONNULL start_center,
1443 float start_radius,
1444 const ImpellerPoint* IMPELLER_NONNULL end_center,
1445 float end_radius,
1446 uint32_t stop_count,
1447 const ImpellerColor* IMPELLER_NONNULL colors,
1448 const float* IMPELLER_NONNULL stops,
1449 ImpellerTileMode tile_mode,
1450 const ImpellerMatrix* IMPELLER_NULLABLE transformation);
1451
1452 //------------------------------------------------------------------------------
1453 /// @brief Create a color source that forms a sweep gradient.
1454 ///
1455 /// @param[in] center The center.
1456 /// @param[in] start The start.
1457 /// @param[in] end The end.
1458 /// @param[in] stop_count The stop count.
1459 /// @param[in] colors The colors.
1460 /// @param[in] stops The stops.
1461 /// @param[in] tile_mode The tile mode.
1462 /// @param[in] transformation The transformation.
1463 ///
1464 /// @return The color source.
1465 ///
1466 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
1467 ImpellerColorSourceCreateSweepGradientNew(
1468 const ImpellerPoint* IMPELLER_NONNULL center,
1469 float start,
1470 float end,
1471 uint32_t stop_count,
1472 const ImpellerColor* IMPELLER_NONNULL colors,
1473 const float* IMPELLER_NONNULL stops,
1474 ImpellerTileMode tile_mode,
1475 const ImpellerMatrix* IMPELLER_NULLABLE transformation);
1476
1477 //------------------------------------------------------------------------------
1478 /// @brief Create a color source that samples from an image.
1479 ///
1480 /// @param[in] image The image.
1481 /// @param[in] horizontal_tile_mode The horizontal tile mode.
1482 /// @param[in] vertical_tile_mode The vertical tile mode.
1483 /// @param[in] sampling The sampling.
1484 /// @param[in] transformation The transformation.
1485 ///
1486 /// @return The color source.
1487 ///
1488 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
1489 ImpellerColorSourceCreateImageNew(
1490 ImpellerTexture IMPELLER_NONNULL image,
1491 ImpellerTileMode horizontal_tile_mode,
1492 ImpellerTileMode vertical_tile_mode,
1493 ImpellerTextureSampling sampling,
1494 const ImpellerMatrix* IMPELLER_NULLABLE transformation);
1495
1496 //------------------------------------------------------------------------------
1497 // Color Filters
1498 //------------------------------------------------------------------------------
1499
1500 //------------------------------------------------------------------------------
1501 /// @brief Retain a strong reference to the object. The object can be NULL
1502 /// in which case this method is a no-op.
1503 ///
1504 /// @param[in] color_filter The color filter.
1505 ///
1506 IMPELLER_EXPORT
1507 void ImpellerColorFilterRetain(
1508 ImpellerColorFilter IMPELLER_NULLABLE color_filter);
1509
1510 //------------------------------------------------------------------------------
1511 /// @brief Release a previously retained reference to the object. The
1512 /// object can be NULL in which case this method is a no-op.
1513 ///
1514 /// @param[in] color_filter The color filter.
1515 ///
1516 IMPELLER_EXPORT
1517 void ImpellerColorFilterRelease(
1518 ImpellerColorFilter IMPELLER_NULLABLE color_filter);
1519
1520 //------------------------------------------------------------------------------
1521 /// @brief Create a color filter that performs blending of pixel values
1522 /// independently.
1523 ///
1524 /// @param[in] color The color.
1525 /// @param[in] blend_mode The blend mode.
1526 ///
1527 /// @return The color filter.
1528 ///
1529 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE
1530 ImpellerColorFilterCreateBlendNew(const ImpellerColor* IMPELLER_NONNULL color,
1531 ImpellerBlendMode blend_mode);
1532
1533 //------------------------------------------------------------------------------
1534 /// @brief Create a color filter that transforms pixel color values
1535 /// independently.
1536 ///
1537 /// @param[in] color_matrix The color matrix.
1538 ///
1539 /// @return The color filter.
1540 ///
1541 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE
1542 ImpellerColorFilterCreateColorMatrixNew(
1543 const ImpellerColorMatrix* IMPELLER_NONNULL color_matrix);
1544
1545 //------------------------------------------------------------------------------
1546 // Mask Filters
1547 //------------------------------------------------------------------------------
1548
1549 //------------------------------------------------------------------------------
1550 /// @brief Retain a strong reference to the object. The object can be NULL
1551 /// in which case this method is a no-op.
1552 ///
1553 /// @param[in] mask_filter The mask filter.
1554 ///
1555 IMPELLER_EXPORT
1556 void ImpellerMaskFilterRetain(ImpellerMaskFilter IMPELLER_NULLABLE mask_filter);
1557
1558 //------------------------------------------------------------------------------
1559 /// @brief Release a previously retained reference to the object. The
1560 /// object can be NULL in which case this method is a no-op.
1561 ///
1562 /// @param[in] mask_filter The mask filter.
1563 ///
1564 IMPELLER_EXPORT
1565 void ImpellerMaskFilterRelease(
1566 ImpellerMaskFilter IMPELLER_NULLABLE mask_filter);
1567
1568 //------------------------------------------------------------------------------
1569 /// @brief Create a mask filter that blurs contents in the masked shape.
1570 ///
1571 /// @param[in] style The style.
1572 /// @param[in] sigma The sigma.
1573 ///
1574 /// @return The mask filter.
1575 ///
1576 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerMaskFilter IMPELLER_NULLABLE
1577 ImpellerMaskFilterCreateBlurNew(ImpellerBlurStyle style, float sigma);
1578
1579 //------------------------------------------------------------------------------
1580 // Image Filters
1581 //------------------------------------------------------------------------------
1582
1583 //------------------------------------------------------------------------------
1584 /// @brief Retain a strong reference to the object. The object can be NULL
1585 /// in which case this method is a no-op.
1586 ///
1587 /// @param[in] image_filter The image filter.
1588 ///
1589 IMPELLER_EXPORT
1590 void ImpellerImageFilterRetain(
1591 ImpellerImageFilter IMPELLER_NULLABLE image_filter);
1592
1593 //------------------------------------------------------------------------------
1594 /// @brief Release a previously retained reference to the object. The
1595 /// object can be NULL in which case this method is a no-op.
1596 ///
1597 /// @param[in] image_filter The image filter.
1598 ///
1599 IMPELLER_EXPORT
1600 void ImpellerImageFilterRelease(
1601 ImpellerImageFilter IMPELLER_NULLABLE image_filter);
1602
1603 //------------------------------------------------------------------------------
1604 /// @brief Creates an image filter that applies a Gaussian blur.
1605 ///
1606 /// The Gaussian blur applied may be an approximation for
1607 /// performance.
1608 ///
1609 ///
1610 /// @param[in] x_sigma The x sigma.
1611 /// @param[in] y_sigma The y sigma.
1612 /// @param[in] tile_mode The tile mode.
1613 ///
1614 /// @return The image filter.
1615 ///
1616 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
1617 ImpellerImageFilterCreateBlurNew(float x_sigma,
1618 float y_sigma,
1619 ImpellerTileMode tile_mode);
1620
1621 //------------------------------------------------------------------------------
1622 /// @brief Creates an image filter that enhances the per-channel pixel
1623 /// values to the maximum value in a circle around the pixel.
1624 ///
1625 /// @param[in] x_radius The x radius.
1626 /// @param[in] y_radius The y radius.
1627 ///
1628 /// @return The image filter.
1629 ///
1630
1631 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
1632 ImpellerImageFilterCreateDilateNew(float x_radius, float y_radius);
1633
1634 //------------------------------------------------------------------------------
1635 /// @brief Creates an image filter that dampens the per-channel pixel
1636 /// values to the minimum value in a circle around the pixel.
1637 ///
1638 /// @param[in] x_radius The x radius.
1639 /// @param[in] y_radius The y radius.
1640 ///
1641 /// @return The image filter.
1642 ///
1643 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
1644 ImpellerImageFilterCreateErodeNew(float x_radius, float y_radius);
1645
1646 //------------------------------------------------------------------------------
1647 /// @brief Creates an image filter that applies a transformation matrix to
1648 /// the underlying image.
1649 ///
1650 /// @param[in] matrix The transformation matrix.
1651 /// @param[in] sampling The image sampling mode.
1652 ///
1653 /// @return The image filter.
1654 ///
1655 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
1656 ImpellerImageFilterCreateMatrixNew(
1657 const ImpellerMatrix* IMPELLER_NONNULL matrix,
1658 ImpellerTextureSampling sampling);
1659
1660 //------------------------------------------------------------------------------
1661 /// @brief Creates a composed filter that when applied is identical to
1662 /// subsequently applying the inner and then the outer filters.
1663 ///
1664 /// ```
1665 /// destination = outer_filter(inner_filter(source))
1666 /// ```
1667 ///
1668 /// @param[in] outer The outer image filter.
1669 /// @param[in] inner The inner image filter.
1670 ///
1671 /// @return The combined image filter.
1672 ///
1673 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
1674 ImpellerImageFilterCreateComposeNew(ImpellerImageFilter IMPELLER_NONNULL outer,
1675 ImpellerImageFilter IMPELLER_NONNULL inner);
1676
1677 //------------------------------------------------------------------------------
1678 // Display List
1679 //------------------------------------------------------------------------------
1680
1681 //------------------------------------------------------------------------------
1682 /// @brief Retain a strong reference to the object. The object can be NULL
1683 /// in which case this method is a no-op.
1684 ///
1685 /// @param[in] display_list The display list.
1686 ///
1687 IMPELLER_EXPORT
1688 void ImpellerDisplayListRetain(
1689 ImpellerDisplayList IMPELLER_NULLABLE display_list);
1690
1691 //------------------------------------------------------------------------------
1692 /// @brief Release a previously retained reference to the object. The
1693 /// object can be NULL in which case this method is a no-op.
1694 ///
1695 /// @param[in] display_list The display list.
1696 ///
1697 IMPELLER_EXPORT
1698 void ImpellerDisplayListRelease(
1699 ImpellerDisplayList IMPELLER_NULLABLE display_list);
1700
1701 //------------------------------------------------------------------------------
1702 // Display List Builder
1703 //------------------------------------------------------------------------------
1704
1705 //------------------------------------------------------------------------------
1706 /// @brief Create a new display list builder.
1707 ///
1708 /// An optional cull rectangle may be specified. Impeller is allowed
1709 /// to treat the contents outside this rectangle as being undefined.
1710 /// This may aid performance optimizations.
1711 ///
1712 /// @param[in] cull_rect The cull rectangle or NULL.
1713 ///
1714 /// @return The display list builder.
1715 ///
1716 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE
1717 ImpellerDisplayListBuilderNew(const ImpellerRect* IMPELLER_NULLABLE cull_rect);
1718
1719 //------------------------------------------------------------------------------
1720 /// @brief Retain a strong reference to the object. The object can be NULL
1721 /// in which case this method is a no-op.
1722 ///
1723 /// @param[in] builder The display list builder.
1724 ///
1725 IMPELLER_EXPORT
1726 void ImpellerDisplayListBuilderRetain(
1727 ImpellerDisplayListBuilder IMPELLER_NULLABLE builder);
1728
1729 //------------------------------------------------------------------------------
1730 /// @brief Release a previously retained reference to the object. The
1731 /// object can be NULL in which case this method is a no-op.
1732 ///
1733 /// @param[in] builder The display list builder.
1734 ///
1735 IMPELLER_EXPORT
1736 void ImpellerDisplayListBuilderRelease(
1737 ImpellerDisplayListBuilder IMPELLER_NULLABLE builder);
1738
1739 //------------------------------------------------------------------------------
1740 /// @brief Create a new display list using the rendering intent already
1741 /// encoded in the builder. The builder is reset after this call.
1742 ///
1743 /// @param[in] builder The builder.
1744 ///
1745 /// @return The display list.
1746 ///
1747 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayList IMPELLER_NULLABLE
1748 ImpellerDisplayListBuilderCreateDisplayListNew(
1749 ImpellerDisplayListBuilder IMPELLER_NONNULL builder);
1750
1751 //------------------------------------------------------------------------------
1752 // Display List Builder: Managing the transformation stack.
1753 //------------------------------------------------------------------------------
1754
1755 //------------------------------------------------------------------------------
1756 /// @brief Stashes the current transformation and clip state onto a save
1757 /// stack.
1758 ///
1759 /// @param[in] builder The builder.
1760 ///
1761 IMPELLER_EXPORT
1762 void ImpellerDisplayListBuilderSave(
1763 ImpellerDisplayListBuilder IMPELLER_NONNULL builder);
1764
1765 //------------------------------------------------------------------------------
1766 /// @brief Stashes the current transformation and clip state onto a save
1767 /// stack and creates and creates an offscreen layer onto which
1768 /// subsequent rendering intent will be directed to.
1769 ///
1770 /// On the balancing call to restore, the supplied paints filters
1771 /// and blend modes will be used to composite the offscreen contents
1772 /// back onto the display display list.
1773 ///
1774 /// @param[in] builder The builder.
1775 /// @param[in] bounds The bounds.
1776 /// @param[in] paint The paint.
1777 /// @param[in] backdrop The backdrop.
1778 ///
1779 IMPELLER_EXPORT
1780 void ImpellerDisplayListBuilderSaveLayer(
1781 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1782 const ImpellerRect* IMPELLER_NONNULL bounds,
1783 ImpellerPaint IMPELLER_NULLABLE paint,
1784 ImpellerImageFilter IMPELLER_NULLABLE backdrop);
1785
1786 //------------------------------------------------------------------------------
1787 /// @brief Pops the last entry pushed onto the save stack using a call to
1788 /// `ImpellerDisplayListBuilderSave` or
1789 /// `ImpellerDisplayListBuilderSaveLayer`.
1790 ///
1791 /// @param[in] builder The builder.
1792 ///
1793 IMPELLER_EXPORT
1794 void ImpellerDisplayListBuilderRestore(
1795 ImpellerDisplayListBuilder IMPELLER_NONNULL builder);
1796
1797 //------------------------------------------------------------------------------
1798 /// @brief Apply a scale to the transformation matrix currently on top of
1799 /// the save stack.
1800 ///
1801 /// @param[in] builder The builder.
1802 /// @param[in] x_scale The x scale.
1803 /// @param[in] y_scale The y scale.
1804 ///
1805 IMPELLER_EXPORT
1806 void ImpellerDisplayListBuilderScale(
1807 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1808 float x_scale,
1809 float y_scale);
1810
1811 //------------------------------------------------------------------------------
1812 /// @brief Apply a clockwise rotation to the transformation matrix
1813 /// currently on top of the save stack.
1814 ///
1815 /// @param[in] builder The builder.
1816 /// @param[in] angle_degrees The angle in degrees.
1817 ///
1818
1819 IMPELLER_EXPORT
1820 void ImpellerDisplayListBuilderRotate(
1821 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1822 float angle_degrees);
1823
1824 //------------------------------------------------------------------------------
1825 /// @brief Apply a translation to the transformation matrix currently on
1826 /// top of the save stack.
1827 ///
1828 /// @param[in] builder The builder.
1829 /// @param[in] x_translation The x translation.
1830 /// @param[in] y_translation The y translation.
1831 ///
1832 IMPELLER_EXPORT
1833 void ImpellerDisplayListBuilderTranslate(
1834 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1835 float x_translation,
1836 float y_translation);
1837
1838 //------------------------------------------------------------------------------
1839 /// @brief Appends the the provided transformation to the transformation
1840 /// already on the save stack.
1841 ///
1842 /// @param[in] builder The builder.
1843 /// @param[in] transform The transform to append.
1844 ///
1845 IMPELLER_EXPORT
1846 void ImpellerDisplayListBuilderTransform(
1847 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1848 const ImpellerMatrix* IMPELLER_NONNULL transform);
1849
1850 //------------------------------------------------------------------------------
1851 /// @brief Clear the transformation on top of the save stack and replace it
1852 /// with a new value.
1853 ///
1854 /// @param[in] builder The builder.
1855 /// @param[in] transform The new transform.
1856 ///
1857 IMPELLER_EXPORT
1858 void ImpellerDisplayListBuilderSetTransform(
1859 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1860 const ImpellerMatrix* IMPELLER_NONNULL transform);
1861
1862 //------------------------------------------------------------------------------
1863 /// @brief Get the transformation currently built up on the top of the
1864 /// transformation stack.
1865 ///
1866 /// @param[in] builder The builder.
1867 /// @param[out] out_transform The transform.
1868 ///
1869 IMPELLER_EXPORT
1870 void ImpellerDisplayListBuilderGetTransform(
1871 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1872 ImpellerMatrix* IMPELLER_NONNULL out_transform);
1873
1874 //------------------------------------------------------------------------------
1875 /// @brief Reset the transformation on top of the transformation stack to
1876 /// identity.
1877 ///
1878 /// @param[in] builder The builder.
1879 ///
1880 IMPELLER_EXPORT
1881 void ImpellerDisplayListBuilderResetTransform(
1882 ImpellerDisplayListBuilder IMPELLER_NONNULL builder);
1883
1884 //------------------------------------------------------------------------------
1885 /// @brief Get the current size of the save stack.
1886 ///
1887 /// @param[in] builder The builder.
1888 ///
1889 /// @return The save stack size.
1890 ///
1891 IMPELLER_EXPORT
1892 uint32_t ImpellerDisplayListBuilderGetSaveCount(
1893 ImpellerDisplayListBuilder IMPELLER_NONNULL builder);
1894
1895 //------------------------------------------------------------------------------
1896 /// @brief Effectively calls ImpellerDisplayListBuilderRestore till the
1897 /// size of the save stack becomes a specified count.
1898 ///
1899 /// @param[in] builder The builder.
1900 /// @param[in] count The count.
1901 ///
1902 IMPELLER_EXPORT
1903 void ImpellerDisplayListBuilderRestoreToCount(
1904 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1905 uint32_t count);
1906
1907 //------------------------------------------------------------------------------
1908 // Display List Builder: Clipping
1909 //------------------------------------------------------------------------------
1910
1911 //------------------------------------------------------------------------------
1912 /// @brief Reduces the clip region to the intersection of the current clip
1913 /// and the given rectangle taking into account the clip operation.
1914 ///
1915 /// @param[in] builder The builder.
1916 /// @param[in] rect The rectangle.
1917 /// @param[in] op The operation.
1918 ///
1919 IMPELLER_EXPORT
1920 void ImpellerDisplayListBuilderClipRect(
1921 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1922 const ImpellerRect* IMPELLER_NONNULL rect,
1923 ImpellerClipOperation op);
1924
1925 //------------------------------------------------------------------------------
1926 /// @brief Reduces the clip region to the intersection of the current clip
1927 /// and the given oval taking into account the clip operation.
1928 ///
1929 /// @param[in] builder The builder.
1930 /// @param[in] oval_bounds The oval bounds.
1931 /// @param[in] op The operation.
1932 ///
1933 IMPELLER_EXPORT
1934 void ImpellerDisplayListBuilderClipOval(
1935 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1936 const ImpellerRect* IMPELLER_NONNULL oval_bounds,
1937 ImpellerClipOperation op);
1938
1939 //------------------------------------------------------------------------------
1940 /// @brief Reduces the clip region to the intersection of the current clip
1941 /// and the given rounded rectangle taking into account the clip
1942 /// operation.
1943 ///
1944 /// @param[in] builder The builder.
1945 /// @param[in] rect The rectangle.
1946 /// @param[in] radii The radii.
1947 /// @param[in] op The operation.
1948 ///
1949 IMPELLER_EXPORT
1950 void ImpellerDisplayListBuilderClipRoundedRect(
1951 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1952 const ImpellerRect* IMPELLER_NONNULL rect,
1953 const ImpellerRoundingRadii* IMPELLER_NONNULL radii,
1954 ImpellerClipOperation op);
1955
1956 //------------------------------------------------------------------------------
1957 /// @brief Reduces the clip region to the intersection of the current clip
1958 /// and the given path taking into account the clip operation.
1959 ///
1960 /// @param[in] builder The builder.
1961 /// @param[in] path The path.
1962 /// @param[in] op The operation.
1963 ///
1964 IMPELLER_EXPORT
1965 void ImpellerDisplayListBuilderClipPath(
1966 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1967 ImpellerPath IMPELLER_NONNULL path,
1968 ImpellerClipOperation op);
1969
1970 //------------------------------------------------------------------------------
1971 // Display List Builder: Drawing Shapes
1972 //------------------------------------------------------------------------------
1973
1974 //------------------------------------------------------------------------------
1975 /// @brief Fills the current clip with the specified paint.
1976 ///
1977 /// @param[in] builder The builder.
1978 /// @param[in] paint The paint.
1979 ///
1980 IMPELLER_EXPORT
1981 void ImpellerDisplayListBuilderDrawPaint(
1982 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1983 ImpellerPaint IMPELLER_NONNULL paint);
1984
1985 //------------------------------------------------------------------------------
1986 /// @brief Draws a line segment.
1987 ///
1988 /// @param[in] builder The builder.
1989 /// @param[in] from The starting point of the line.
1990 /// @param[in] to The end point of the line.
1991 /// @param[in] paint The paint.
1992 ///
1993 IMPELLER_EXPORT
1994 void ImpellerDisplayListBuilderDrawLine(
1995 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
1996 const ImpellerPoint* IMPELLER_NONNULL from,
1997 const ImpellerPoint* IMPELLER_NONNULL to,
1998 ImpellerPaint IMPELLER_NONNULL paint);
1999
2000 //------------------------------------------------------------------------------
2001 /// @brief Draws a dash line segment.
2002 ///
2003 /// @param[in] builder The builder.
2004 /// @param[in] from The starting point of the line.
2005 /// @param[in] to The end point of the line.
2006 /// @param[in] on_length On length.
2007 /// @param[in] off_length Off length.
2008 /// @param[in] paint The paint.
2009 ///
2010 IMPELLER_EXPORT
2011 void ImpellerDisplayListBuilderDrawDashedLine(
2012 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2013 const ImpellerPoint* IMPELLER_NONNULL from,
2014 const ImpellerPoint* IMPELLER_NONNULL to,
2015 float on_length,
2016 float off_length,
2017 ImpellerPaint IMPELLER_NONNULL paint);
2018
2019 //------------------------------------------------------------------------------
2020 /// @brief Draws a rectangle.
2021 ///
2022 /// @param[in] builder The builder.
2023 /// @param[in] rect The rectangle.
2024 /// @param[in] paint The paint.
2025 ///
2026 IMPELLER_EXPORT
2027 void ImpellerDisplayListBuilderDrawRect(
2028 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2029 const ImpellerRect* IMPELLER_NONNULL rect,
2030 ImpellerPaint IMPELLER_NONNULL paint);
2031
2032 //------------------------------------------------------------------------------
2033 /// @brief Draws an oval.
2034 ///
2035 /// @param[in] builder The builder.
2036 /// @param[in] oval_bounds The oval bounds.
2037 /// @param[in] paint The paint.
2038 ///
2039 IMPELLER_EXPORT
2040 void ImpellerDisplayListBuilderDrawOval(
2041 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2042 const ImpellerRect* IMPELLER_NONNULL oval_bounds,
2043 ImpellerPaint IMPELLER_NONNULL paint);
2044
2045 //------------------------------------------------------------------------------
2046 /// @brief Draws a rounded rect.
2047 ///
2048 /// @param[in] builder The builder.
2049 /// @param[in] rect The rectangle.
2050 /// @param[in] radii The radii.
2051 /// @param[in] paint The paint.
2052 ///
2053 IMPELLER_EXPORT
2054 void ImpellerDisplayListBuilderDrawRoundedRect(
2055 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2056 const ImpellerRect* IMPELLER_NONNULL rect,
2057 const ImpellerRoundingRadii* IMPELLER_NONNULL radii,
2058 ImpellerPaint IMPELLER_NONNULL paint);
2059
2060 //------------------------------------------------------------------------------
2061 /// @brief Draws a shape that is the different between the specified
2062 /// rectangles (each with configurable corner radii).
2063 ///
2064 /// @param[in] builder The builder.
2065 /// @param[in] outer_rect The outer rectangle.
2066 /// @param[in] outer_radii The outer radii.
2067 /// @param[in] inner_rect The inner rectangle.
2068 /// @param[in] inner_radii The inner radii.
2069 /// @param[in] paint The paint.
2070 ///
2071 IMPELLER_EXPORT
2072 void ImpellerDisplayListBuilderDrawRoundedRectDifference(
2073 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2074 const ImpellerRect* IMPELLER_NONNULL outer_rect,
2075 const ImpellerRoundingRadii* IMPELLER_NONNULL outer_radii,
2076 const ImpellerRect* IMPELLER_NONNULL inner_rect,
2077 const ImpellerRoundingRadii* IMPELLER_NONNULL inner_radii,
2078 ImpellerPaint IMPELLER_NONNULL paint);
2079
2080 //------------------------------------------------------------------------------
2081 /// @brief Draws the specified shape.
2082 ///
2083 /// @param[in] builder The builder.
2084 /// @param[in] path The path.
2085 /// @param[in] paint The paint.
2086 ///
2087 IMPELLER_EXPORT
2088 void ImpellerDisplayListBuilderDrawPath(
2089 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2090 ImpellerPath IMPELLER_NONNULL path,
2091 ImpellerPaint IMPELLER_NONNULL paint);
2092
2093 //------------------------------------------------------------------------------
2094 /// @brief Flattens the contents of another display list into the one
2095 /// currently being built.
2096 ///
2097 /// @param[in] builder The builder.
2098 /// @param[in] display_list The display list.
2099 /// @param[in] opacity The opacity.
2100 ///
2101 IMPELLER_EXPORT
2102 void ImpellerDisplayListBuilderDrawDisplayList(
2103 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2104 ImpellerDisplayList IMPELLER_NONNULL display_list,
2105 float opacity);
2106
2107 //------------------------------------------------------------------------------
2108 /// @brief Draw a paragraph at the specified point.
2109 ///
2110 /// @param[in] builder The builder.
2111 /// @param[in] paragraph The paragraph.
2112 /// @param[in] point The point.
2113 ///
2114 IMPELLER_EXPORT
2115 void ImpellerDisplayListBuilderDrawParagraph(
2116 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2117 ImpellerParagraph IMPELLER_NONNULL paragraph,
2118 const ImpellerPoint* IMPELLER_NONNULL point);
2119
2120 //------------------------------------------------------------------------------
2121 /// @brief Draw a shadow for a Path given a material elevation. If the
2122 /// occluding object is not opaque, additional hints (via the
2123 /// `occluder_is_transparent` argument) must be provided to render
2124 /// the shadow correctly.
2125 ///
2126 /// @param[in] builder The builder.
2127 /// @param[in] path The shadow path.
2128 /// @param[in] color The shadow color.
2129 /// @param[in] elevation The material elevation.
2130 /// @param[in] occluder_is_transparent
2131 /// If the object casting the shadow is transparent.
2132 /// @param[in] device_pixel_ratio
2133 /// The device pixel ratio.
2134 ///
2135 IMPELLER_EXPORT
2136 void ImpellerDisplayListBuilderDrawShadow(
2137 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2138 ImpellerPath IMPELLER_NONNULL path,
2139 const ImpellerColor* IMPELLER_NONNULL color,
2140 float elevation,
2141 bool occluder_is_transparent,
2142 float device_pixel_ratio);
2143
2144 //------------------------------------------------------------------------------
2145 // Display List Builder: Drawing Textures
2146 //------------------------------------------------------------------------------
2147
2148 //------------------------------------------------------------------------------
2149 /// @brief Draw a texture at the specified point.
2150 ///
2151 /// @param[in] builder The builder.
2152 /// @param[in] texture The texture.
2153 /// @param[in] point The point.
2154 /// @param[in] sampling The sampling.
2155 /// @param[in] paint The paint.
2156 ///
2157 IMPELLER_EXPORT
2158 void ImpellerDisplayListBuilderDrawTexture(
2159 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2160 ImpellerTexture IMPELLER_NONNULL texture,
2161 const ImpellerPoint* IMPELLER_NONNULL point,
2162 ImpellerTextureSampling sampling,
2163 ImpellerPaint IMPELLER_NULLABLE paint);
2164
2165 //------------------------------------------------------------------------------
2166 /// @brief Draw a portion of texture at the specified location.
2167 ///
2168 /// @param[in] builder The builder.
2169 /// @param[in] texture The texture.
2170 /// @param[in] src_rect The source rectangle.
2171 /// @param[in] dst_rect The destination rectangle.
2172 /// @param[in] sampling The sampling.
2173 /// @param[in] paint The paint.
2174 ///
2175 IMPELLER_EXPORT
2176 void ImpellerDisplayListBuilderDrawTextureRect(
2177 ImpellerDisplayListBuilder IMPELLER_NONNULL builder,
2178 ImpellerTexture IMPELLER_NONNULL texture,
2179 const ImpellerRect* IMPELLER_NONNULL src_rect,
2180 const ImpellerRect* IMPELLER_NONNULL dst_rect,
2181 ImpellerTextureSampling sampling,
2182 ImpellerPaint IMPELLER_NULLABLE paint);
2183
2184 //------------------------------------------------------------------------------
2185 // Typography Context
2186 //------------------------------------------------------------------------------
2187
2188 //------------------------------------------------------------------------------
2189 /// @brief Create a new typography contents.
2190 ///
2191 /// @return The typography context.
2192 ///
2193 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE
2194 ImpellerTypographyContextNew();
2195
2196 //------------------------------------------------------------------------------
2197 /// @brief Retain a strong reference to the object. The object can be NULL
2198 /// in which case this method is a no-op.
2199 ///
2200 /// @param[in] context The typography context.
2201 ///
2202 IMPELLER_EXPORT
2203 void ImpellerTypographyContextRetain(
2204 ImpellerTypographyContext IMPELLER_NULLABLE context);
2205
2206 //------------------------------------------------------------------------------
2207 /// @brief Release a previously retained reference to the object. The
2208 /// object can be NULL in which case this method is a no-op.
2209 ///
2210 /// @param[in] context The typography context.
2211 ///
2212 IMPELLER_EXPORT
2213 void ImpellerTypographyContextRelease(
2214 ImpellerTypographyContext IMPELLER_NULLABLE context);
2215
2216 //------------------------------------------------------------------------------
2217 /// @brief Register a custom font.
2218 ///
2219 /// The following font formats are supported:
2220 /// * OpenType font collections (.ttc extension)
2221 /// * TrueType fonts: (.ttf extension)
2222 /// * OpenType fonts: (.otf extension)
2223 ///
2224 /// @warning Web Open Font Formats (.woff and .woff2 extensions) are **not**
2225 /// supported.
2226 ///
2227 /// The font data is specified as a mapping. It is possible for the
2228 /// release callback of the mapping to not be called even past the
2229 /// destruction of the typography context. Care must be taken to not
2230 /// collect the mapping till the release callback is invoked by
2231 /// Impeller.
2232 ///
2233 /// The family alias name can be NULL. In such cases, the font
2234 /// family specified in paragraph styles must match the family that
2235 /// is specified in the font data.
2236 ///
2237 /// If the family name alias is not NULL, that family name must be
2238 /// used in the paragraph style to reference glyphs from this font
2239 /// instead of the one encoded in the font itself.
2240 ///
2241 /// Multiple fonts (with glyphs for different styles) can be
2242 /// specified with the same family.
2243 ///
2244 /// @see `ImpellerParagraphStyleSetFontFamily`
2245 ///
2246 /// @param[in] context The context.
2247 /// @param[in] contents The contents.
2248 /// @param[in] contents_on_release_user_data The user data baton to be passed
2249 /// to the contents release callback.
2250 /// @param[in] family_name_alias The family name alias or NULL if
2251 /// the one specified in the font
2252 /// data is to be used.
2253 ///
2254 /// @return If the font could be successfully registered.
2255 ///
2256 IMPELLER_EXPORT
2257 bool ImpellerTypographyContextRegisterFont(
2258 ImpellerTypographyContext IMPELLER_NONNULL context,
2259 const ImpellerMapping* IMPELLER_NONNULL contents,
2260 void* IMPELLER_NULLABLE contents_on_release_user_data,
2261 const char* IMPELLER_NULLABLE family_name_alias);
2262
2263 //------------------------------------------------------------------------------
2264 // Paragraph Style
2265 //------------------------------------------------------------------------------
2266
2267 //------------------------------------------------------------------------------
2268 /// @brief Create a new paragraph style.
2269 ///
2270 /// @return The paragraph style.
2271 ///
2272 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE
2273 ImpellerParagraphStyleNew();
2274
2275 //------------------------------------------------------------------------------
2276 /// @brief Retain a strong reference to the object. The object can be NULL
2277 /// in which case this method is a no-op.
2278 ///
2279 /// @param[in] paragraph_style The paragraph style.
2280 ///
2281 IMPELLER_EXPORT
2282 void ImpellerParagraphStyleRetain(
2283 ImpellerParagraphStyle IMPELLER_NULLABLE paragraph_style);
2284
2285 //------------------------------------------------------------------------------
2286 /// @brief Release a previously retained reference to the object. The
2287 /// object can be NULL in which case this method is a no-op.
2288 ///
2289 /// @param[in] paragraph_style The paragraph style.
2290 ///
2291 IMPELLER_EXPORT
2292 void ImpellerParagraphStyleRelease(
2293 ImpellerParagraphStyle IMPELLER_NULLABLE paragraph_style);
2294
2295 //------------------------------------------------------------------------------
2296 /// @brief Set the paint used to render the text glyph contents.
2297 ///
2298 /// @param[in] paragraph_style The paragraph style.
2299 /// @param[in] paint The paint.
2300 ///
2301 IMPELLER_EXPORT
2302 void ImpellerParagraphStyleSetForeground(
2303 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2304 ImpellerPaint IMPELLER_NONNULL paint);
2305
2306 //------------------------------------------------------------------------------
2307 /// @brief Set the paint used to render the background of the text glyphs.
2308 ///
2309 /// @param[in] paragraph_style The paragraph style.
2310 /// @param[in] paint The paint.
2311 ///
2312 IMPELLER_EXPORT
2313 void ImpellerParagraphStyleSetBackground(
2314 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2315 ImpellerPaint IMPELLER_NONNULL paint);
2316
2317 //------------------------------------------------------------------------------
2318 /// @brief Set the weight of the font to select when rendering glyphs.
2319 ///
2320 /// @param[in] paragraph_style The paragraph style.
2321 /// @param[in] weight The weight.
2322 ///
2323 IMPELLER_EXPORT
2324 void ImpellerParagraphStyleSetFontWeight(
2325 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2326 ImpellerFontWeight weight);
2327
2328 //------------------------------------------------------------------------------
2329 /// @brief Set whether the glyphs should be bolded or italicized.
2330 ///
2331 /// @param[in] paragraph_style The paragraph style.
2332 /// @param[in] style The style.
2333 ///
2334 IMPELLER_EXPORT
2335 void ImpellerParagraphStyleSetFontStyle(
2336 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2337 ImpellerFontStyle style);
2338
2339 //------------------------------------------------------------------------------
2340 /// @brief Set the font family.
2341 ///
2342 /// @param[in] paragraph_style The paragraph style.
2343 /// @param[in] family_name The family name.
2344 ///
2345 IMPELLER_EXPORT
2346 void ImpellerParagraphStyleSetFontFamily(
2347 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2348 const char* IMPELLER_NONNULL family_name);
2349
2350 //------------------------------------------------------------------------------
2351 /// @brief Set the font size.
2352 ///
2353 /// @param[in] paragraph_style The paragraph style.
2354 /// @param[in] size The size.
2355 ///
2356 IMPELLER_EXPORT
2357 void ImpellerParagraphStyleSetFontSize(
2358 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2359 float size);
2360
2361 //------------------------------------------------------------------------------
2362 /// @brief The height of the text as a multiple of text size.
2363 ///
2364 /// When height is 0.0, the line height will be determined by the
2365 /// font's metrics directly, which may differ from the font size.
2366 /// Otherwise the line height of the text will be a multiple of font
2367 /// size, and be exactly fontSize * height logical pixels tall.
2368 ///
2369 /// @param[in] paragraph_style The paragraph style.
2370 /// @param[in] height The height.
2371 ///
2372 IMPELLER_EXPORT
2373 void ImpellerParagraphStyleSetHeight(
2374 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2375 float height);
2376
2377 //------------------------------------------------------------------------------
2378 /// @brief Set the alignment of text within the paragraph.
2379 ///
2380 /// @param[in] paragraph_style The paragraph style.
2381 /// @param[in] align The align.
2382 ///
2383 IMPELLER_EXPORT
2384 void ImpellerParagraphStyleSetTextAlignment(
2385 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2386 ImpellerTextAlignment align);
2387
2388 //------------------------------------------------------------------------------
2389 /// @brief Set the directionality of the text within the paragraph.
2390 ///
2391 /// @param[in] paragraph_style The paragraph style.
2392 /// @param[in] direction The direction.
2393 ///
2394 IMPELLER_EXPORT
2395 void ImpellerParagraphStyleSetTextDirection(
2396 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2397 ImpellerTextDirection direction);
2398
2399 //------------------------------------------------------------------------------
2400 /// @brief Set the maximum line count within the paragraph.
2401 ///
2402 /// @param[in] paragraph_style The paragraph style.
2403 /// @param[in] max_lines The maximum lines.
2404 ///
2405 IMPELLER_EXPORT
2406 void ImpellerParagraphStyleSetMaxLines(
2407 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2408 uint32_t max_lines);
2409
2410 //------------------------------------------------------------------------------
2411 /// @brief Set the paragraph locale.
2412 ///
2413 /// @param[in] paragraph_style The paragraph style.
2414 /// @param[in] locale The locale.
2415 ///
2416 IMPELLER_EXPORT
2417 void ImpellerParagraphStyleSetLocale(
2418 ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style,
2419 const char* IMPELLER_NONNULL locale);
2420
2421 //------------------------------------------------------------------------------
2422 // Paragraph Builder
2423 //------------------------------------------------------------------------------
2424
2425 //------------------------------------------------------------------------------
2426 /// @brief Create a new paragraph builder.
2427 ///
2428 /// @param[in] context The context.
2429 ///
2430 /// @return The paragraph builder.
2431 ///
2432 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE
2433 ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context);
2434
2435 //------------------------------------------------------------------------------
2436 /// @brief Retain a strong reference to the object. The object can be NULL
2437 /// in which case this method is a no-op.
2438 ///
2439 /// @param[in] paragraph_builder The paragraph builder.
2440 ///
2441 IMPELLER_EXPORT
2442 void ImpellerParagraphBuilderRetain(
2443 ImpellerParagraphBuilder IMPELLER_NULLABLE paragraph_builder);
2444
2445 //------------------------------------------------------------------------------
2446 /// @brief Release a previously retained reference to the object. The
2447 /// object can be NULL in which case this method is a no-op.
2448 ///
2449 /// @param[in] paragraph_builder The paragraph_builder.
2450 ///
2451 IMPELLER_EXPORT
2452 void ImpellerParagraphBuilderRelease(
2453 ImpellerParagraphBuilder IMPELLER_NULLABLE paragraph_builder);
2454
2455 //------------------------------------------------------------------------------
2456 /// @brief Push a new paragraph style onto the paragraph style stack
2457 /// managed by the paragraph builder.
2458 ///
2459 /// Not all paragraph styles can be combined. For instance, it does
2460 /// not make sense to mix text alignment for different text runs
2461 /// within a paragraph. In such cases, the preference of the the
2462 /// first paragraph style on the style stack will take hold.
2463 ///
2464 /// If text is pushed onto the paragraph builder without a style
2465 /// previously pushed onto the stack, a default paragraph text style
2466 /// will be used. This may not always be desirable because some
2467 /// style element cannot be overridden. It is recommended that a
2468 /// default paragraph style always be pushed onto the stack before
2469 /// the addition of any text.
2470 ///
2471 /// @param[in] paragraph_builder The paragraph builder.
2472 /// @param[in] style The style.
2473 ///
2474 IMPELLER_EXPORT
2475 void ImpellerParagraphBuilderPushStyle(
2476 ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder,
2477 ImpellerParagraphStyle IMPELLER_NONNULL style);
2478
2479 //------------------------------------------------------------------------------
2480 /// @brief Pop a previously pushed paragraph style from the paragraph style
2481 /// stack.
2482 ///
2483 /// @param[in] paragraph_builder The paragraph builder.
2484 ///
2485 IMPELLER_EXPORT
2486 void ImpellerParagraphBuilderPopStyle(
2487 ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder);
2488
2489 //------------------------------------------------------------------------------
2490 /// @brief Add UTF-8 encoded text to the paragraph. The text will be styled
2491 /// according to the paragraph style already on top of the paragraph
2492 /// style stack.
2493 ///
2494 /// @param[in] paragraph_builder The paragraph builder.
2495 /// @param[in] data The data.
2496 /// @param[in] length The length.
2497 ///
2498 IMPELLER_EXPORT
2499 void ImpellerParagraphBuilderAddText(
2500 ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder,
2501 const uint8_t* IMPELLER_NULLABLE data,
2502 uint32_t length);
2503
2504 //------------------------------------------------------------------------------
2505 /// @brief Layout and build a new paragraph using the specified width. The
2506 /// resulting paragraph is immutable. The paragraph builder must be
2507 /// discarded and a new one created to build more paragraphs.
2508 ///
2509 /// @param[in] paragraph_builder The paragraph builder.
2510 /// @param[in] width The paragraph width.
2511 ///
2512 /// @return The paragraph if one can be created, NULL otherwise.
2513 ///
2514 IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraph IMPELLER_NULLABLE
2515 ImpellerParagraphBuilderBuildParagraphNew(
2516 ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder,
2517 float width);
2518
2519 //------------------------------------------------------------------------------
2520 // Paragraph
2521 //------------------------------------------------------------------------------
2522
2523 //------------------------------------------------------------------------------
2524 /// @brief Retain a strong reference to the object. The object can be NULL
2525 /// in which case this method is a no-op.
2526 ///
2527 /// @param[in] paragraph The paragraph.
2528 ///
2529 IMPELLER_EXPORT
2530 void ImpellerParagraphRetain(ImpellerParagraph IMPELLER_NULLABLE paragraph);
2531
2532 //------------------------------------------------------------------------------
2533 /// @brief Release a previously retained reference to the object. The
2534 /// object can be NULL in which case this method is a no-op.
2535 ///
2536 /// @param[in] paragraph The paragraph.
2537 ///
2538 IMPELLER_EXPORT
2539 void ImpellerParagraphRelease(ImpellerParagraph IMPELLER_NULLABLE paragraph);
2540
2541 //------------------------------------------------------------------------------
2542 /// @see `ImpellerParagraphGetMinIntrinsicWidth`
2543 ///
2544 /// @param[in] paragraph The paragraph.
2545 ///
2546 ///
2547 /// @return The width provided to the paragraph builder during the call to
2548 /// layout. This is the maximum width any line in the laid out
2549 /// paragraph can occupy. But, it is not necessarily the actual
2550 /// width of the paragraph after layout.
2551 ///
2552 IMPELLER_EXPORT
2553 float ImpellerParagraphGetMaxWidth(
2554 ImpellerParagraph IMPELLER_NONNULL paragraph);
2555
2556 //------------------------------------------------------------------------------
2557 /// @param[in] paragraph The paragraph.
2558 ///
2559 /// @return The height of the laid out paragraph. This is **not** a tight
2560 /// bounding box and some glyphs may not reach the minimum location
2561 /// they are allowed to reach.
2562 ///
2563 IMPELLER_EXPORT
2564 float ImpellerParagraphGetHeight(ImpellerParagraph IMPELLER_NONNULL paragraph);
2565
2566 //------------------------------------------------------------------------------
2567 /// @param[in] paragraph The paragraph.
2568 ///
2569 /// @return The length of the longest line in the paragraph. This is the
2570 /// horizontal distance between the left edge of the leftmost glyph
2571 /// and the right edge of the rightmost glyph, in the longest line
2572 /// in the paragraph.
2573 ///
2574 IMPELLER_EXPORT
2575 float ImpellerParagraphGetLongestLineWidth(
2576 ImpellerParagraph IMPELLER_NONNULL paragraph);
2577
2578 //------------------------------------------------------------------------------
2579 /// @see `ImpellerParagraphGetMaxWidth`
2580 ///
2581 /// @param[in] paragraph The paragraph.
2582 ///
2583 /// @return The actual width of the longest line in the paragraph after
2584 /// layout. This is expected to be less than or equal to
2585 /// `ImpellerParagraphGetMaxWidth`.
2586 ///
2587 IMPELLER_EXPORT
2588 float ImpellerParagraphGetMinIntrinsicWidth(
2589 ImpellerParagraph IMPELLER_NONNULL paragraph);
2590
2591 //------------------------------------------------------------------------------
2592 /// @param[in] paragraph The paragraph.
2593 ///
2594 /// @return The width of the paragraph without line breaking.
2595 ///
2596 IMPELLER_EXPORT
2597 float ImpellerParagraphGetMaxIntrinsicWidth(
2598 ImpellerParagraph IMPELLER_NONNULL paragraph);
2599
2600 //------------------------------------------------------------------------------
2601 /// @param[in] paragraph The paragraph.
2602 ///
2603 /// @return The distance from the top of the paragraph to the ideographic
2604 /// baseline of the first line when using ideographic fonts
2605 /// (Japanese, Korean, etc...).
2606 ///
2607 IMPELLER_EXPORT
2608 float ImpellerParagraphGetIdeographicBaseline(
2609 ImpellerParagraph IMPELLER_NONNULL paragraph);
2610
2611 //------------------------------------------------------------------------------
2612 /// @param[in] paragraph The paragraph.
2613 ///
2614 /// @return The distance from the top of the paragraph to the alphabetic
2615 /// baseline of the first line when using alphabetic fonts (A-Z,
2616 /// a-z, Greek, etc...).
2617 ///
2618 IMPELLER_EXPORT
2619 float ImpellerParagraphGetAlphabeticBaseline(
2620 ImpellerParagraph IMPELLER_NONNULL paragraph);
2621
2622 //------------------------------------------------------------------------------
2623 /// @param[in] paragraph The paragraph.
2624 ///
2625 /// @return The number of lines visible in the paragraph after line
2626 /// breaking.
2627 ///
2628 IMPELLER_EXPORT
2629 uint32_t ImpellerParagraphGetLineCount(
2630 ImpellerParagraph IMPELLER_NONNULL paragraph);
2631
2632 //------------------------------------------------------------------------------
2633 /// @brief Get the range into the UTF-16 code unit buffer that represents
2634 /// the word at the specified caret location in the same buffer.
2635 ///
2636 /// Word boundaries are defined more precisely in [Unicode Standard
2637 /// Annex #29](http://www.unicode.org/reports/tr29/#Word_Boundaries)
2638 ///
2639 /// @param[in] paragraph The paragraph
2640 /// @param[in] code_unit_index The code unit index
2641 ///
2642 /// @return The impeller range.
2643 ///
2644 IMPELLER_EXPORT
2645 ImpellerRange ImpellerParagraphGetWordBoundary(
2646 ImpellerParagraph IMPELLER_NONNULL paragraph,
2647 size_t code_unit_index);
2648
2649 //------------------------------------------------------------------------------
2650 /// @brief Get the line metrics of this laid out paragraph. Calculating the
2651 /// line metrics is expensive. The first time line metrics are
2652 /// requested, they will be cached along with the paragraph (which
2653 /// is immutable).
2654 ///
2655 /// @param[in] paragraph The paragraph.
2656 ///
2657 /// @return The line metrics.
2658 ///
2659 IMPELLER_EXPORT
2660 ImpellerLineMetrics IMPELLER_NULLABLE ImpellerParagraphGetLineMetrics(
2661 ImpellerParagraph IMPELLER_NONNULL paragraph);
2662
2663 //------------------------------------------------------------------------------
2664 /// @brief Create a new instance of glyph info that can be queried for
2665 /// information about the glyph at the given UTF-16 code unit index.
2666 /// The instance must be freed using `ImpellerGlyphInfoRelease`.
2667 ///
2668 /// @param[in] paragraph The paragraph.
2669 /// @param[in] code_unit_index The UTF-16 code unit index.
2670 ///
2671 /// @return The glyph information.
2672 ///
2673 IMPELLER_EXPORT
2674 IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE
2675 ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew(
2676 ImpellerParagraph IMPELLER_NONNULL paragraph,
2677 size_t code_unit_index);
2678
2679 //------------------------------------------------------------------------------
2680 /// @brief Create a new instance of glyph info that can be queried for
2681 /// information about the glyph closest to the specified coordinates
2682 /// relative to the origin of the paragraph. The instance must be
2683 /// freed using `ImpellerGlyphInfoRelease`.
2684 ///
2685 /// @param[in] paragraph The paragraph.
2686 /// @param[in] x The x coordinate relative to paragraph origin.
2687 /// @param[in] y The x coordinate relative to paragraph origin.
2688 ///
2689 /// @return The glyph information.
2690 ///
2691 IMPELLER_EXPORT
2692 IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE
2693 ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew(
2694 ImpellerParagraph IMPELLER_NONNULL paragraph,
2695 double x,
2696 double y);
2697
2698 //------------------------------------------------------------------------------
2699 // Line Metrics
2700 //------------------------------------------------------------------------------
2701
2702 //------------------------------------------------------------------------------
2703 /// @brief Retain a strong reference to the object. The object can be NULL
2704 /// in which case this method is a no-op.
2705 ///
2706 /// @param[in] line_metrics The line metrics.
2707 ///
2708 IMPELLER_EXPORT
2709 void ImpellerLineMetricsRetain(
2710 ImpellerLineMetrics IMPELLER_NULLABLE line_metrics);
2711
2712 //------------------------------------------------------------------------------
2713 /// @brief Release a previously retained reference to the object. The
2714 /// object can be NULL in which case this method is a no-op.
2715 ///
2716 /// @param[in] line_metrics The line metrics.
2717 ///
2718 IMPELLER_EXPORT
2719 void ImpellerLineMetricsRelease(
2720 ImpellerLineMetrics IMPELLER_NULLABLE line_metrics);
2721
2722 //------------------------------------------------------------------------------
2723 /// @brief The rise from the baseline as calculated from the font and style
2724 /// for this line ignoring the height from the text style.
2725 ///
2726 /// @param[in] metrics The metrics.
2727 /// @param[in] line The line index (zero based).
2728 ///
2729 /// @return The unscaled ascent.
2730 ///
2731 IMPELLER_EXPORT
2732 double ImpellerLineMetricsGetUnscaledAscent(
2733 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2734 size_t line);
2735
2736 //------------------------------------------------------------------------------
2737 /// @brief The rise from the baseline as calculated from the font and style
2738 /// for this line.
2739 ///
2740 /// @param[in] metrics The metrics.
2741 /// @param[in] line The line index (zero based).
2742 ///
2743 /// @return The ascent.
2744 ///
2745 IMPELLER_EXPORT
2746 double ImpellerLineMetricsGetAscent(
2747 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2748 size_t line);
2749
2750 //------------------------------------------------------------------------------
2751 /// @brief The drop from the baseline as calculated from the font and style
2752 /// for this line.
2753 ///
2754 /// @param[in] metrics The metrics.
2755 /// @param[in] line The line index (zero based).
2756 ///
2757 /// @return The descent.
2758 ///
2759 IMPELLER_EXPORT
2760 double ImpellerLineMetricsGetDescent(
2761 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2762 size_t line);
2763
2764 //------------------------------------------------------------------------------
2765 /// @brief The y coordinate of the baseline for this line from the top of
2766 /// the paragraph.
2767 ///
2768 /// @param[in] metrics The metrics.
2769 /// @param[in] line The line index (zero based).
2770 ///
2771 /// @return The baseline.
2772 ///
2773 IMPELLER_EXPORT
2774 double ImpellerLineMetricsGetBaseline(
2775 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2776 size_t line);
2777
2778 //------------------------------------------------------------------------------
2779 /// @brief Used to determine if this line ends with an explicit line break
2780 /// (e.g. '\n') or is the end of the paragraph.
2781 ///
2782 /// @param[in] metrics The metrics.
2783 /// @param[in] line The line index (zero based).
2784 ///
2785 /// @return True if the line is a hard break.
2786 ///
2787 IMPELLER_EXPORT
2788 bool ImpellerLineMetricsIsHardbreak(
2789 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2790 size_t line);
2791
2792 //------------------------------------------------------------------------------
2793 /// @brief Width of the line from the left edge of the leftmost glyph to
2794 /// the right edge of the rightmost glyph.
2795 ///
2796 /// @param[in] metrics The metrics.
2797 /// @param[in] line The line index (zero based).
2798 ///
2799 /// @return The width.
2800 ///
2801 IMPELLER_EXPORT
2802 double ImpellerLineMetricsGetWidth(ImpellerLineMetrics IMPELLER_NONNULL metrics,
2803 size_t line);
2804
2805 //------------------------------------------------------------------------------
2806 /// @brief Total height of the line from the top edge to the bottom edge.
2807 ///
2808 /// @param[in] metrics The metrics.
2809 /// @param[in] line The line index (zero based).
2810 ///
2811 /// @return The height.
2812 ///
2813 IMPELLER_EXPORT
2814 double ImpellerLineMetricsGetHeight(
2815 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2816 size_t line);
2817
2818 //------------------------------------------------------------------------------
2819 /// @brief The x coordinate of left edge of the line.
2820 ///
2821 /// @param[in] metrics The metrics.
2822 /// @param[in] line The line index (zero based).
2823 ///
2824 /// @return The left edge coordinate.
2825 ///
2826 IMPELLER_EXPORT
2827 double ImpellerLineMetricsGetLeft(ImpellerLineMetrics IMPELLER_NONNULL metrics,
2828 size_t line);
2829
2830 //------------------------------------------------------------------------------
2831 /// @brief Fetch the start index in the buffer of UTF-16 code units used to
2832 /// represent the paragraph line.
2833 ///
2834 /// @param[in] metrics The metrics.
2835 /// @param[in] line The line index (zero based).
2836 ///
2837 /// @return The UTF-16 code units start index.
2838 ///
2839 IMPELLER_EXPORT
2840 size_t ImpellerLineMetricsGetCodeUnitStartIndex(
2841 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2842 size_t line);
2843
2844 //------------------------------------------------------------------------------
2845 /// @brief Fetch the end index in the buffer of UTF-16 code units used to
2846 /// represent the paragraph line.
2847 ///
2848 /// @param[in] metrics The metrics.
2849 /// @param[in] line The line index (zero based).
2850 ///
2851 /// @return The UTF-16 code units end index.
2852 ///
2853 IMPELLER_EXPORT
2854 size_t ImpellerLineMetricsGetCodeUnitEndIndex(
2855 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2856 size_t line);
2857
2858 //------------------------------------------------------------------------------
2859 /// @brief Fetch the end index (excluding whitespace) in the buffer of
2860 /// UTF-16 code units used to represent the paragraph line.
2861 ///
2862 /// @param[in] metrics The metrics.
2863 /// @param[in] line The line index (zero based).
2864 ///
2865 /// @return The UTF-16 code units end index excluding whitespace.
2866 ///
2867 IMPELLER_EXPORT
2868 size_t ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(
2869 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2870 size_t line);
2871
2872 //------------------------------------------------------------------------------
2873 /// @brief Fetch the end index (including newlines) in the buffer of UTF-16
2874 /// code units used to represent the paragraph line.
2875 ///
2876 /// @param[in] metrics The metrics.
2877 /// @param[in] line The line index (zero based).
2878 ///
2879 /// @return The UTF-16 code units end index including newlines.
2880 ///
2881 IMPELLER_EXPORT
2882 size_t ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(
2883 ImpellerLineMetrics IMPELLER_NONNULL metrics,
2884 size_t line);
2885
2886 //------------------------------------------------------------------------------
2887 // Glyph Info
2888 //------------------------------------------------------------------------------
2889
2890 //------------------------------------------------------------------------------
2891 /// @brief Retain a strong reference to the object. The object can be NULL
2892 /// in which case this method is a no-op.
2893 ///
2894 /// @param[in] glyph_info The glyph information.
2895 ///
2896 IMPELLER_EXPORT
2897 void ImpellerGlyphInfoRetain(ImpellerGlyphInfo IMPELLER_NULLABLE glyph_info);
2898
2899 //------------------------------------------------------------------------------
2900 /// @brief Release a previously retained reference to the object. The
2901 /// object can be NULL in which case this method is a no-op.
2902 ///
2903 /// @param[in] glyph_info The glyph information.
2904 ///
2905 IMPELLER_EXPORT
2906 void ImpellerGlyphInfoRelease(ImpellerGlyphInfo IMPELLER_NULLABLE glyph_info);
2907
2908 //------------------------------------------------------------------------------
2909 /// @brief Fetch the start index in the buffer of UTF-16 code units used to
2910 /// represent the grapheme cluster for a glyph.
2911 ///
2912 /// @param[in] glyph_info The glyph information.
2913 ///
2914 /// @return The UTF-16 code units start index.
2915 ///
2916 IMPELLER_EXPORT
2917 size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(
2918 ImpellerGlyphInfo IMPELLER_NONNULL glyph_info);
2919
2920 //------------------------------------------------------------------------------
2921 /// @brief Fetch the end index in the buffer of UTF-16 code units used to
2922 /// represent the grapheme cluster for a glyph.
2923 ///
2924 /// @param[in] glyph_info The glyph information.
2925 ///
2926 /// @return The UTF-16 code units end index.
2927 ///
2928 IMPELLER_EXPORT
2929 size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(
2930 ImpellerGlyphInfo IMPELLER_NONNULL glyph_info);
2931
2932 //------------------------------------------------------------------------------
2933 /// @brief Fetch the bounds of the grapheme cluster for the glyph in the
2934 /// coordinate space of the paragraph.
2935 ///
2936 /// @param[in] glyph_info The glyph information.
2937 ///
2938 /// @return The grapheme cluster bounds.
2939 ///
2940 IMPELLER_EXPORT
2941 ImpellerRect ImpellerGlyphInfoGetGraphemeClusterBounds(
2942 ImpellerGlyphInfo IMPELLER_NONNULL glyph_info);
2943
2944 //------------------------------------------------------------------------------
2945 /// @param[in] glyph_info The glyph information.
2946 ///
2947 /// @return True if the glyph represents an ellipsis. False otherwise.
2948 ///
2949 IMPELLER_EXPORT
2950 bool ImpellerGlyphInfoIsEllipsis(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info);
2951
2952 //------------------------------------------------------------------------------
2953 /// @param[in] glyph_info The glyph information.
2954 ///
2955 /// @return The direction of the run that contains the glyph.
2956 ///
2957 IMPELLER_EXPORT
2958 ImpellerTextDirection ImpellerGlyphInfoGetTextDirection(
2959 ImpellerGlyphInfo IMPELLER_NONNULL glyph_info);
2960
2961 IMPELLER_EXTERN_C_END
2962
2963 // NOLINTEND(google-objc-function-naming)
2964
2965 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_H_
x
int32_t x
Definition: dl_golden_unittests.cc:458
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
ImpellerColorSourceRelease
IMPELLER_EXPORT void ImpellerColorSourceRelease(ImpellerColorSource IMPELLER_NULLABLE color_source)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerDisplayListBuilderTranslate
IMPELLER_EXPORT void ImpellerDisplayListBuilderTranslate(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, float x_translation, float y_translation)
Apply a translation to the transformation matrix currently on top of the save stack.
ImpellerDisplayListBuilderDrawParagraph
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawParagraph(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerParagraph IMPELLER_NONNULL paragraph, const ImpellerPoint *IMPELLER_NONNULL point)
Draw a paragraph at the specified point.
ImpellerDisplayListBuilderClipRect
IMPELLER_EXPORT void ImpellerDisplayListBuilderClipRect(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect, ImpellerClipOperation op)
Reduces the clip region to the intersection of the current clip and the given rectangle taking into a...
ImpellerDisplayListBuilderScale
IMPELLER_EXPORT void ImpellerDisplayListBuilderScale(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, float x_scale, float y_scale)
Apply a scale to the transformation matrix currently on top of the save stack.
ImpellerDisplayListBuilderSaveLayer
IMPELLER_EXPORT void ImpellerDisplayListBuilderSaveLayer(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL bounds, ImpellerPaint IMPELLER_NULLABLE paint, ImpellerImageFilter IMPELLER_NULLABLE backdrop)
Stashes the current transformation and clip state onto a save stack and creates and creates an offscr...
ImpellerDisplayListBuilderDrawRoundedRectDifference
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawRoundedRectDifference(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL outer_rect, const ImpellerRoundingRadii *IMPELLER_NONNULL outer_radii, const ImpellerRect *IMPELLER_NONNULL inner_rect, const ImpellerRoundingRadii *IMPELLER_NONNULL inner_radii, ImpellerPaint IMPELLER_NONNULL paint)
Draws a shape that is the different between the specified rectangles (each with configurable corner r...
ImpellerPaintSetDrawStyle
IMPELLER_EXPORT void ImpellerPaintSetDrawStyle(ImpellerPaint IMPELLER_NONNULL paint, ImpellerDrawStyle style)
Set the paint draw style. The style controls if the closed shapes are filled and/or stroked.
ImpellerParagraphGetHeight
IMPELLER_EXPORT float ImpellerParagraphGetHeight(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerFillType
ImpellerFillType
Definition: impeller.h:355
kImpellerFillTypeOdd
@ kImpellerFillTypeOdd
Definition: impeller.h:357
kImpellerFillTypeNonZero
@ kImpellerFillTypeNonZero
Definition: impeller.h:356
ImpellerParagraphGetLongestLineWidth
IMPELLER_EXPORT float ImpellerParagraphGetLongestLineWidth(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerTextDirection
ImpellerTextDirection
Definition: impeller.h:470
kImpellerTextDirectionLTR
@ kImpellerTextDirectionLTR
Definition: impeller.h:472
kImpellerTextDirectionRTL
@ kImpellerTextDirectionRTL
Definition: impeller.h:471
ImpellerTypographyContextRegisterFont
IMPELLER_EXPORT bool ImpellerTypographyContextRegisterFont(ImpellerTypographyContext IMPELLER_NONNULL context, const ImpellerMapping *IMPELLER_NONNULL contents, void *IMPELLER_NULLABLE contents_on_release_user_data, const char *IMPELLER_NULLABLE family_name_alias)
Register a custom font.
ImpellerTextureSampling
ImpellerTextureSampling
Definition: impeller.h:419
kImpellerTextureSamplingNearestNeighbor
@ kImpellerTextureSamplingNearestNeighbor
Definition: impeller.h:420
kImpellerTextureSamplingLinear
@ kImpellerTextureSamplingLinear
Definition: impeller.h:421
ImpellerPathBuilderRelease
IMPELLER_EXPORT void ImpellerPathBuilderRelease(ImpellerPathBuilder IMPELLER_NULLABLE builder)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerDisplayListBuilderRetain
IMPELLER_EXPORT void ImpellerDisplayListBuilderRetain(ImpellerDisplayListBuilder IMPELLER_NULLABLE builder)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerPathBuilderMoveTo
IMPELLER_EXPORT void ImpellerPathBuilderMoveTo(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL location)
Move the cursor to the specified location.
ImpellerPaintRelease
IMPELLER_EXPORT void ImpellerPaintRelease(ImpellerPaint IMPELLER_NULLABLE paint)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerPaintSetStrokeCap
IMPELLER_EXPORT void ImpellerPaintSetStrokeCap(ImpellerPaint IMPELLER_NONNULL paint, ImpellerStrokeCap cap)
Sets how strokes rendered using this paint are capped.
ImpellerImageFilterRelease
IMPELLER_EXPORT void ImpellerImageFilterRelease(ImpellerImageFilter IMPELLER_NULLABLE image_filter)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerSurfacePresent
IMPELLER_EXPORT bool ImpellerSurfacePresent(ImpellerSurface IMPELLER_NONNULL surface)
Present the surface to the underlying window system.
ImpellerDisplayListBuilderResetTransform
IMPELLER_EXPORT void ImpellerDisplayListBuilderResetTransform(ImpellerDisplayListBuilder IMPELLER_NONNULL builder)
Reset the transformation on top of the transformation stack to identity.
ImpellerDisplayListBuilderClipPath
IMPELLER_EXPORT void ImpellerDisplayListBuilderClipPath(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerPath IMPELLER_NONNULL path, ImpellerClipOperation op)
Reduces the clip region to the intersection of the current clip and the given path taking into accoun...
ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd
IMPELLER_EXPORT size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info)
Fetch the end index in the buffer of UTF-16 code units used to represent the grapheme cluster for a g...
ImpellerLineMetricsGetDescent
IMPELLER_EXPORT double ImpellerLineMetricsGetDescent(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
The drop from the baseline as calculated from the font and style for this line.
ImpellerParagraphBuilderPopStyle
IMPELLER_EXPORT void ImpellerParagraphBuilderPopStyle(ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder)
Pop a previously pushed paragraph style from the paragraph style stack.
ImpellerPaintSetImageFilter
IMPELLER_EXPORT void ImpellerPaintSetImageFilter(ImpellerPaint IMPELLER_NONNULL paint, ImpellerImageFilter IMPELLER_NONNULL image_filter)
Set the image filter of a paint.
ImpellerDisplayListBuilderRestore
IMPELLER_EXPORT void ImpellerDisplayListBuilderRestore(ImpellerDisplayListBuilder IMPELLER_NONNULL builder)
Pops the last entry pushed onto the save stack using a call to ImpellerDisplayListBuilderSave or Impe...
ImpellerImageFilterCreateComposeNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE ImpellerImageFilterCreateComposeNew(ImpellerImageFilter IMPELLER_NONNULL outer, ImpellerImageFilter IMPELLER_NONNULL inner)
Creates a composed filter that when applied is identical to subsequently applying the inner and then ...
ImpellerLineMetricsIsHardbreak
IMPELLER_EXPORT bool ImpellerLineMetricsIsHardbreak(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Used to determine if this line ends with an explicit line break (e.g. ' ') or is the end of the parag...
ImpellerParagraphStyleRelease
IMPELLER_EXPORT void ImpellerParagraphStyleRelease(ImpellerParagraphStyle IMPELLER_NULLABLE paragraph_style)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
IMPELLER_DEFINE_HANDLE
#define IMPELLER_DEFINE_HANDLE(handle)
Definition: impeller.h:142
ImpellerPaintSetStrokeMiter
IMPELLER_EXPORT void ImpellerPaintSetStrokeMiter(ImpellerPaint IMPELLER_NONNULL paint, float miter)
Set the miter limit of the strokes rendered using this paint.
ImpellerColorFilterCreateBlendNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE ImpellerColorFilterCreateBlendNew(const ImpellerColor *IMPELLER_NONNULL color, ImpellerBlendMode blend_mode)
Create a color filter that performs blending of pixel values independently.
ImpellerSurfaceRelease
IMPELLER_EXPORT void ImpellerSurfaceRelease(ImpellerSurface IMPELLER_NULLABLE surface)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerContextCreateMetalNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE ImpellerContextCreateMetalNew(uint32_t version)
Create a Metal context using the system default Metal device.
ImpellerImageFilterCreateBlurNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE ImpellerImageFilterCreateBlurNew(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
Creates an image filter that applies a Gaussian blur.
ImpellerPathBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE ImpellerPathBuilderNew()
Create a new path builder. Paths themselves are immutable. A builder builds these immutable paths.
ImpellerDisplayListBuilderSave
IMPELLER_EXPORT void ImpellerDisplayListBuilderSave(ImpellerDisplayListBuilder IMPELLER_NONNULL builder)
Stashes the current transformation and clip state onto a save stack.
ImpellerTypographyContextRelease
IMPELLER_EXPORT void ImpellerTypographyContextRelease(ImpellerTypographyContext IMPELLER_NULLABLE context)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerTextureRelease
IMPELLER_EXPORT void ImpellerTextureRelease(ImpellerTexture IMPELLER_NULLABLE texture)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerParagraphBuilderRetain
IMPELLER_EXPORT void ImpellerParagraphBuilderRetain(ImpellerParagraphBuilder IMPELLER_NULLABLE paragraph_builder)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerSurfaceRetain
IMPELLER_EXPORT void ImpellerSurfaceRetain(ImpellerSurface IMPELLER_NULLABLE surface)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
IMPELLER_NULLABLE
#define IMPELLER_NULLABLE
Definition: impeller.h:57
ImpellerDisplayListBuilderTransform
IMPELLER_EXPORT void ImpellerDisplayListBuilderTransform(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerMatrix *IMPELLER_NONNULL transform)
Appends the the provided transformation to the transformation already on the save stack.
ImpellerDisplayListBuilderDrawRect
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawRect(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect, ImpellerPaint IMPELLER_NONNULL paint)
Draws a rectangle.
ImpellerGlyphInfoIsEllipsis
IMPELLER_EXPORT bool ImpellerGlyphInfoIsEllipsis(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info)
ImpellerDisplayListBuilderGetSaveCount
IMPELLER_EXPORT uint32_t ImpellerDisplayListBuilderGetSaveCount(ImpellerDisplayListBuilder IMPELLER_NONNULL builder)
Get the current size of the save stack.
ImpellerMaskFilterRetain
IMPELLER_EXPORT void ImpellerMaskFilterRetain(ImpellerMaskFilter IMPELLER_NULLABLE mask_filter)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerParagraphStyleSetFontStyle
IMPELLER_EXPORT void ImpellerParagraphStyleSetFontStyle(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerFontStyle style)
Set whether the glyphs should be bolded or italicized.
ImpellerParagraphBuilderAddText
IMPELLER_EXPORT void ImpellerParagraphBuilderAddText(ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder, const uint8_t *IMPELLER_NULLABLE data, uint32_t length)
Add UTF-8 encoded text to the paragraph. The text will be styled according to the paragraph style alr...
ImpellerDisplayListBuilderDrawTexture
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawTexture(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerTexture IMPELLER_NONNULL texture, const ImpellerPoint *IMPELLER_NONNULL point, ImpellerTextureSampling sampling, ImpellerPaint IMPELLER_NULLABLE paint)
Draw a texture at the specified point.
IMPELLER_EXTERN_C_END
#define IMPELLER_EXTERN_C_END
Definition: impeller.h:38
ImpellerPaintNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE ImpellerPaintNew()
Create a new paint with default values.
ImpellerLineMetricsGetCodeUnitStartIndex
IMPELLER_EXPORT size_t ImpellerLineMetricsGetCodeUnitStartIndex(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Fetch the start index in the buffer of UTF-16 code units used to represent the paragraph line.
ImpellerDisplayListBuilderClipRoundedRect
IMPELLER_EXPORT void ImpellerDisplayListBuilderClipRoundedRect(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect, const ImpellerRoundingRadii *IMPELLER_NONNULL radii, ImpellerClipOperation op)
Reduces the clip region to the intersection of the current clip and the given rounded rectangle takin...
ImpellerTextureGetOpenGLHandle
IMPELLER_EXPORT uint64_t ImpellerTextureGetOpenGLHandle(ImpellerTexture IMPELLER_NONNULL texture)
Get the OpenGL handle associated with this texture. If this is not an OpenGL texture,...
ImpellerColorFilterCreateColorMatrixNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE ImpellerColorFilterCreateColorMatrixNew(const ImpellerColorMatrix *IMPELLER_NONNULL color_matrix)
Create a color filter that transforms pixel color values independently.
ImpellerParagraphRetain
IMPELLER_EXPORT void ImpellerParagraphRetain(ImpellerParagraph IMPELLER_NULLABLE paragraph)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerDisplayListBuilderCreateDisplayListNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayList IMPELLER_NULLABLE ImpellerDisplayListBuilderCreateDisplayListNew(ImpellerDisplayListBuilder IMPELLER_NONNULL builder)
Create a new display list using the rendering intent already encoded in the builder....
ImpellerLineMetricsGetLeft
IMPELLER_EXPORT double ImpellerLineMetricsGetLeft(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
The x coordinate of left edge of the line.
ImpellerParagraphGetLineCount
IMPELLER_EXPORT uint32_t ImpellerParagraphGetLineCount(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerImageFilterCreateDilateNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE ImpellerImageFilterCreateDilateNew(float x_radius, float y_radius)
Creates an image filter that enhances the per-channel pixel values to the maximum value in a circle a...
ImpellerDisplayListBuilderRelease
IMPELLER_EXPORT void ImpellerDisplayListBuilderRelease(ImpellerDisplayListBuilder IMPELLER_NULLABLE builder)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerContextVulkanSettings
struct ImpellerContextVulkanSettings ImpellerContextVulkanSettings
ImpellerColorSourceCreateRadialGradientNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE ImpellerColorSourceCreateRadialGradientNew(const ImpellerPoint *IMPELLER_NONNULL center, float radius, uint32_t stop_count, const ImpellerColor *IMPELLER_NONNULL colors, const float *IMPELLER_NONNULL stops, ImpellerTileMode tile_mode, const ImpellerMatrix *IMPELLER_NULLABLE transformation)
Create a color source that forms a radial gradient.
ImpellerRoundingRadii
struct ImpellerRoundingRadii ImpellerRoundingRadii
ImpellerMapping
struct ImpellerMapping ImpellerMapping
ImpellerRange
struct ImpellerRange ImpellerRange
ImpellerImageFilterRetain
IMPELLER_EXPORT void ImpellerImageFilterRetain(ImpellerImageFilter IMPELLER_NULLABLE image_filter)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerPathBuilderTakePathNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE ImpellerPathBuilderTakePathNew(ImpellerPathBuilder IMPELLER_NONNULL builder, ImpellerFillType fill)
Create a new path using the existing built-up path. The existing path builder now contains an empty p...
ImpellerLineMetricsRetain
IMPELLER_EXPORT void ImpellerLineMetricsRetain(ImpellerLineMetrics IMPELLER_NULLABLE line_metrics)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerStrokeJoin
ImpellerStrokeJoin
Definition: impeller.h:409
kImpellerStrokeJoinRound
@ kImpellerStrokeJoinRound
Definition: impeller.h:411
kImpellerStrokeJoinBevel
@ kImpellerStrokeJoinBevel
Definition: impeller.h:412
kImpellerStrokeJoinMiter
@ kImpellerStrokeJoinMiter
Definition: impeller.h:410
ImpellerLineMetricsRelease
IMPELLER_EXPORT void ImpellerLineMetricsRelease(ImpellerLineMetrics IMPELLER_NULLABLE line_metrics)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerVulkanSwapchainAcquireNextSurfaceNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE ImpellerVulkanSwapchainAcquireNextSurfaceNew(ImpellerVulkanSwapchain IMPELLER_NONNULL swapchain)
A potentially blocking operation, acquires the next surface to render to. Since this may block,...
ImpellerPaintSetColor
IMPELLER_EXPORT void ImpellerPaintSetColor(ImpellerPaint IMPELLER_NONNULL paint, const ImpellerColor *IMPELLER_NONNULL color)
Set the paint color.
ImpellerPathBuilderAddRect
IMPELLER_EXPORT void ImpellerPathBuilderAddRect(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect)
Adds a rectangle to the path.
ImpellerDisplayListBuilderRotate
IMPELLER_EXPORT void ImpellerDisplayListBuilderRotate(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, float angle_degrees)
Apply a clockwise rotation to the transformation matrix currently on top of the save stack.
ImpellerContextGetVulkanInfo
IMPELLER_EXPORT bool ImpellerContextGetVulkanInfo(ImpellerContext IMPELLER_NONNULL context, ImpellerContextVulkanInfo *IMPELLER_NONNULL out_vulkan_info)
Get internal Vulkan handles managed by the given Vulkan context. Ownership of the handles is still ma...
ImpellerCallback
void(* ImpellerCallback)(void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:329
ImpellerDisplayListBuilderDrawOval
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawOval(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL oval_bounds, ImpellerPaint IMPELLER_NONNULL paint)
Draws an oval.
ImpellerParagraphGetMinIntrinsicWidth
IMPELLER_EXPORT float ImpellerParagraphGetMinIntrinsicWidth(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerDisplayListBuilderDrawLine
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawLine(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL from, const ImpellerPoint *IMPELLER_NONNULL to, ImpellerPaint IMPELLER_NONNULL paint)
Draws a line segment.
ImpellerDisplayListRelease
IMPELLER_EXPORT void ImpellerDisplayListRelease(ImpellerDisplayList IMPELLER_NULLABLE display_list)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerParagraphStyleSetBackground
IMPELLER_EXPORT void ImpellerParagraphStyleSetBackground(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerPaint IMPELLER_NONNULL paint)
Set the paint used to render the background of the text glyphs.
ImpellerParagraphGetMaxWidth
IMPELLER_EXPORT float ImpellerParagraphGetMaxWidth(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerParagraphBuilderBuildParagraphNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraph IMPELLER_NULLABLE ImpellerParagraphBuilderBuildParagraphNew(ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder, float width)
Layout and build a new paragraph using the specified width. The resulting paragraph is immutable....
ImpellerGetVersion
IMPELLER_EXPORT uint32_t ImpellerGetVersion()
Get the version of Impeller standalone API. This is the API that will be accepted for validity checks...
ImpellerParagraphBuilderPushStyle
IMPELLER_EXPORT void ImpellerParagraphBuilderPushStyle(ImpellerParagraphBuilder IMPELLER_NONNULL paragraph_builder, ImpellerParagraphStyle IMPELLER_NONNULL style)
Push a new paragraph style onto the paragraph style stack managed by the paragraph builder.
ImpellerMaskFilterRelease
IMPELLER_EXPORT void ImpellerMaskFilterRelease(ImpellerMaskFilter IMPELLER_NULLABLE mask_filter)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
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...
ImpellerColorFilterRetain
IMPELLER_EXPORT void ImpellerColorFilterRetain(ImpellerColorFilter IMPELLER_NULLABLE color_filter)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerColorSourceCreateImageNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE ImpellerColorSourceCreateImageNew(ImpellerTexture IMPELLER_NONNULL image, ImpellerTileMode horizontal_tile_mode, ImpellerTileMode vertical_tile_mode, ImpellerTextureSampling sampling, const ImpellerMatrix *IMPELLER_NULLABLE transformation)
Create a color source that samples from an image.
ImpellerBlendMode
ImpellerBlendMode
Definition: impeller.h:365
kImpellerBlendModeSaturation
@ kImpellerBlendModeSaturation
Definition: impeller.h:392
kImpellerBlendModeSoftLight
@ kImpellerBlendModeSoftLight
Definition: impeller.h:387
kImpellerBlendModeHardLight
@ kImpellerBlendModeHardLight
Definition: impeller.h:386
kImpellerBlendModeLuminosity
@ kImpellerBlendModeLuminosity
Definition: impeller.h:394
kImpellerBlendModeLighten
@ kImpellerBlendModeLighten
Definition: impeller.h:383
kImpellerBlendModeModulate
@ kImpellerBlendModeModulate
Definition: impeller.h:379
kImpellerBlendModeSourceIn
@ kImpellerBlendModeSourceIn
Definition: impeller.h:371
kImpellerBlendModeDifference
@ kImpellerBlendModeDifference
Definition: impeller.h:388
kImpellerBlendModeClear
@ kImpellerBlendModeClear
Definition: impeller.h:366
kImpellerBlendModeColor
@ kImpellerBlendModeColor
Definition: impeller.h:393
kImpellerBlendModeMultiply
@ kImpellerBlendModeMultiply
Definition: impeller.h:390
kImpellerBlendModeSourceATop
@ kImpellerBlendModeSourceATop
Definition: impeller.h:375
kImpellerBlendModeDestinationOut
@ kImpellerBlendModeDestinationOut
Definition: impeller.h:374
kImpellerBlendModeScreen
@ kImpellerBlendModeScreen
Definition: impeller.h:380
kImpellerBlendModeExclusion
@ kImpellerBlendModeExclusion
Definition: impeller.h:389
kImpellerBlendModeColorBurn
@ kImpellerBlendModeColorBurn
Definition: impeller.h:385
kImpellerBlendModeDarken
@ kImpellerBlendModeDarken
Definition: impeller.h:382
kImpellerBlendModePlus
@ kImpellerBlendModePlus
Definition: impeller.h:378
kImpellerBlendModeOverlay
@ kImpellerBlendModeOverlay
Definition: impeller.h:381
kImpellerBlendModeDestinationIn
@ kImpellerBlendModeDestinationIn
Definition: impeller.h:372
kImpellerBlendModeDestinationATop
@ kImpellerBlendModeDestinationATop
Definition: impeller.h:376
kImpellerBlendModeDestination
@ kImpellerBlendModeDestination
Definition: impeller.h:368
kImpellerBlendModeSourceOver
@ kImpellerBlendModeSourceOver
Definition: impeller.h:369
kImpellerBlendModeXor
@ kImpellerBlendModeXor
Definition: impeller.h:377
kImpellerBlendModeColorDodge
@ kImpellerBlendModeColorDodge
Definition: impeller.h:384
kImpellerBlendModeDestinationOver
@ kImpellerBlendModeDestinationOver
Definition: impeller.h:370
kImpellerBlendModeSource
@ kImpellerBlendModeSource
Definition: impeller.h:367
kImpellerBlendModeSourceOut
@ kImpellerBlendModeSourceOut
Definition: impeller.h:373
kImpellerBlendModeHue
@ kImpellerBlendModeHue
Definition: impeller.h:391
ImpellerImageFilterCreateMatrixNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE ImpellerImageFilterCreateMatrixNew(const ImpellerMatrix *IMPELLER_NONNULL matrix, ImpellerTextureSampling sampling)
Creates an image filter that applies a transformation matrix to the underlying image.
ImpellerFontWeight
ImpellerFontWeight
Definition: impeller.h:444
kImpellerFontWeight400
@ kImpellerFontWeight400
Definition: impeller.h:448
kImpellerFontWeight500
@ kImpellerFontWeight500
Definition: impeller.h:449
kImpellerFontWeight700
@ kImpellerFontWeight700
Definition: impeller.h:451
kImpellerFontWeight200
@ kImpellerFontWeight200
Definition: impeller.h:446
kImpellerFontWeight300
@ kImpellerFontWeight300
Definition: impeller.h:447
kImpellerFontWeight900
@ kImpellerFontWeight900
Definition: impeller.h:453
kImpellerFontWeight800
@ kImpellerFontWeight800
Definition: impeller.h:452
kImpellerFontWeight600
@ kImpellerFontWeight600
Definition: impeller.h:450
kImpellerFontWeight100
@ kImpellerFontWeight100
Definition: impeller.h:445
ImpellerContextVulkanInfo
struct ImpellerContextVulkanInfo ImpellerContextVulkanInfo
ImpellerParagraphStyleSetFontSize
IMPELLER_EXPORT void ImpellerParagraphStyleSetFontSize(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, float size)
Set the font size.
ImpellerParagraphStyleSetLocale
IMPELLER_EXPORT void ImpellerParagraphStyleSetLocale(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, const char *IMPELLER_NONNULL locale)
Set the paragraph locale.
ImpellerGlyphInfoRelease
IMPELLER_EXPORT void ImpellerGlyphInfoRelease(ImpellerGlyphInfo IMPELLER_NULLABLE glyph_info)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerSurfaceDrawDisplayList
IMPELLER_EXPORT bool ImpellerSurfaceDrawDisplayList(ImpellerSurface IMPELLER_NONNULL surface, ImpellerDisplayList IMPELLER_NONNULL display_list)
Draw a display list onto the surface. The same display list can be drawn multiple times to different ...
ImpellerDisplayListRetain
IMPELLER_EXPORT void ImpellerDisplayListRetain(ImpellerDisplayList IMPELLER_NULLABLE display_list)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerParagraphStyleSetMaxLines
IMPELLER_EXPORT void ImpellerParagraphStyleSetMaxLines(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, uint32_t max_lines)
Set the maximum line count within the paragraph.
ImpellerDisplayListBuilderDrawPaint
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawPaint(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerPaint IMPELLER_NONNULL paint)
Fills the current clip with the specified paint.
ImpellerSurfaceCreateWrappedMetalDrawableNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE ImpellerSurfaceCreateWrappedMetalDrawableNew(ImpellerContext IMPELLER_NONNULL context, void *IMPELLER_NONNULL metal_drawable)
Create a surface by wrapping a Metal drawable. This is useful during WSI when the drawable is the bac...
ImpellerLineMetricsGetWidth
IMPELLER_EXPORT double ImpellerLineMetricsGetWidth(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Width of the line from the left edge of the leftmost glyph to the right edge of the rightmost glyph.
ImpellerGlyphInfoGetTextDirection
IMPELLER_EXPORT ImpellerTextDirection ImpellerGlyphInfoGetTextDirection(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info)
ImpellerPaintSetColorFilter
IMPELLER_EXPORT void ImpellerPaintSetColorFilter(ImpellerPaint IMPELLER_NONNULL paint, ImpellerColorFilter IMPELLER_NONNULL color_filter)
Set the color filter of the paint.
ImpellerColorSourceCreateConicalGradientNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE ImpellerColorSourceCreateConicalGradientNew(const ImpellerPoint *IMPELLER_NONNULL start_center, float start_radius, const ImpellerPoint *IMPELLER_NONNULL end_center, float end_radius, uint32_t stop_count, const ImpellerColor *IMPELLER_NONNULL colors, const float *IMPELLER_NONNULL stops, ImpellerTileMode tile_mode, const ImpellerMatrix *IMPELLER_NULLABLE transformation)
Create a color source that forms a conical gradient.
ImpellerPaintSetColorSource
IMPELLER_EXPORT void ImpellerPaintSetColorSource(ImpellerPaint IMPELLER_NONNULL paint, ImpellerColorSource IMPELLER_NONNULL color_source)
Set the color source of the paint.
ImpellerPathBuilderCubicCurveTo
IMPELLER_EXPORT void ImpellerPathBuilderCubicCurveTo(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL control_point_1, const ImpellerPoint *IMPELLER_NONNULL control_point_2, const ImpellerPoint *IMPELLER_NONNULL end_point)
Add a cubic curve whose start point is current cursor location to the specified end point using the t...
ImpellerPathBuilderClose
IMPELLER_EXPORT void ImpellerPathBuilderClose(ImpellerPathBuilder IMPELLER_NONNULL builder)
Close the path.
IMPELLER_EXTERN_C_BEGIN
#define IMPELLER_EXTERN_C_BEGIN
Definition: impeller.h:37
ImpellerVulkanSwapchainCreateNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerVulkanSwapchain IMPELLER_NULLABLE ImpellerVulkanSwapchainCreateNew(ImpellerContext IMPELLER_NONNULL context, void *IMPELLER_NONNULL vulkan_surface_khr)
Create a new Vulkan swapchain using a VkSurfaceKHR instance. Ownership of the surface is transferred ...
ImpellerDisplayListBuilderDrawShadow
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawShadow(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerPath IMPELLER_NONNULL path, const ImpellerColor *IMPELLER_NONNULL color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
Draw a shadow for a Path given a material elevation. If the occluding object is not opaque,...
ImpellerColorMatrix
struct ImpellerColorMatrix ImpellerColorMatrix
ImpellerDisplayListBuilderGetTransform
IMPELLER_EXPORT void ImpellerDisplayListBuilderGetTransform(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerMatrix *IMPELLER_NONNULL out_transform)
Get the transformation currently built up on the top of the transformation stack.
ImpellerDisplayListBuilderClipOval
IMPELLER_EXPORT void ImpellerDisplayListBuilderClipOval(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL oval_bounds, ImpellerClipOperation op)
Reduces the clip region to the intersection of the current clip and the given oval taking into accoun...
ImpellerParagraphGetIdeographicBaseline
IMPELLER_EXPORT float ImpellerParagraphGetIdeographicBaseline(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerLineMetricsGetBaseline
IMPELLER_EXPORT double ImpellerLineMetricsGetBaseline(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
The y coordinate of the baseline for this line from the top of the paragraph.
ImpellerPathRelease
IMPELLER_EXPORT void ImpellerPathRelease(ImpellerPath IMPELLER_NULLABLE path)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerDisplayListBuilderSetTransform
IMPELLER_EXPORT void ImpellerDisplayListBuilderSetTransform(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerMatrix *IMPELLER_NONNULL transform)
Clear the transformation on top of the save stack and replace it with a new value.
ImpellerPaintSetMaskFilter
IMPELLER_EXPORT void ImpellerPaintSetMaskFilter(ImpellerPaint IMPELLER_NONNULL paint, ImpellerMaskFilter IMPELLER_NONNULL mask_filter)
Set the mask filter of a paint.
ImpellerLineMetricsGetCodeUnitEndIndex
IMPELLER_EXPORT size_t ImpellerLineMetricsGetCodeUnitEndIndex(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Fetch the end index in the buffer of UTF-16 code units used to represent the paragraph line.
ImpellerContextCreateOpenGLESNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE ImpellerContextCreateOpenGLESNew(uint32_t version, ImpellerProcAddressCallback IMPELLER_NONNULL gl_proc_address_callback, void *IMPELLER_NULLABLE gl_proc_address_callback_user_data)
Create an OpenGL(ES) Impeller context.
ImpellerGlyphInfoRetain
IMPELLER_EXPORT void ImpellerGlyphInfoRetain(ImpellerGlyphInfo IMPELLER_NULLABLE glyph_info)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerPathBuilderLineTo
IMPELLER_EXPORT void ImpellerPathBuilderLineTo(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL location)
Add a line segment from the current cursor location to the given location. The cursor location is upd...
ImpellerPoint
struct ImpellerPoint ImpellerPoint
ImpellerContextRetain
IMPELLER_EXPORT void ImpellerContextRetain(ImpellerContext IMPELLER_NULLABLE context)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerPathBuilderAddRoundedRect
IMPELLER_EXPORT void ImpellerPathBuilderAddRoundedRect(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect, const ImpellerRoundingRadii *IMPELLER_NONNULL rounding_radii)
Add a rounded rect with potentially non-uniform radii to the path.
ImpellerPathBuilderCopyPathNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE ImpellerPathBuilderCopyPathNew(ImpellerPathBuilder IMPELLER_NONNULL builder, ImpellerFillType fill)
Create a new path by copying the existing built-up path. The existing path can continue being added t...
ImpellerTextureCreateWithContentsNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE ImpellerTextureCreateWithContentsNew(ImpellerContext IMPELLER_NONNULL context, const ImpellerTextureDescriptor *IMPELLER_NONNULL descriptor, const ImpellerMapping *IMPELLER_NONNULL contents, void *IMPELLER_NULLABLE contents_on_release_user_data)
Create a texture with decompressed bytes.
ImpellerContextRelease
IMPELLER_EXPORT void ImpellerContextRelease(ImpellerContext IMPELLER_NULLABLE context)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerDisplayListBuilderDrawDashedLine
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawDashedLine(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL from, const ImpellerPoint *IMPELLER_NONNULL to, float on_length, float off_length, ImpellerPaint IMPELLER_NONNULL paint)
Draws a dash line segment.
ImpellerTextureDescriptor
struct ImpellerTextureDescriptor ImpellerTextureDescriptor
ImpellerDisplayListBuilderDrawDisplayList
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawDisplayList(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerDisplayList IMPELLER_NONNULL display_list, float opacity)
Flattens the contents of another display list into the one currently being built.
ImpellerPaintSetStrokeJoin
IMPELLER_EXPORT void ImpellerPaintSetStrokeJoin(ImpellerPaint IMPELLER_NONNULL paint, ImpellerStrokeJoin join)
Sets how strokes rendered using this paint are joined.
ImpellerParagraphStyleSetTextDirection
IMPELLER_EXPORT void ImpellerParagraphStyleSetTextDirection(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerTextDirection direction)
Set the directionality of the text within the paragraph.
ImpellerMatrix
struct ImpellerMatrix ImpellerMatrix
ImpellerPaintSetBlendMode
IMPELLER_EXPORT void ImpellerPaintSetBlendMode(ImpellerPaint IMPELLER_NONNULL paint, ImpellerBlendMode mode)
Set the paint blend mode. The blend mode controls how the new paints contents are mixed with the valu...
ImpellerParagraphGetWordBoundary
IMPELLER_EXPORT ImpellerRange ImpellerParagraphGetWordBoundary(ImpellerParagraph IMPELLER_NONNULL paragraph, size_t code_unit_index)
Get the range into the UTF-16 code unit buffer that represents the word at the specified caret locati...
ImpellerProcAddressCallback
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:338
ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace
IMPELLER_EXPORT size_t ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Fetch the end index (excluding whitespace) in the buffer of UTF-16 code units used to represent the p...
ImpellerParagraphBuilderRelease
IMPELLER_EXPORT void ImpellerParagraphBuilderRelease(ImpellerParagraphBuilder IMPELLER_NULLABLE paragraph_builder)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerDisplayListBuilderDrawTextureRect
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawTextureRect(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerTexture IMPELLER_NONNULL texture, const ImpellerRect *IMPELLER_NONNULL src_rect, const ImpellerRect *IMPELLER_NONNULL dst_rect, ImpellerTextureSampling sampling, ImpellerPaint IMPELLER_NULLABLE paint)
Draw a portion of texture at the specified location.
ImpellerISize
struct ImpellerISize ImpellerISize
ImpellerTextureRetain
IMPELLER_EXPORT void ImpellerTextureRetain(ImpellerTexture IMPELLER_NULLABLE texture)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerSurfaceCreateWrappedFBONew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE ImpellerSurfaceCreateWrappedFBONew(ImpellerContext IMPELLER_NONNULL context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize *IMPELLER_NONNULL size)
Create a new surface by wrapping an existing framebuffer object. The framebuffer must be complete as ...
ImpellerPathBuilderAddArc
IMPELLER_EXPORT void ImpellerPathBuilderAddArc(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL oval_bounds, float start_angle_degrees, float end_angle_degrees)
Add an arc to the path.
ImpellerRect
struct ImpellerRect ImpellerRect
ImpellerLineMetricsGetUnscaledAscent
IMPELLER_EXPORT double ImpellerLineMetricsGetUnscaledAscent(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
The rise from the baseline as calculated from the font and style for this line ignoring the height fr...
ImpellerParagraphGetMaxIntrinsicWidth
IMPELLER_EXPORT float ImpellerParagraphGetMaxIntrinsicWidth(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerStrokeCap
ImpellerStrokeCap
Definition: impeller.h:403
kImpellerStrokeCapButt
@ kImpellerStrokeCapButt
Definition: impeller.h:404
kImpellerStrokeCapRound
@ kImpellerStrokeCapRound
Definition: impeller.h:405
kImpellerStrokeCapSquare
@ kImpellerStrokeCapSquare
Definition: impeller.h:406
ImpellerVulkanSwapchainRelease
IMPELLER_EXPORT void ImpellerVulkanSwapchainRelease(ImpellerVulkanSwapchain IMPELLER_NULLABLE swapchain)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerLineMetricsGetHeight
IMPELLER_EXPORT double ImpellerLineMetricsGetHeight(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Total height of the line from the top edge to the bottom edge.
ImpellerDrawStyle
ImpellerDrawStyle
Definition: impeller.h:397
kImpellerDrawStyleStroke
@ kImpellerDrawStyleStroke
Definition: impeller.h:399
kImpellerDrawStyleFill
@ kImpellerDrawStyleFill
Definition: impeller.h:398
kImpellerDrawStyleStrokeAndFill
@ kImpellerDrawStyleStrokeAndFill
Definition: impeller.h:400
ImpellerColorSpace
ImpellerColorSpace
Definition: impeller.h:438
kImpellerColorSpaceExtendedSRGB
@ kImpellerColorSpaceExtendedSRGB
Definition: impeller.h:440
kImpellerColorSpaceSRGB
@ kImpellerColorSpaceSRGB
Definition: impeller.h:439
kImpellerColorSpaceDisplayP3
@ kImpellerColorSpaceDisplayP3
Definition: impeller.h:441
ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline
IMPELLER_EXPORT size_t ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
Fetch the end index (including newlines) in the buffer of UTF-16 code units used to represent the par...
ImpellerTileMode
ImpellerTileMode
Definition: impeller.h:424
kImpellerTileModeMirror
@ kImpellerTileModeMirror
Definition: impeller.h:427
kImpellerTileModeClamp
@ kImpellerTileModeClamp
Definition: impeller.h:425
kImpellerTileModeRepeat
@ kImpellerTileModeRepeat
Definition: impeller.h:426
kImpellerTileModeDecal
@ kImpellerTileModeDecal
Definition: impeller.h:428
ImpellerColorSourceCreateSweepGradientNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE ImpellerColorSourceCreateSweepGradientNew(const ImpellerPoint *IMPELLER_NONNULL center, float start, float end, uint32_t stop_count, const ImpellerColor *IMPELLER_NONNULL colors, const float *IMPELLER_NONNULL stops, ImpellerTileMode tile_mode, const ImpellerMatrix *IMPELLER_NULLABLE transformation)
Create a color source that forms a sweep gradient.
ImpellerParagraphStyleNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE ImpellerParagraphStyleNew()
Create a new paragraph style.
ImpellerParagraphStyleSetForeground
IMPELLER_EXPORT void ImpellerParagraphStyleSetForeground(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerPaint IMPELLER_NONNULL paint)
Set the paint used to render the text glyph contents.
ImpellerParagraphRelease
IMPELLER_EXPORT void ImpellerParagraphRelease(ImpellerParagraph IMPELLER_NULLABLE paragraph)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerTextAlignment
ImpellerTextAlignment
Definition: impeller.h:461
kImpellerTextAlignmentJustify
@ kImpellerTextAlignmentJustify
Definition: impeller.h:465
kImpellerTextAlignmentLeft
@ kImpellerTextAlignmentLeft
Definition: impeller.h:462
kImpellerTextAlignmentCenter
@ kImpellerTextAlignmentCenter
Definition: impeller.h:464
kImpellerTextAlignmentRight
@ kImpellerTextAlignmentRight
Definition: impeller.h:463
kImpellerTextAlignmentStart
@ kImpellerTextAlignmentStart
Definition: impeller.h:466
kImpellerTextAlignmentEnd
@ kImpellerTextAlignmentEnd
Definition: impeller.h:467
ImpellerColorSourceRetain
IMPELLER_EXPORT void ImpellerColorSourceRetain(ImpellerColorSource IMPELLER_NULLABLE color_source)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerParagraphStyleSetHeight
IMPELLER_EXPORT void ImpellerParagraphStyleSetHeight(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, float height)
The height of the text as a multiple of text size.
ImpellerTextureCreateWithOpenGLTextureHandleNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE ImpellerTextureCreateWithOpenGLTextureHandleNew(ImpellerContext IMPELLER_NONNULL context, const ImpellerTextureDescriptor *IMPELLER_NONNULL descriptor, uint64_t handle)
Create a texture with an externally created OpenGL texture handle.
ImpellerTypographyContextNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE ImpellerTypographyContextNew()
Create a new typography contents.
ImpellerFontStyle
ImpellerFontStyle
Definition: impeller.h:456
kImpellerFontStyleItalic
@ kImpellerFontStyleItalic
Definition: impeller.h:458
kImpellerFontStyleNormal
@ kImpellerFontStyleNormal
Definition: impeller.h:457
ImpellerPathBuilderQuadraticCurveTo
IMPELLER_EXPORT void ImpellerPathBuilderQuadraticCurveTo(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerPoint *IMPELLER_NONNULL control_point, const ImpellerPoint *IMPELLER_NONNULL end_point)
Add a quadratic curve from whose start point is the cursor to the specified end point using the a sin...
ImpellerPathRetain
IMPELLER_EXPORT void ImpellerPathRetain(ImpellerPath IMPELLER_NULLABLE path)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerClipOperation
ImpellerClipOperation
Definition: impeller.h:360
kImpellerClipOperationIntersect
@ kImpellerClipOperationIntersect
Definition: impeller.h:362
kImpellerClipOperationDifference
@ kImpellerClipOperationDifference
Definition: impeller.h:361
IMPELLER_NONNULL
#define IMPELLER_NONNULL
Definition: impeller.h:58
ImpellerMaskFilterCreateBlurNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerMaskFilter IMPELLER_NULLABLE ImpellerMaskFilterCreateBlurNew(ImpellerBlurStyle style, float sigma)
Create a mask filter that blurs contents in the masked shape.
ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin
IMPELLER_EXPORT size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info)
Fetch the start index in the buffer of UTF-16 code units used to represent the grapheme cluster for a...
ImpellerDisplayListBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE ImpellerDisplayListBuilderNew(const ImpellerRect *IMPELLER_NULLABLE cull_rect)
Create a new display list builder.
ImpellerDisplayListBuilderDrawPath
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawPath(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, ImpellerPath IMPELLER_NONNULL path, ImpellerPaint IMPELLER_NONNULL paint)
Draws the specified shape.
IMPELLER_EXPORT
#define IMPELLER_EXPORT
Definition: impeller.h:48
ImpellerVulkanSwapchainRetain
IMPELLER_EXPORT void ImpellerVulkanSwapchainRetain(ImpellerVulkanSwapchain IMPELLER_NULLABLE swapchain)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerLineMetricsGetAscent
IMPELLER_EXPORT double ImpellerLineMetricsGetAscent(ImpellerLineMetrics IMPELLER_NONNULL metrics, size_t line)
The rise from the baseline as calculated from the font and style for this line.
ImpellerColor
struct ImpellerColor ImpellerColor
ImpellerImageFilterCreateErodeNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE ImpellerImageFilterCreateErodeNew(float x_radius, float y_radius)
Creates an image filter that dampens the per-channel pixel values to the minimum value in a circle ar...
ImpellerDisplayListBuilderDrawRoundedRect
IMPELLER_EXPORT void ImpellerDisplayListBuilderDrawRoundedRect(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL rect, const ImpellerRoundingRadii *IMPELLER_NONNULL radii, ImpellerPaint IMPELLER_NONNULL paint)
Draws a rounded rect.
ImpellerPathBuilderAddOval
IMPELLER_EXPORT void ImpellerPathBuilderAddOval(ImpellerPathBuilder IMPELLER_NONNULL builder, const ImpellerRect *IMPELLER_NONNULL oval_bounds)
Add an oval to the path.
ImpellerGlyphInfoGetGraphemeClusterBounds
IMPELLER_EXPORT ImpellerRect ImpellerGlyphInfoGetGraphemeClusterBounds(ImpellerGlyphInfo IMPELLER_NONNULL glyph_info)
Fetch the bounds of the grapheme cluster for the glyph in the coordinate space of the paragraph.
IMPELLER_NODISCARD
#define IMPELLER_NODISCARD
Definition: impeller.h:64
ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew(ImpellerParagraph IMPELLER_NONNULL paragraph, size_t code_unit_index)
Create a new instance of glyph info that can be queried for information about the glyph at the given ...
ImpellerParagraphGetLineMetrics
IMPELLER_EXPORT ImpellerLineMetrics IMPELLER_NULLABLE ImpellerParagraphGetLineMetrics(ImpellerParagraph IMPELLER_NONNULL paragraph)
Get the line metrics of this laid out paragraph. Calculating the line metrics is expensive....
ImpellerVulkanProcAddressCallback
void *IMPELLER_NULLABLE(* ImpellerVulkanProcAddressCallback)(void *IMPELLER_NULLABLE vulkan_instance, const char *IMPELLER_NONNULL vulkan_proc_name, void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:347
ImpellerParagraphStyleSetTextAlignment
IMPELLER_EXPORT void ImpellerParagraphStyleSetTextAlignment(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerTextAlignment align)
Set the alignment of text within the paragraph.
ImpellerParagraphStyleSetFontFamily
IMPELLER_EXPORT void ImpellerParagraphStyleSetFontFamily(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, const char *IMPELLER_NONNULL family_name)
Set the font family.
ImpellerParagraphStyleRetain
IMPELLER_EXPORT void ImpellerParagraphStyleRetain(ImpellerParagraphStyle IMPELLER_NULLABLE paragraph_style)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerParagraphStyleSetFontWeight
IMPELLER_EXPORT void ImpellerParagraphStyleSetFontWeight(ImpellerParagraphStyle IMPELLER_NONNULL paragraph_style, ImpellerFontWeight weight)
Set the weight of the font to select when rendering glyphs.
ImpellerColorFilterRelease
IMPELLER_EXPORT void ImpellerColorFilterRelease(ImpellerColorFilter IMPELLER_NULLABLE color_filter)
Release a previously retained reference to the object. The object can be NULL in which case this meth...
ImpellerSize
struct ImpellerSize ImpellerSize
ImpellerBlurStyle
ImpellerBlurStyle
Definition: impeller.h:431
kImpellerBlurStyleNormal
@ kImpellerBlurStyleNormal
Definition: impeller.h:432
kImpellerBlurStyleOuter
@ kImpellerBlurStyleOuter
Definition: impeller.h:434
kImpellerBlurStyleInner
@ kImpellerBlurStyleInner
Definition: impeller.h:435
kImpellerBlurStyleSolid
@ kImpellerBlurStyleSolid
Definition: impeller.h:433
ImpellerPixelFormat
ImpellerPixelFormat
Definition: impeller.h:415
kImpellerPixelFormatRGBA8888
@ kImpellerPixelFormatRGBA8888
Definition: impeller.h:416
ImpellerPaintSetStrokeWidth
IMPELLER_EXPORT void ImpellerPaintSetStrokeWidth(ImpellerPaint IMPELLER_NONNULL paint, float width)
Set the width of the strokes rendered using this paint.
ImpellerColorSourceCreateLinearGradientNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE ImpellerColorSourceCreateLinearGradientNew(const ImpellerPoint *IMPELLER_NONNULL start_point, const ImpellerPoint *IMPELLER_NONNULL end_point, uint32_t stop_count, const ImpellerColor *IMPELLER_NONNULL colors, const float *IMPELLER_NONNULL stops, ImpellerTileMode tile_mode, const ImpellerMatrix *IMPELLER_NULLABLE transformation)
Create a color source that forms a linear gradient.
ImpellerTypographyContextRetain
IMPELLER_EXPORT void ImpellerTypographyContextRetain(ImpellerTypographyContext IMPELLER_NULLABLE context)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerParagraphBuilderNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context)
Create a new paragraph builder.
ImpellerParagraphGetAlphabeticBaseline
IMPELLER_EXPORT float ImpellerParagraphGetAlphabeticBaseline(ImpellerParagraph IMPELLER_NONNULL paragraph)
ImpellerContextCreateVulkanNew
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE ImpellerContextCreateVulkanNew(uint32_t version, const ImpellerContextVulkanSettings *IMPELLER_NONNULL settings)
Create a Vulkan context using the provided Vulkan Settings.
ImpellerDisplayListBuilderRestoreToCount
IMPELLER_EXPORT void ImpellerDisplayListBuilderRestoreToCount(ImpellerDisplayListBuilder IMPELLER_NONNULL builder, uint32_t count)
Effectively calls ImpellerDisplayListBuilderRestore till the size of the save stack becomes a specifi...
ImpellerPaintRetain
IMPELLER_EXPORT void ImpellerPaintRetain(ImpellerPaint IMPELLER_NULLABLE paint)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerPathBuilderRetain
IMPELLER_EXPORT void ImpellerPathBuilderRetain(ImpellerPathBuilder IMPELLER_NULLABLE builder)
Retain a strong reference to the object. The object can be NULL in which case this method is a no-op.
ImpellerColor
Definition: impeller.h:588
ImpellerColor::blue
float blue
Definition: impeller.h:591
ImpellerColor::alpha
float alpha
Definition: impeller.h:592
ImpellerColor::red
float red
Definition: impeller.h:589
ImpellerColor::green
float green
Definition: impeller.h:590
ImpellerColor::color_space
ImpellerColorSpace color_space
Definition: impeller.h:593
ImpellerColorMatrix
Definition: impeller.h:577
ImpellerColorMatrix::m
float m[20]
Definition: impeller.h:578
ImpellerContextVulkanInfo
Definition: impeller.h:614
ImpellerContextVulkanInfo::graphics_queue_index
uint32_t graphics_queue_index
Definition: impeller.h:619
ImpellerContextVulkanInfo::graphics_queue_family_index
uint32_t graphics_queue_family_index
Definition: impeller.h:618
ImpellerContextVulkanInfo::vk_instance
void *IMPELLER_NULLABLE vk_instance
Definition: impeller.h:615
ImpellerContextVulkanInfo::vk_logical_device
void *IMPELLER_NULLABLE vk_logical_device
Definition: impeller.h:617
ImpellerContextVulkanInfo::vk_physical_device
void *IMPELLER_NULLABLE vk_physical_device
Definition: impeller.h:616
ImpellerContextVulkanSettings
Definition: impeller.h:608
ImpellerContextVulkanSettings::proc_address_callback
ImpellerVulkanProcAddressCallback IMPELLER_NONNULL proc_address_callback
Definition: impeller.h:610
ImpellerContextVulkanSettings::enable_vulkan_validation
bool enable_vulkan_validation
Definition: impeller.h:611
ImpellerContextVulkanSettings::user_data
void *IMPELLER_NULLABLE user_data
Definition: impeller.h:609
ImpellerISize
Definition: impeller.h:495
ImpellerISize::height
int64_t height
Definition: impeller.h:497
ImpellerISize::width
int64_t width
Definition: impeller.h:496
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
ImpellerMatrix::m
float m[16]
Definition: impeller.h:516
ImpellerPoint
Definition: impeller.h:485
ImpellerPoint::x
float x
Definition: impeller.h:486
ImpellerPoint::y
float y
Definition: impeller.h:487
ImpellerRange
Definition: impeller.h:500
ImpellerRange::end
uint64_t end
Definition: impeller.h:502
ImpellerRange::start
uint64_t start
Definition: impeller.h:501
ImpellerRect
Definition: impeller.h:478
ImpellerRect::x
float x
Definition: impeller.h:479
ImpellerRect::width
float width
Definition: impeller.h:481
ImpellerRect::height
float height
Definition: impeller.h:482
ImpellerRect::y
float y
Definition: impeller.h:480
ImpellerRoundingRadii
Definition: impeller.h:581
ImpellerRoundingRadii::top_left
ImpellerPoint top_left
Definition: impeller.h:582
ImpellerRoundingRadii::top_right
ImpellerPoint top_right
Definition: impeller.h:584
ImpellerRoundingRadii::bottom_left
ImpellerPoint bottom_left
Definition: impeller.h:583
ImpellerRoundingRadii::bottom_right
ImpellerPoint bottom_right
Definition: impeller.h:585
ImpellerSize
Definition: impeller.h:490
ImpellerSize::height
float height
Definition: impeller.h:492
ImpellerSize::width
float width
Definition: impeller.h:491
ImpellerTextureDescriptor
Definition: impeller.h:596
ImpellerTextureDescriptor::mip_count
uint32_t mip_count
Definition: impeller.h:599
ImpellerTextureDescriptor::pixel_format
ImpellerPixelFormat pixel_format
Definition: impeller.h:597
ImpellerTextureDescriptor::size
ImpellerISize size
Definition: impeller.h:598
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:67