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