Flutter Impeller
impeller.cc
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 
6 
7 #include <sstream>
8 
9 #include "flutter/fml/mapping.h"
34 
35 #if IMPELLER_ENABLE_OPENGLES
38 #endif // IMPELLER_ENABLE_OPENGLES
39 
40 #if IMPELLER_ENABLE_METAL
43 #endif // IMPELLER_ENABLE_METAL
44 
45 #if IMPELLER_ENABLE_VULKAN
49 #endif // IMPELLER_ENABLE_VULKAN
50 
51 namespace impeller::interop {
52 
53 #define DEFINE_PEER_GETTER(cxx_type, c_type) \
54  cxx_type* GetPeer(c_type object) { \
55  return reinterpret_cast<cxx_type*>(object); \
56  }
57 
58 DEFINE_PEER_GETTER(ColorFilter, ImpellerColorFilter);
59 DEFINE_PEER_GETTER(ColorSource, ImpellerColorSource);
60 DEFINE_PEER_GETTER(Context, ImpellerContext);
61 DEFINE_PEER_GETTER(DisplayList, ImpellerDisplayList);
62 DEFINE_PEER_GETTER(DisplayListBuilder, ImpellerDisplayListBuilder);
63 DEFINE_PEER_GETTER(GlyphInfo, ImpellerGlyphInfo);
64 DEFINE_PEER_GETTER(ImageFilter, ImpellerImageFilter);
65 DEFINE_PEER_GETTER(LineMetrics, ImpellerLineMetrics);
66 DEFINE_PEER_GETTER(MaskFilter, ImpellerMaskFilter);
67 DEFINE_PEER_GETTER(Paint, ImpellerPaint);
68 DEFINE_PEER_GETTER(Paragraph, ImpellerParagraph);
69 DEFINE_PEER_GETTER(ParagraphBuilder, ImpellerParagraphBuilder);
70 DEFINE_PEER_GETTER(ParagraphStyle, ImpellerParagraphStyle);
71 DEFINE_PEER_GETTER(Path, ImpellerPath);
72 DEFINE_PEER_GETTER(PathBuilder, ImpellerPathBuilder);
73 DEFINE_PEER_GETTER(Surface, ImpellerSurface);
74 DEFINE_PEER_GETTER(SwapchainVK, ImpellerVulkanSwapchain);
75 DEFINE_PEER_GETTER(Texture, ImpellerTexture);
76 DEFINE_PEER_GETTER(TypographyContext, ImpellerTypographyContext);
77 
78 static std::string GetVersionAsString(uint32_t version) {
79  std::stringstream stream;
80  stream << IMPELLER_VERSION_GET_VARIANT(version) << "."
81  << IMPELLER_VERSION_GET_MAJOR(version) << "."
82  << IMPELLER_VERSION_GET_MINOR(version) << "."
83  << IMPELLER_VERSION_GET_PATCH(version);
84  return stream.str();
85 }
86 
88 uint32_t ImpellerGetVersion() {
89  return IMPELLER_VERSION;
90 }
91 
92 static bool CheckVersion(uint32_t version) {
93  if (version != IMPELLER_VERSION) {
94  VALIDATION_LOG << "This version of Impeller ("
96  << "doesn't match the version the user expects ("
97  << GetVersionAsString(version) << ").";
98  return false;
99  }
100  return true;
101 }
102 
105  uint32_t version,
106  ImpellerProcAddressCallback gl_proc_address_callback,
107  void* gl_proc_address_callback_user_data) {
108  if (!CheckVersion(version)) {
109  return nullptr;
110  }
111 #if IMPELLER_ENABLE_OPENGLES
112  auto context = ContextGLES::Create(
113  [gl_proc_address_callback,
114  gl_proc_address_callback_user_data](const char* proc_name) -> void* {
115  return gl_proc_address_callback(proc_name,
116  gl_proc_address_callback_user_data);
117  });
118  if (!context || !context->IsValid()) {
119  VALIDATION_LOG << "Could not create valid context.";
120  return nullptr;
121  }
122  return context.Leak();
123 #else // IMPELLER_ENABLE_OPENGLES
124  VALIDATION_LOG << "OpenGLES not available.";
125  return nullptr;
126 #endif // IMPELLER_ENABLE_OPENGLES
127 }
128 
130  uint32_t version) {
131  if (!CheckVersion(version)) {
132  return nullptr;
133  }
134 #if IMPELLER_ENABLE_METAL
135  auto context = ContextMTL::Create();
136  if (!context || !context->IsValid()) {
137  VALIDATION_LOG << "Could not create valid context.";
138  return nullptr;
139  }
140  return context.Leak();
141 #else // IMPELLER_ENABLE_METAL
142  VALIDATION_LOG << "Metal not available.";
143  return nullptr;
144 #endif // IMPELLER_ENABLE_METAL
145 }
146 
148  uint32_t version,
149  const ImpellerContextVulkanSettings* settings) {
150  if (!CheckVersion(version)) {
151  return nullptr;
152  }
153 #if IMPELLER_ENABLE_VULKAN
154  auto context = ContextVK::Create(ContextVK::Settings(*settings));
155  if (!context || !context->IsValid()) {
156  VALIDATION_LOG << "Could not create valid context.";
157  return nullptr;
158  }
159  return context.Leak();
160 #else // IMPELLER_ENABLE_VULKAN
161  VALIDATION_LOG << "Vulkan not available.";
162  return nullptr;
163 #endif // IMPELLER_ENABLE_VULKAN
164 }
165 
167 void ImpellerContextRetain(ImpellerContext context) {
168  ObjectBase::SafeRetain(context);
169 }
170 
172 void ImpellerContextRelease(ImpellerContext context) {
173  ObjectBase::SafeRelease(context);
174 }
175 
177 bool ImpellerContextGetVulkanInfo(ImpellerContext IMPELLER_NONNULL context,
178  ImpellerContextVulkanInfo* out_vulkan_info) {
179 #if IMPELLER_ENABLE_VULKAN
180  if (!GetPeer(context)->IsVulkan()) {
181  VALIDATION_LOG << "Not a Vulkan context.";
182  return false;
183  }
184  return reinterpret_cast<ContextVK*>(GetPeer(context))
185  ->GetInfo(*out_vulkan_info);
186 #else // IMPELLER_ENABLE_VULKAN
187  VALIDATION_LOG << "Vulkan not available.";
188  return nullptr;
189 #endif // IMPELLER_ENABLE_VULKAN
190 }
191 
193 ImpellerVulkanSwapchain ImpellerVulkanSwapchainCreateNew(
194  ImpellerContext context,
195  void* vulkan_surface_khr) {
196 #if IMPELLER_ENABLE_VULKAN
197  return Create<SwapchainVK>(
198  *GetPeer(context), //
199  reinterpret_cast<VkSurfaceKHR>(vulkan_surface_khr) //
200  )
201  .Leak();
202 #else // IMPELLER_ENABLE_VULKAN
203  VALIDATION_LOG << "Vulkan not available.";
204  return nullptr;
205 #endif // IMPELLER_ENABLE_VULKAN
206 }
207 
209 void ImpellerVulkanSwapchainRetain(ImpellerVulkanSwapchain swapchain) {
210  ObjectBase::SafeRetain(swapchain);
211 }
212 
214 void ImpellerVulkanSwapchainRelease(ImpellerVulkanSwapchain swapchain) {
215  ObjectBase::SafeRelease(swapchain);
216 }
217 
220  ImpellerVulkanSwapchain swapchain) {
221  return GetPeer(swapchain)->AcquireNextSurface().Leak();
222 }
223 
225  const ImpellerRect* cull_rect) {
226  return Create<DisplayListBuilder>(cull_rect).Leak();
227 }
228 
230 void ImpellerDisplayListBuilderRetain(ImpellerDisplayListBuilder builder) {
231  ObjectBase::SafeRetain(builder);
232 }
233 
235 void ImpellerDisplayListBuilderRelease(ImpellerDisplayListBuilder builder) {
236  ObjectBase::SafeRelease(builder);
237 }
238 
240 void ImpellerDisplayListBuilderSave(ImpellerDisplayListBuilder builder) {
241  GetPeer(builder)->Save();
242 }
243 
245 void ImpellerDisplayListBuilderSaveLayer(ImpellerDisplayListBuilder builder,
246  const ImpellerRect* bounds,
247  ImpellerPaint paint,
248  ImpellerImageFilter backdrop) {
249  GetPeer(builder)->SaveLayer(ToImpellerType(*bounds), //
250  GetPeer(paint), //
251  GetPeer(backdrop) //
252  );
253 }
254 
256 void ImpellerDisplayListBuilderRestore(ImpellerDisplayListBuilder builder) {
257  GetPeer(builder)->Restore();
258 }
259 
261 void ImpellerDisplayListBuilderScale(ImpellerDisplayListBuilder builder,
262  float x_scale,
263  float y_scale) {
264  GetPeer(builder)->Scale(Size{x_scale, y_scale});
265 }
266 
268 void ImpellerDisplayListBuilderRotate(ImpellerDisplayListBuilder builder,
269  float angle_degrees) {
270  GetPeer(builder)->Rotate(Degrees{angle_degrees});
271 }
272 
274 void ImpellerDisplayListBuilderTranslate(ImpellerDisplayListBuilder builder,
275  float x_translation,
276  float y_translation) {
277  GetPeer(builder)->Translate(Point{x_translation, y_translation});
278 }
279 
281 void ImpellerDisplayListBuilderSetTransform(ImpellerDisplayListBuilder builder,
282  const ImpellerMatrix* transform) {
283  GetPeer(builder)->SetTransform(ToImpellerType(*transform));
284 }
285 
287 void ImpellerDisplayListBuilderTransform(ImpellerDisplayListBuilder builder,
288  const ImpellerMatrix* transform) {
289  GetPeer(builder)->Transform(ToImpellerType(*transform));
290 }
291 
293 void ImpellerDisplayListBuilderGetTransform(ImpellerDisplayListBuilder builder,
294  ImpellerMatrix* out_transform) {
295  FromImpellerType(GetPeer(builder)->GetTransform(), *out_transform);
296 }
297 
300  ImpellerDisplayListBuilder builder) {
301  GetPeer(builder)->ResetTransform();
302 }
303 
306  ImpellerDisplayListBuilder builder) {
307  return GetPeer(builder)->GetSaveCount();
308 }
309 
312  ImpellerDisplayListBuilder builder,
313  uint32_t count) {
314  GetPeer(builder)->RestoreToCount(count);
315 }
316 
318 void ImpellerPathRetain(ImpellerPath path) {
320 }
321 
323 void ImpellerPathRelease(ImpellerPath path) {
325 }
326 
328 ImpellerPathBuilder ImpellerPathBuilderNew() {
329  return Create<PathBuilder>().Leak();
330 }
331 
333 void ImpellerPathBuilderRetain(ImpellerPathBuilder builder) {
334  ObjectBase::SafeRetain(builder);
335 }
336 
338 void ImpellerPathBuilderRelease(ImpellerPathBuilder builder) {
339  ObjectBase::SafeRelease(builder);
340 }
341 
343 void ImpellerPathBuilderMoveTo(ImpellerPathBuilder builder,
344  const ImpellerPoint* location) {
345  GetPeer(builder)->MoveTo(ToImpellerType(*location));
346 }
347 
349 void ImpellerPathBuilderLineTo(ImpellerPathBuilder builder,
350  const ImpellerPoint* location) {
351  GetPeer(builder)->LineTo(ToImpellerType(*location));
352 }
353 
355 void ImpellerPathBuilderQuadraticCurveTo(ImpellerPathBuilder builder,
356  const ImpellerPoint* control_point,
357  const ImpellerPoint* end_point) {
358  GetPeer(builder)->QuadraticCurveTo(ToImpellerType(*control_point),
359  ToImpellerType(*end_point));
360 }
361 
363 void ImpellerPathBuilderCubicCurveTo(ImpellerPathBuilder builder,
364  const ImpellerPoint* control_point_1,
365  const ImpellerPoint* control_point_2,
366  const ImpellerPoint* end_point) {
367  GetPeer(builder)->CubicCurveTo(ToImpellerType(*control_point_1), //
368  ToImpellerType(*control_point_2), //
369  ToImpellerType(*end_point) //
370  );
371 }
372 
374 void ImpellerPathBuilderAddRect(ImpellerPathBuilder builder,
375  const ImpellerRect* rect) {
376  GetPeer(builder)->AddRect(ToImpellerType(*rect));
377 }
378 
380 void ImpellerPathBuilderAddArc(ImpellerPathBuilder builder,
381  const ImpellerRect* oval_bounds,
382  float start_angle_degrees,
383  float end_angle_degrees) {
384  GetPeer(builder)->AddArc(ToImpellerType(*oval_bounds), //
385  Degrees{start_angle_degrees}, //
386  Degrees{end_angle_degrees} //
387  );
388 }
389 
391 void ImpellerPathBuilderAddOval(ImpellerPathBuilder builder,
392  const ImpellerRect* oval_bounds) {
393  GetPeer(builder)->AddOval(ToImpellerType(*oval_bounds));
394 }
395 
398  ImpellerPathBuilder builder,
399  const ImpellerRect* rect,
400  const ImpellerRoundingRadii* rounding_radii) {
401  GetPeer(builder)->AddRoundedRect(ToImpellerType(*rect),
402  ToImpellerType(*rounding_radii));
403 }
404 
406 void ImpellerPathBuilderClose(ImpellerPathBuilder builder) {
407  GetPeer(builder)->Close();
408 }
409 
411 ImpellerPath ImpellerPathBuilderCopyPathNew(ImpellerPathBuilder builder,
412  ImpellerFillType fill) {
413  return GetPeer(builder)->CopyPath(ToImpellerType(fill)).Leak();
414 }
415 
417 ImpellerPath ImpellerPathBuilderTakePathNew(ImpellerPathBuilder builder,
418  ImpellerFillType fill) {
419  return GetPeer(builder)->TakePath(ToImpellerType(fill)).Leak();
420 }
421 
423 void ImpellerDisplayListBuilderClipRect(ImpellerDisplayListBuilder builder,
424  const ImpellerRect* rect,
426  GetPeer(builder)->ClipRect(ToImpellerType(*rect), ToImpellerType(op));
427 }
428 
430 void ImpellerDisplayListBuilderClipOval(ImpellerDisplayListBuilder builder,
431  const ImpellerRect* oval_bounds,
433  GetPeer(builder)->ClipOval(ToImpellerType(*oval_bounds), ToImpellerType(op));
434 }
435 
438  ImpellerDisplayListBuilder builder,
439  const ImpellerRect* rect,
440  const ImpellerRoundingRadii* radii,
442  GetPeer(builder)->ClipRoundedRect(ToImpellerType(*rect), //
443  ToImpellerType(*radii), //
444  ToImpellerType(op) //
445  );
446 }
447 
449 void ImpellerDisplayListBuilderClipPath(ImpellerDisplayListBuilder builder,
450  ImpellerPath path,
452  GetPeer(builder)->ClipPath(*GetPeer(path), ToImpellerType(op));
453 }
454 
456 ImpellerPaint ImpellerPaintNew() {
457  return Create<Paint>().Leak();
458 }
459 
461 void ImpellerPaintRetain(ImpellerPaint paint) {
462  ObjectBase::SafeRetain(paint);
463 }
464 
466 void ImpellerPaintRelease(ImpellerPaint paint) {
468 }
469 
471 void ImpellerPaintSetColor(ImpellerPaint paint, const ImpellerColor* color) {
472  GetPeer(paint)->SetColor(ToDisplayListType(*color));
473 }
474 
476 void ImpellerPaintSetBlendMode(ImpellerPaint paint, ImpellerBlendMode mode) {
477  GetPeer(paint)->SetBlendMode(ToImpellerType(mode));
478 }
479 
481 void ImpellerPaintSetDrawStyle(ImpellerPaint paint, ImpellerDrawStyle style) {
482  GetPeer(paint)->SetDrawStyle(ToDisplayListType(style));
483 }
484 
486 void ImpellerPaintSetStrokeCap(ImpellerPaint paint, ImpellerStrokeCap cap) {
487  GetPeer(paint)->SetStrokeCap(ToDisplayListType(cap));
488 }
489 
491 void ImpellerPaintSetStrokeJoin(ImpellerPaint paint, ImpellerStrokeJoin join) {
492  GetPeer(paint)->SetStrokeJoin(ToDisplayListType(join));
493 }
494 
496 void ImpellerPaintSetStrokeWidth(ImpellerPaint paint, float width) {
497  GetPeer(paint)->SetStrokeWidth(width);
498 }
499 
501 void ImpellerPaintSetStrokeMiter(ImpellerPaint paint, float miter) {
502  GetPeer(paint)->SetStrokeMiter(miter);
503 }
504 
506 void ImpellerDisplayListBuilderDrawPaint(ImpellerDisplayListBuilder builder,
507  ImpellerPaint paint) {
508  GetPeer(builder)->DrawPaint(*GetPeer(paint));
509 }
510 
512 void ImpellerDisplayListBuilderDrawLine(ImpellerDisplayListBuilder builder,
513  const ImpellerPoint* from,
514  const ImpellerPoint* to,
515  ImpellerPaint paint) {
516  GetPeer(builder)->DrawLine(ToImpellerType(*from), //
517  ToImpellerType(*to), //
518  *GetPeer(paint) //
519  );
520 }
521 
524  ImpellerDisplayListBuilder builder,
525  const ImpellerPoint* from,
526  const ImpellerPoint* to,
527  float on_length,
528  float off_length,
529  ImpellerPaint paint) {
530  GetPeer(builder)->DrawDashedLine(ToImpellerType(*from), //
531  ToImpellerType(*to), //
532  on_length, //
533  off_length, //
534  *GetPeer(paint) //
535  );
536 }
537 
539 void ImpellerDisplayListBuilderDrawRect(ImpellerDisplayListBuilder builder,
540  const ImpellerRect* rect,
541  ImpellerPaint paint) {
542  GetPeer(builder)->DrawRect(ToImpellerType(*rect), *GetPeer(paint));
543 }
544 
546 void ImpellerDisplayListBuilderDrawOval(ImpellerDisplayListBuilder builder,
547  const ImpellerRect* oval_bounds,
548  ImpellerPaint paint) {
549  GetPeer(builder)->DrawOval(ToImpellerType(*oval_bounds), *GetPeer(paint));
550 }
551 
554  ImpellerDisplayListBuilder builder,
555  const ImpellerRect* rect,
556  const ImpellerRoundingRadii* radii,
557  ImpellerPaint paint) {
558  GetPeer(builder)->DrawRoundedRect(ToImpellerType(*rect), //
559  ToImpellerType(*radii), //
560  *GetPeer(paint) //
561  );
562 }
563 
566  ImpellerDisplayListBuilder builder,
567  const ImpellerRect* outer_rect,
568  const ImpellerRoundingRadii* outer_radii,
569  const ImpellerRect* inner_rect,
570  const ImpellerRoundingRadii* inner_radii,
571  ImpellerPaint paint) {
572  GetPeer(builder)->DrawRoundedRectDifference(ToImpellerType(*outer_rect), //
573  ToImpellerType(*outer_radii), //
574  ToImpellerType(*inner_rect), //
575  ToImpellerType(*inner_radii), //
576  *GetPeer(paint) //
577  );
578 }
579 
581 void ImpellerDisplayListBuilderDrawPath(ImpellerDisplayListBuilder builder,
582  ImpellerPath path,
583  ImpellerPaint paint) {
584  GetPeer(builder)->DrawPath(*GetPeer(path), *GetPeer(paint));
585 }
586 
589  ImpellerContext context,
590  const ImpellerTextureDescriptor* descriptor,
591  const ImpellerMapping* contents,
592  void* contents_on_release_user_data) {
593  TextureDescriptor desc;
596  desc.format = ToImpellerType(descriptor->pixel_format);
597  desc.size = ToImpellerType(descriptor->size);
598  desc.mip_count = std::min(descriptor->mip_count, 1u);
601  auto texture = Create<Texture>(*GetPeer(context), desc);
602  if (!texture->IsValid()) {
603  VALIDATION_LOG << "Could not create texture.";
604  return nullptr;
605  }
606  // Depending on whether the de-allocation can be delayed, it may be possible
607  // to avoid a data copy.
608  if (contents->on_release) {
609  // Avoids data copy.
610  auto wrapped_contents = std::make_shared<fml::NonOwnedMapping>(
611  contents->data, // data ptr
612  contents->length, // data length
613  [on_release = contents->on_release, contents_on_release_user_data](
614  auto, auto) {
615  on_release(contents_on_release_user_data);
616  } // release callback
617  );
618  if (!texture->SetContents(std::move(wrapped_contents))) {
619  VALIDATION_LOG << "Could not set texture contents.";
620  return nullptr;
621  }
622  } else {
623  // May copy.
624  if (!texture->SetContents(contents->data, contents->length)) {
625  VALIDATION_LOG << "Could not set texture contents.";
626  return nullptr;
627  }
628  }
629  return texture.Leak();
630 }
631 
634  ImpellerContext context,
635  const ImpellerTextureDescriptor* descriptor,
636  uint64_t external_gl_handle) {
637  auto impeller_context = GetPeer(context)->GetContext();
638  if (impeller_context->GetBackendType() !=
640  VALIDATION_LOG << "Context is not OpenGL.";
641  return nullptr;
642  }
643 
644  const auto& impeller_context_gl =
645  impeller::ContextGLES::Cast(*impeller_context);
646  const auto& reactor = impeller_context_gl.GetReactor();
647 
648  TextureDescriptor desc;
651  desc.format = ToImpellerType(descriptor->pixel_format);
652  desc.size = ToImpellerType(descriptor->size);
653  desc.mip_count = std::min(descriptor->mip_count, 1u);
656 
657  auto texture = TextureGLES::WrapTexture(
658  reactor, //
659  desc, //
660  reactor->CreateHandle(HandleType::kTexture, external_gl_handle) //
661  );
662  if (!texture || !texture->IsValid()) {
663  VALIDATION_LOG << "Could not wrap external texture.";
664  return nullptr;
665  }
666  texture->SetCoordinateSystem(TextureCoordinateSystem::kUploadFromHost);
667  return Create<Texture>(impeller::Context::BackendType::kOpenGLES,
668  std::move(texture))
669  .Leak();
670 }
671 
673 void ImpellerTextureRetain(ImpellerTexture texture) {
674  ObjectBase::SafeRetain(texture);
675 }
676 
678 void ImpellerTextureRelease(ImpellerTexture texture) {
679  ObjectBase::SafeRelease(texture);
680 }
681 
683 uint64_t ImpellerTextureGetOpenGLHandle(ImpellerTexture texture) {
684  auto interop_texture = GetPeer(texture);
685  if (interop_texture->GetBackendType() !=
687  VALIDATION_LOG << "Can only fetch the texture handle of an OpenGL texture.";
688  return 0u;
689  }
690  return TextureGLES::Cast(*interop_texture->GetTexture())
691  .GetGLHandle()
692  .value_or(0u);
693 }
694 
696 void ImpellerDisplayListRetain(ImpellerDisplayList display_list) {
697  ObjectBase::SafeRetain(display_list);
698 }
699 
701 void ImpellerDisplayListRelease(ImpellerDisplayList display_list) {
702  ObjectBase::SafeRelease(display_list);
703 }
704 
707  ImpellerDisplayListBuilder builder) {
708  auto dl = GetPeer(builder)->Build();
709  if (!dl->IsValid()) {
710  return nullptr;
711  }
712  return dl.Leak();
713 }
714 
717  ImpellerDisplayListBuilder builder,
718  ImpellerDisplayList display_list,
719  float opacity) {
720  GetPeer(builder)->DrawDisplayList(*GetPeer(display_list), opacity);
721 }
722 
724 ImpellerSurface ImpellerSurfaceCreateWrappedFBONew(ImpellerContext context,
725  uint64_t fbo,
726  ImpellerPixelFormat format,
727  const ImpellerISize* size) {
728 #if IMPELLER_ENABLE_OPENGLES
729  if (!GetPeer(context)->IsGL()) {
730  VALIDATION_LOG << "Context is not OpenGL.";
731  return nullptr;
732  }
733  return Create<SurfaceGLES>(*GetPeer(context), //
734  fbo, //
735  ToImpellerType(format), //
736  ToImpellerType(*size)) //
737  .Leak();
738 #else // IMPELLER_ENABLE_OPENGLES
739  VALIDATION_LOG << "OpenGL unavailable.";
740  return nullptr;
741 #endif // IMPELLER_ENABLE_OPENGLES
742 }
743 
746  ImpellerContext context,
747  void* metal_drawable) {
748 #if IMPELLER_ENABLE_METAL
749  if (!GetPeer(context)->IsMetal()) {
750  VALIDATION_LOG << "Context is not Metal.";
751  return nullptr;
752  }
753  return Create<SurfaceMTL>(*GetPeer(context), metal_drawable).Leak();
754 #else // IMPELLER_ENABLE_METAL
755  VALIDATION_LOG << "Metal unavailable.";
756  return nullptr;
757 #endif // IMPELLER_ENABLE_METAL
758 }
759 
760 IMPELLER_EXTERN_C void ImpellerSurfaceRetain(ImpellerSurface surface) {
761  ObjectBase::SafeRetain(surface);
762 }
763 
765 void ImpellerSurfaceRelease(ImpellerSurface surface) {
766  ObjectBase::SafeRelease(surface);
767 }
768 
770 bool ImpellerSurfaceDrawDisplayList(ImpellerSurface surface,
771  ImpellerDisplayList display_list) {
772  return GetPeer(surface)->DrawDisplayList(*GetPeer(display_list));
773 }
774 
776 bool ImpellerSurfacePresent(ImpellerSurface surface) {
777  return GetPeer(surface)->Present();
778 }
779 
781 void ImpellerDisplayListBuilderDrawTexture(ImpellerDisplayListBuilder builder,
782  ImpellerTexture texture,
783  const ImpellerPoint* point,
784  ImpellerTextureSampling sampling,
785  ImpellerPaint paint) {
786  GetPeer(builder)->DrawTexture(*GetPeer(texture), //
787  ToImpellerType(*point), //
788  ToDisplayListType(sampling), //
789  GetPeer(paint) //
790  );
791 }
792 
795  ImpellerDisplayListBuilder builder,
796  ImpellerTexture texture,
797  const ImpellerRect* src_rect,
798  const ImpellerRect* dst_rect,
799  ImpellerTextureSampling sampling,
800  ImpellerPaint paint) {
801  GetPeer(builder)->DrawTextureRect(*GetPeer(texture), //
802  ToImpellerType(*src_rect), //
803  ToImpellerType(*dst_rect), //
804  ToDisplayListType(sampling), //
805  GetPeer(paint) //
806  );
807 }
808 
810 void ImpellerColorSourceRetain(ImpellerColorSource color_source) {
811  ObjectBase::SafeRetain(color_source);
812 }
813 
815 void ImpellerColorSourceRelease(ImpellerColorSource color_source) {
816  ObjectBase::SafeRelease(color_source);
817 }
818 
819 static std::pair<std::vector<flutter::DlColor>, std::vector<Scalar>>
820 ParseColorsAndStops(uint32_t stop_count,
821  const ImpellerColor* colors,
822  const float* stops) {
823  if (stop_count == 0) {
824  return {};
825  }
826  std::pair<std::vector<flutter::DlColor>, std::vector<Scalar>> result;
827  result.first.reserve(stop_count);
828  result.second.reserve(stop_count);
829  for (size_t i = 0; i < stop_count; i++) {
830  result.first.emplace_back(ToDisplayListType(colors[i]));
831  result.second.emplace_back(stops[i]);
832  }
833  return result;
834 }
835 
838  const ImpellerPoint* start_point,
839  const ImpellerPoint* end_point,
840  uint32_t stop_count,
841  const ImpellerColor* colors,
842  const float* stops,
843  ImpellerTileMode tile_mode,
844  const ImpellerMatrix* transformation) {
845  const auto colors_and_stops = ParseColorsAndStops(stop_count, colors, stops);
847  ToImpellerType(*start_point), //
848  ToImpellerType(*end_point), //
849  colors_and_stops.first, //
850  colors_and_stops.second, //
851  ToDisplayListType(tile_mode), //
852  transformation == nullptr ? Matrix{}
853  : ToImpellerType(*transformation) //
854  )
855  .Leak();
856 }
857 
860  const ImpellerPoint* center,
861  float radius,
862  uint32_t stop_count,
863  const ImpellerColor* colors,
864  const float* stops,
865  ImpellerTileMode tile_mode,
866  const ImpellerMatrix* transformation) {
867  const auto colors_and_stops = ParseColorsAndStops(stop_count, colors, stops);
869  ToImpellerType(*center), //
870  radius, //
871  colors_and_stops.first, //
872  colors_and_stops.second, //
873  ToDisplayListType(tile_mode), //
874  transformation == nullptr ? Matrix{}
875  : ToImpellerType(*transformation) //
876  )
877  .Leak();
878 }
879 
882  const ImpellerPoint* start_center,
883  float start_radius,
884  const ImpellerPoint* end_center,
885  float end_radius,
886  uint32_t stop_count,
887  const ImpellerColor* colors,
888  const float* stops,
889  ImpellerTileMode tile_mode,
890  const ImpellerMatrix* transformation) {
891  const auto colors_and_stops = ParseColorsAndStops(stop_count, colors, stops);
893  ToImpellerType(*start_center), //
894  start_radius, //
895  ToImpellerType(*end_center), //
896  end_radius, //
897  colors_and_stops.first, //
898  colors_and_stops.second, //
899  ToDisplayListType(tile_mode), //
900  transformation == nullptr ? Matrix{}
901  : ToImpellerType(*transformation) //
902  )
903  .Leak();
904 }
905 
908  const ImpellerPoint* center,
909  float start,
910  float end,
911  uint32_t stop_count,
912  const ImpellerColor* colors,
913  const float* stops,
914  ImpellerTileMode tile_mode,
915  const ImpellerMatrix* transformation) {
916  const auto colors_and_stops = ParseColorsAndStops(stop_count, colors, stops);
918  ToImpellerType(*center), //
919  start, //
920  end, //
921  colors_and_stops.first, //
922  colors_and_stops.second, //
923  ToDisplayListType(tile_mode), //
924  transformation == nullptr ? Matrix{}
925  : ToImpellerType(*transformation) //
926  )
927  .Leak();
928 }
929 
932  ImpellerTexture image,
933  ImpellerTileMode horizontal_tile_mode,
934  ImpellerTileMode vertical_tile_mode,
935  ImpellerTextureSampling sampling,
936  const ImpellerMatrix* transformation) {
937  return ColorSource::MakeImage(
938  *GetPeer(image), //
939  ToDisplayListType(horizontal_tile_mode), //
940  ToDisplayListType(vertical_tile_mode), //
941  ToDisplayListType(sampling), //
942  transformation == nullptr ? Matrix{}
943  : ToImpellerType(*transformation) //
944  )
945  .Leak();
946 }
947 
949 void ImpellerColorFilterRetain(ImpellerColorFilter color_filter) {
950  ObjectBase::SafeRetain(color_filter);
951 }
952 
954 void ImpellerColorFilterRelease(ImpellerColorFilter color_filter) {
955  ObjectBase::SafeRelease(color_filter);
956 }
957 
960  const ImpellerColor* color,
961  ImpellerBlendMode blend_mode) {
962  return ColorFilter::MakeBlend(ToImpellerType(*color),
963  ToImpellerType(blend_mode))
964  .Leak();
965 }
966 
969  const ImpellerColorMatrix* color_matrix) {
970  return ColorFilter::MakeMatrix(color_matrix->m).Leak();
971 }
972 
974 void ImpellerMaskFilterRetain(ImpellerMaskFilter mask_filter) {
975  ObjectBase::SafeRetain(mask_filter);
976 }
977 
979 void ImpellerMaskFilterRelease(ImpellerMaskFilter mask_filter) {
980  ObjectBase::SafeRelease(mask_filter);
981 }
982 
985  float sigma) {
986  return MaskFilter::MakeBlur(ToDisplayListType(style), sigma).Leak();
987 }
988 
990 void ImpellerImageFilterRetain(ImpellerImageFilter image_filter) {
991  ObjectBase::SafeRetain(image_filter);
992 }
993 
995 void ImpellerImageFilterRelease(ImpellerImageFilter image_filter) {
996  ObjectBase::SafeRelease(image_filter);
997 }
998 
1001  float x_sigma,
1002  float y_sigma,
1003  ImpellerTileMode tile_mode) {
1004  return ImageFilter::MakeBlur(x_sigma, y_sigma, ToDisplayListType(tile_mode))
1005  .Leak();
1006 }
1007 
1009 ImpellerImageFilter ImpellerImageFilterCreateDilateNew(float x_radius,
1010  float y_radius) {
1011  return ImageFilter::MakeDilate(x_radius, y_radius).Leak();
1012 }
1013 
1015 ImpellerImageFilter ImpellerImageFilterCreateErodeNew(float x_radius,
1016  float y_radius) {
1017  return ImageFilter::MakeErode(x_radius, y_radius).Leak();
1018 }
1019 
1022  const ImpellerMatrix* matrix,
1023  ImpellerTextureSampling sampling) {
1024  return ImageFilter::MakeMatrix(ToImpellerType(*matrix),
1025  ToDisplayListType(sampling))
1026  .Leak();
1027 }
1028 
1031  ImpellerImageFilter outer,
1032  ImpellerImageFilter inner) {
1033  return ImageFilter::MakeCompose(*GetPeer(outer), *GetPeer(inner)).Leak();
1034 }
1035 
1037 void ImpellerPaintSetColorFilter(ImpellerPaint paint,
1038  ImpellerColorFilter color_filter) {
1039  GetPeer(paint)->SetColorFilter(*GetPeer(color_filter));
1040 }
1041 
1043 void ImpellerPaintSetColorSource(ImpellerPaint paint,
1044  ImpellerColorSource color_source) {
1045  GetPeer(paint)->SetColorSource(*GetPeer(color_source));
1046 }
1047 
1049 void ImpellerPaintSetImageFilter(ImpellerPaint paint,
1050  ImpellerImageFilter image_filter) {
1051  GetPeer(paint)->SetImageFilter(*GetPeer(image_filter));
1052 }
1053 
1055 void ImpellerPaintSetMaskFilter(ImpellerPaint paint,
1056  ImpellerMaskFilter mask_filter) {
1057  GetPeer(paint)->SetMaskFilter(*GetPeer(mask_filter));
1058 }
1059 
1061 ImpellerParagraphStyle ImpellerParagraphStyleNew() {
1062  return Create<ParagraphStyle>().Leak();
1063 }
1064 
1066 void ImpellerParagraphStyleRetain(ImpellerParagraphStyle paragraph_style) {
1067  ObjectBase::SafeRetain(paragraph_style);
1068 }
1069 
1071 void ImpellerParagraphStyleRelease(ImpellerParagraphStyle paragraph_style) {
1072  ObjectBase::SafeRelease(paragraph_style);
1073 }
1074 
1076 void ImpellerParagraphStyleSetForeground(ImpellerParagraphStyle paragraph_style,
1077  ImpellerPaint paint) {
1078  GetPeer(paragraph_style)->SetForeground(Ref(GetPeer(paint)));
1079 }
1080 
1082 void ImpellerParagraphStyleSetBackground(ImpellerParagraphStyle paragraph_style,
1083  ImpellerPaint paint) {
1084  GetPeer(paragraph_style)->SetBackground(Ref(GetPeer(paint)));
1085 }
1086 
1088 void ImpellerParagraphStyleSetFontWeight(ImpellerParagraphStyle paragraph_style,
1089  ImpellerFontWeight weight) {
1090  GetPeer(paragraph_style)->SetFontWeight(ToTxtType(weight));
1091 }
1092 
1094 void ImpellerParagraphStyleSetFontStyle(ImpellerParagraphStyle paragraph_style,
1095  ImpellerFontStyle style) {
1096  GetPeer(paragraph_style)->SetFontStyle(ToTxtType(style));
1097 }
1098 
1099 static std::string ReadString(const char* string) {
1100  if (string == nullptr) {
1101  return "";
1102  }
1103  return std::string{string};
1104 }
1105 
1107 void ImpellerParagraphStyleSetFontFamily(ImpellerParagraphStyle paragraph_style,
1108  const char* family_name) {
1109  GetPeer(paragraph_style)->SetFontFamily(ReadString(family_name));
1110 }
1111 
1113 void ImpellerParagraphStyleSetFontSize(ImpellerParagraphStyle paragraph_style,
1114  float size) {
1115  GetPeer(paragraph_style)->SetFontSize(size);
1116 }
1117 
1119 void ImpellerParagraphStyleSetHeight(ImpellerParagraphStyle paragraph_style,
1120  float height) {
1121  GetPeer(paragraph_style)->SetHeight(height);
1122 }
1123 
1126  ImpellerParagraphStyle paragraph_style,
1127  ImpellerTextAlignment align) {
1128  GetPeer(paragraph_style)->SetTextAlignment(ToTxtType(align));
1129 }
1130 
1133  ImpellerParagraphStyle paragraph_style,
1134  ImpellerTextDirection direction) {
1135  GetPeer(paragraph_style)->SetTextDirection(ToTxtType(direction));
1136 }
1137 
1139 void ImpellerParagraphStyleSetMaxLines(ImpellerParagraphStyle paragraph_style,
1140  uint32_t max_lines) {
1141  GetPeer(paragraph_style)->SetMaxLines(max_lines);
1142 }
1143 
1145 void ImpellerParagraphStyleSetLocale(ImpellerParagraphStyle paragraph_style,
1146  const char* locale) {
1147  GetPeer(paragraph_style)->SetLocale(ReadString(locale));
1148 }
1149 
1151 void ImpellerDisplayListBuilderDrawParagraph(ImpellerDisplayListBuilder builder,
1152  ImpellerParagraph paragraph,
1153  const ImpellerPoint* point) {
1154  GetPeer(builder)->DrawParagraph(*GetPeer(paragraph), ToImpellerType(*point));
1155 }
1156 
1158 void ImpellerDisplayListBuilderDrawShadow(ImpellerDisplayListBuilder builder,
1159  ImpellerPath path,
1160  const ImpellerColor* color,
1161  float elevation,
1162  bool occluder_is_transparent,
1163  float device_pixel_ratio) {
1164  GetPeer(builder)->DrawShadow(*GetPeer(path), //
1165  ToDisplayListType(*color), //
1166  elevation, //
1167  occluder_is_transparent, //
1168  device_pixel_ratio //
1169  );
1170 }
1171 
1173 ImpellerParagraphBuilder ImpellerParagraphBuilderNew(
1174  ImpellerTypographyContext context) {
1175  auto builder =
1176  Create<ParagraphBuilder>(Ref<TypographyContext>(GetPeer(context)));
1177  if (!builder->IsValid()) {
1178  VALIDATION_LOG << "Could not create valid paragraph builder.";
1179  return nullptr;
1180  }
1181  return builder.Leak();
1182 }
1183 
1186  ImpellerParagraphBuilder paragraph_builder) {
1187  ObjectBase::SafeRetain(paragraph_builder);
1188 }
1189 
1192  ImpellerParagraphBuilder paragraph_builder) {
1193  ObjectBase::SafeRelease(paragraph_builder);
1194 }
1195 
1198  ImpellerParagraphBuilder paragraph_builder,
1199  ImpellerParagraphStyle style) {
1200  GetPeer(paragraph_builder)->PushStyle(*GetPeer(style));
1201 }
1202 
1205  ImpellerParagraphBuilder paragraph_builder) {
1206  GetPeer(paragraph_builder)->PopStyle();
1207 }
1208 
1210 void ImpellerParagraphBuilderAddText(ImpellerParagraphBuilder paragraph_builder,
1211  const uint8_t* data,
1212  uint32_t length) {
1213  if (data == nullptr) {
1214  length = 0;
1215  }
1216  if (length == 0) {
1217  return;
1218  }
1219  GetPeer(paragraph_builder)->AddText(data, length);
1220 }
1221 
1224  ImpellerParagraphBuilder paragraph_builder,
1225  float width) {
1226  return GetPeer(paragraph_builder)->Build(width).Leak();
1227 }
1228 
1230 void ImpellerParagraphRetain(ImpellerParagraph paragraph) {
1231  ObjectBase::SafeRetain(paragraph);
1232 }
1233 
1235 void ImpellerParagraphRelease(ImpellerParagraph paragraph) {
1236  ObjectBase::SafeRelease(paragraph);
1237 }
1238 
1240 float ImpellerParagraphGetMaxWidth(ImpellerParagraph paragraph) {
1241  return GetPeer(paragraph)->GetMaxWidth();
1242 }
1243 
1245 float ImpellerParagraphGetHeight(ImpellerParagraph paragraph) {
1246  return GetPeer(paragraph)->GetHeight();
1247 }
1248 
1250 float ImpellerParagraphGetLongestLineWidth(ImpellerParagraph paragraph) {
1251  return GetPeer(paragraph)->GetLongestLineWidth();
1252 }
1253 
1255 float ImpellerParagraphGetMinIntrinsicWidth(ImpellerParagraph paragraph) {
1256  return GetPeer(paragraph)->GetMinIntrinsicWidth();
1257 }
1258 
1260 float ImpellerParagraphGetMaxIntrinsicWidth(ImpellerParagraph paragraph) {
1261  return GetPeer(paragraph)->GetMaxIntrinsicWidth();
1262 }
1263 
1265 float ImpellerParagraphGetIdeographicBaseline(ImpellerParagraph paragraph) {
1266  return GetPeer(paragraph)->GetIdeographicBaseline();
1267 }
1268 
1270 float ImpellerParagraphGetAlphabeticBaseline(ImpellerParagraph paragraph) {
1271  return GetPeer(paragraph)->GetAlphabeticBaseline();
1272 }
1273 
1275 uint32_t ImpellerParagraphGetLineCount(ImpellerParagraph paragraph) {
1276  return GetPeer(paragraph)->GetLineCount();
1277 }
1278 
1281  size_t code_unit_index) {
1282  return GetPeer(paragraph)->GetWordBoundary(code_unit_index);
1283 }
1284 
1286 ImpellerTypographyContext ImpellerTypographyContextNew() {
1287  auto context = Create<TypographyContext>();
1288  if (!context->IsValid()) {
1289  VALIDATION_LOG << "Could not create typography context.";
1290  return nullptr;
1291  }
1292  return context.Leak();
1293 }
1294 
1296 void ImpellerTypographyContextRetain(ImpellerTypographyContext context) {
1297  ObjectBase::SafeRetain(context);
1298 }
1299 
1301 void ImpellerTypographyContextRelease(ImpellerTypographyContext context) {
1302  ObjectBase::SafeRelease(context);
1303 }
1304 
1306 bool ImpellerTypographyContextRegisterFont(ImpellerTypographyContext context,
1307  const ImpellerMapping* contents,
1308  void* contents_on_release_user_data,
1309  const char* family_name_alias) {
1310  auto wrapped_contents = std::make_unique<fml::NonOwnedMapping>(
1311  contents->data, // data ptr
1312  contents->length, // data length
1313  [on_release = contents->on_release, contents_on_release_user_data](auto,
1314  auto) {
1315  on_release(contents_on_release_user_data);
1316  } // release callback
1317  );
1318  return GetPeer(context)->RegisterFont(std::move(wrapped_contents),
1319  family_name_alias);
1320 }
1321 
1324  ImpellerParagraph paragraph) {
1325  return GetPeer(paragraph)->GetLineMetrics().GetC();
1326 }
1327 
1330  ImpellerParagraph paragraph,
1331  size_t code_unit_index) {
1332  return GetPeer(paragraph)
1333  ->GetGlyphInfoAtCodeUnitIndex(code_unit_index)
1334  .Leak();
1335 }
1336 
1339  ImpellerParagraph paragraph,
1340  double x,
1341  double y) {
1342  return GetPeer(paragraph)
1343  ->GetClosestGlyphInfoAtParagraphCoordinates(x, y)
1344  .Leak();
1345 }
1346 
1347 //------------------------------------------------------------------------------
1348 // Line Metrics
1349 //------------------------------------------------------------------------------
1350 
1352 void ImpellerLineMetricsRetain(ImpellerLineMetrics line_metrics) {
1353  ObjectBase::SafeRetain(line_metrics);
1354 }
1355 
1357 void ImpellerLineMetricsRelease(ImpellerLineMetrics line_metrics) {
1358  ObjectBase::SafeRelease(line_metrics);
1359 }
1360 
1362 double ImpellerLineMetricsGetUnscaledAscent(ImpellerLineMetrics metrics,
1363  size_t line) {
1364  return GetPeer(metrics)->GetUnscaledAscent(line);
1365 }
1366 
1368 double ImpellerLineMetricsGetAscent(ImpellerLineMetrics metrics, size_t line) {
1369  return GetPeer(metrics)->GetAscent(line);
1370 }
1371 
1373 double ImpellerLineMetricsGetDescent(ImpellerLineMetrics metrics, size_t line) {
1374  return GetPeer(metrics)->GetDescent(line);
1375 }
1376 
1378 double ImpellerLineMetricsGetBaseline(ImpellerLineMetrics metrics,
1379  size_t line) {
1380  return GetPeer(metrics)->GetBaseline(line);
1381 }
1382 
1384 bool ImpellerLineMetricsIsHardbreak(ImpellerLineMetrics metrics, size_t line) {
1385  return GetPeer(metrics)->IsHardbreak(line);
1386 }
1387 
1389 double ImpellerLineMetricsGetWidth(ImpellerLineMetrics metrics, size_t line) {
1390  return GetPeer(metrics)->GetWidth(line);
1391 }
1392 
1394 double ImpellerLineMetricsGetHeight(ImpellerLineMetrics metrics, size_t line) {
1395  return GetPeer(metrics)->GetHeight(line);
1396 }
1397 
1399 double ImpellerLineMetricsGetLeft(ImpellerLineMetrics metrics, size_t line) {
1400  return GetPeer(metrics)->GetLeft(line);
1401 }
1402 
1404 size_t ImpellerLineMetricsGetCodeUnitStartIndex(ImpellerLineMetrics metrics,
1405  size_t line) {
1406  return GetPeer(metrics)->GetCodeUnitStartIndex(line);
1407 }
1408 
1410 size_t ImpellerLineMetricsGetCodeUnitEndIndex(ImpellerLineMetrics metrics,
1411  size_t line) {
1412  return GetPeer(metrics)->GetCodeUnitEndIndex(line);
1413 }
1414 
1417  ImpellerLineMetrics metrics,
1418  size_t line) {
1419  return GetPeer(metrics)->GetCodeUnitEndIndexExcludingWhitespace(line);
1420 }
1421 
1424  ImpellerLineMetrics metrics,
1425  size_t line) {
1426  return GetPeer(metrics)->GetCodeUnitEndIndexIncludingNewline(line);
1427 }
1428 
1429 //------------------------------------------------------------------------------
1430 // Glyph Info
1431 //------------------------------------------------------------------------------
1432 
1434 void ImpellerGlyphInfoRetain(ImpellerGlyphInfo glyph_info) {
1435  ObjectBase::SafeRetain(glyph_info);
1436 }
1437 
1439 void ImpellerGlyphInfoRelease(ImpellerGlyphInfo glyph_info) {
1440  ObjectBase::SafeRelease(glyph_info);
1441 }
1442 
1445  ImpellerGlyphInfo glyph_info) {
1446  return GetPeer(glyph_info)->GetGraphemeClusterCodeUnitRangeBegin();
1447 }
1448 
1451  ImpellerGlyphInfo glyph_info) {
1452  return GetPeer(glyph_info)->GetGraphemeClusterCodeUnitRangeEnd();
1453 }
1454 
1457  ImpellerGlyphInfo glyph_info) {
1458  return GetPeer(glyph_info)->GetGraphemeClusterBounds();
1459 }
1460 
1462 bool ImpellerGlyphInfoIsEllipsis(ImpellerGlyphInfo glyph_info) {
1463  return GetPeer(glyph_info)->IsEllipsis();
1464 }
1465 
1468  ImpellerGlyphInfo glyph_info) {
1469  return GetPeer(glyph_info)->GetTextDirection();
1470 }
1471 
1472 } // namespace impeller::interop
static ContextGLES & Cast(Context &base)
Definition: backend_cast.h:13
std::optional< GLuint > GetGLHandle() const
static std::shared_ptr< TextureGLES > WrapTexture(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc, HandleGLES external_handle)
Create a texture by wrapping an external OpenGL texture handle. Ownership of the texture handle is as...
static ScopedObject< ColorFilter > MakeMatrix(const float matrix[20])
Definition: color_filter.cc:18
static ScopedObject< ColorFilter > MakeBlend(Color color, BlendMode mode)
Definition: color_filter.cc:9
static ScopedObject< ColorSource > MakeSweepGradient(const Point &center, Scalar start, Scalar end, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:76
static ScopedObject< ColorSource > MakeImage(const Texture &image, flutter::DlTileMode horizontal_tile_mode, flutter::DlTileMode vertical_tile_mode, flutter::DlImageSampling sampling, const Matrix &transformation)
Definition: color_source.cc:99
static ScopedObject< ColorSource > MakeRadialGradient(const Point &center, Scalar radius, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:30
static ScopedObject< ColorSource > MakeLinearGradient(const Point &start_point, const Point &end_point, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:9
static ScopedObject< ColorSource > MakeConicalGradient(const Point &start_center, Scalar start_radius, const Point &end_center, Scalar end_radius, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:51
static ScopedObject< Context > Create(std::function< void *(const char *gl_proc_name)> proc_address_callback)
Definition: context_gles.cc:14
static ScopedObject< Context > Create()
Definition: context_mtl.mm:29
static ScopedObject< Context > Create(const Settings &settings)
Definition: context_vk.cc:45
Internal C++ peer of ImpellerGlyphInfo. For detailed documentation, refer to the headerdocs in the pu...
Definition: glyph_info.h:21
static ScopedObject< ImageFilter > MakeDilate(Scalar x_radius, Scalar y_radius)
Definition: image_filter.cc:26
static ScopedObject< ImageFilter > MakeErode(Scalar x_radius, Scalar y_radius)
Definition: image_filter.cc:35
static ScopedObject< ImageFilter > MakeCompose(const ImageFilter &outer, const ImageFilter &inner)
Definition: image_filter.cc:54
static ScopedObject< ImageFilter > MakeBlur(Scalar x_sigma, Scalar y_sigma, flutter::DlTileMode tile_mode)
Definition: image_filter.cc:16
static ScopedObject< ImageFilter > MakeMatrix(const Matrix &matrix, flutter::DlImageSampling sampling)
Definition: image_filter.cc:44
Internal C++ peer of ImpellerLineMetrics. For detailed documentation, refer to the headerdocs in the ...
Definition: line_metrics.h:26
static ScopedObject< MaskFilter > MakeBlur(flutter::DlBlurStyle style, float sigma)
Definition: mask_filter.cc:9
static void SafeRelease(void *ptr)
Definition: object.h:43
static void SafeRetain(void *ptr)
Definition: object.h:37
int32_t x
ImpellerFillType
Definition: impeller.h:355
ImpellerTextDirection
Definition: impeller.h:470
ImpellerTextureSampling
Definition: impeller.h:419
#define IMPELLER_VERSION_GET_PATCH(version)
Definition: impeller.h:135
#define IMPELLER_VERSION_GET_MAJOR(version)
Definition: impeller.h:119
#define IMPELLER_VERSION_GET_VARIANT(version)
Definition: impeller.h:112
ImpellerStrokeJoin
Definition: impeller.h:409
ImpellerBlendMode
Definition: impeller.h:365
#define IMPELLER_VERSION
Definition: impeller.h:103
ImpellerFontWeight
Definition: impeller.h:444
#define IMPELLER_VERSION_GET_MINOR(version)
Definition: impeller.h:127
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
Definition: impeller.h:338
#define IMPELLER_EXTERN_C
Definition: impeller.h:36
ImpellerStrokeCap
Definition: impeller.h:403
ImpellerDrawStyle
Definition: impeller.h:397
ImpellerTileMode
Definition: impeller.h:424
ImpellerTextAlignment
Definition: impeller.h:461
ImpellerFontStyle
Definition: impeller.h:456
ImpellerClipOperation
Definition: impeller.h:360
#define IMPELLER_NONNULL
Definition: impeller.h:58
ImpellerBlurStyle
Definition: impeller.h:431
ImpellerPixelFormat
Definition: impeller.h:415
IMPELLER_EXTERN_C ImpellerImageFilter ImpellerImageFilterCreateComposeNew(ImpellerImageFilter outer, ImpellerImageFilter inner)
Definition: impeller.cc:1030
IMPELLER_EXTERN_C void ImpellerParagraphBuilderRetain(ImpellerParagraphBuilder paragraph_builder)
Definition: impeller.cc:1185
IMPELLER_EXTERN_C ImpellerColorSource ImpellerColorSourceCreateSweepGradientNew(const ImpellerPoint *center, float start, float end, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation)
Definition: impeller.cc:907
IMPELLER_EXTERN_C bool ImpellerLineMetricsIsHardbreak(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1384
IMPELLER_EXTERN_C void ImpellerGlyphInfoRelease(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1439
IMPELLER_EXTERN_C ImpellerImageFilter ImpellerImageFilterCreateMatrixNew(const ImpellerMatrix *matrix, ImpellerTextureSampling sampling)
Definition: impeller.cc:1021
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawPaint(ImpellerDisplayListBuilder builder, ImpellerPaint paint)
Definition: impeller.cc:506
IMPELLER_EXTERN_C void ImpellerSurfaceRetain(ImpellerSurface surface)
Definition: impeller.cc:760
IMPELLER_EXTERN_C void ImpellerParagraphStyleRelease(ImpellerParagraphStyle paragraph_style)
Definition: impeller.cc:1071
IMPELLER_EXTERN_C uint32_t ImpellerGetVersion()
Definition: impeller.cc:88
IMPELLER_EXTERN_C void ImpellerParagraphStyleRetain(ImpellerParagraphStyle paragraph_style)
Definition: impeller.cc:1066
IMPELLER_EXTERN_C size_t ImpellerLineMetricsGetCodeUnitStartIndex(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1404
IMPELLER_EXTERN_C ImpellerTextDirection ImpellerGlyphInfoGetTextDirection(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1467
IMPELLER_EXTERN_C void ImpellerPaintSetColorSource(ImpellerPaint paint, ImpellerColorSource color_source)
Definition: impeller.cc:1043
IMPELLER_EXTERN_C void ImpellerPathBuilderClose(ImpellerPathBuilder builder)
Definition: impeller.cc:406
IMPELLER_EXTERN_C void ImpellerPathBuilderQuadraticCurveTo(ImpellerPathBuilder builder, const ImpellerPoint *control_point, const ImpellerPoint *end_point)
Definition: impeller.cc:355
IMPELLER_EXTERN_C uint64_t ImpellerTextureGetOpenGLHandle(ImpellerTexture texture)
Definition: impeller.cc:683
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderRetain(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:230
IMPELLER_EXTERN_C void ImpellerParagraphBuilderPopStyle(ImpellerParagraphBuilder paragraph_builder)
Definition: impeller.cc:1204
static bool CheckVersion(uint32_t version)
Definition: impeller.cc:92
IMPELLER_EXTERN_C ImpellerMaskFilter ImpellerMaskFilterCreateBlurNew(ImpellerBlurStyle style, float sigma)
Definition: impeller.cc:984
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetMaxLines(ImpellerParagraphStyle paragraph_style, uint32_t max_lines)
Definition: impeller.cc:1139
IMPELLER_EXTERN_C size_t ImpellerLineMetricsGetCodeUnitEndIndex(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1410
IMPELLER_EXTERN_C void ImpellerColorFilterRetain(ImpellerColorFilter color_filter)
Definition: impeller.cc:949
IMPELLER_EXTERN_C ImpellerSurface ImpellerSurfaceCreateWrappedFBONew(ImpellerContext context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize *size)
Definition: impeller.cc:724
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawTextureRect(ImpellerDisplayListBuilder builder, ImpellerTexture texture, const ImpellerRect *src_rect, const ImpellerRect *dst_rect, ImpellerTextureSampling sampling, ImpellerPaint paint)
Definition: impeller.cc:794
IMPELLER_EXTERN_C void ImpellerLineMetricsRelease(ImpellerLineMetrics line_metrics)
Definition: impeller.cc:1357
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderSave(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:240
IMPELLER_EXTERN_C ImpellerDisplayList ImpellerDisplayListBuilderCreateDisplayListNew(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:706
IMPELLER_EXTERN_C bool ImpellerGlyphInfoIsEllipsis(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1462
IMPELLER_EXTERN_C void ImpellerPathBuilderRelease(ImpellerPathBuilder builder)
Definition: impeller.cc:338
IMPELLER_EXTERN_C ImpellerParagraphBuilder ImpellerParagraphBuilderNew(ImpellerTypographyContext context)
Definition: impeller.cc:1173
IMPELLER_EXTERN_C ImpellerColorFilter ImpellerColorFilterCreateColorMatrixNew(const ImpellerColorMatrix *color_matrix)
Definition: impeller.cc:968
static std::pair< std::vector< flutter::DlColor >, std::vector< Scalar > > ParseColorsAndStops(uint32_t stop_count, const ImpellerColor *colors, const float *stops)
Definition: impeller.cc:820
IMPELLER_EXTERN_C void ImpellerPaintRelease(ImpellerPaint paint)
Definition: impeller.cc:466
IMPELLER_EXTERN_C ImpellerDisplayListBuilder ImpellerDisplayListBuilderNew(const ImpellerRect *cull_rect)
Definition: impeller.cc:224
IMPELLER_EXTERN_C double ImpellerLineMetricsGetDescent(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1373
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontStyle(ImpellerParagraphStyle paragraph_style, ImpellerFontStyle style)
Definition: impeller.cc:1094
IMPELLER_EXTERN_C ImpellerPaint ImpellerPaintNew()
Definition: impeller.cc:456
IMPELLER_EXTERN_C void ImpellerTypographyContextRetain(ImpellerTypographyContext context)
Definition: impeller.cc:1296
IMPELLER_EXTERN_C ImpellerRect ImpellerGlyphInfoGetGraphemeClusterBounds(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1456
IMPELLER_EXTERN_C size_t ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1423
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetTextDirection(ImpellerParagraphStyle paragraph_style, ImpellerTextDirection direction)
Definition: impeller.cc:1132
ScopedObject< Object > Ref(Object *object)
Definition: object.h:146
IMPELLER_EXTERN_C ImpellerSurface ImpellerSurfaceCreateWrappedMetalDrawableNew(ImpellerContext context, void *metal_drawable)
Definition: impeller.cc:745
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawOval(ImpellerDisplayListBuilder builder, const ImpellerRect *oval_bounds, ImpellerPaint paint)
Definition: impeller.cc:546
IMPELLER_EXTERN_C size_t ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1416
IMPELLER_EXTERN_C ImpellerContext ImpellerContextCreateVulkanNew(uint32_t version, const ImpellerContextVulkanSettings *settings)
Definition: impeller.cc:147
IMPELLER_EXTERN_C ImpellerParagraph ImpellerParagraphBuilderBuildParagraphNew(ImpellerParagraphBuilder paragraph_builder, float width)
Definition: impeller.cc:1223
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderSaveLayer(ImpellerDisplayListBuilder builder, const ImpellerRect *bounds, ImpellerPaint paint, ImpellerImageFilter backdrop)
Definition: impeller.cc:245
IMPELLER_EXTERN_C void ImpellerPathBuilderAddRect(ImpellerPathBuilder builder, const ImpellerRect *rect)
Definition: impeller.cc:374
IMPELLER_EXTERN_C ImpellerGlyphInfo ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew(ImpellerParagraph paragraph, size_t code_unit_index)
Definition: impeller.cc:1329
IMPELLER_EXTERN_C double ImpellerLineMetricsGetBaseline(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1378
IMPELLER_EXTERN_C void ImpellerPaintSetStrokeCap(ImpellerPaint paint, ImpellerStrokeCap cap)
Definition: impeller.cc:486
IMPELLER_EXTERN_C void ImpellerParagraphBuilderRelease(ImpellerParagraphBuilder paragraph_builder)
Definition: impeller.cc:1191
IMPELLER_EXTERN_C double ImpellerLineMetricsGetUnscaledAscent(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1362
IMPELLER_EXTERN_C void ImpellerPathBuilderLineTo(ImpellerPathBuilder builder, const ImpellerPoint *location)
Definition: impeller.cc:349
IMPELLER_EXTERN_C void ImpellerPathRetain(ImpellerPath path)
Definition: impeller.cc:318
IMPELLER_EXTERN_C void ImpellerPaintSetStrokeJoin(ImpellerPaint paint, ImpellerStrokeJoin join)
Definition: impeller.cc:491
IMPELLER_EXTERN_C ImpellerGlyphInfo ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew(ImpellerParagraph paragraph, double x, double y)
Definition: impeller.cc:1338
IMPELLER_EXTERN_C float ImpellerParagraphGetHeight(ImpellerParagraph paragraph)
Definition: impeller.cc:1245
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderClipOval(ImpellerDisplayListBuilder builder, const ImpellerRect *oval_bounds, ImpellerClipOperation op)
Definition: impeller.cc:430
IMPELLER_EXTERN_C void ImpellerPathBuilderRetain(ImpellerPathBuilder builder)
Definition: impeller.cc:333
IMPELLER_EXTERN_C void ImpellerParagraphBuilderPushStyle(ImpellerParagraphBuilder paragraph_builder, ImpellerParagraphStyle style)
Definition: impeller.cc:1197
IMPELLER_EXTERN_C void ImpellerPathBuilderAddOval(ImpellerPathBuilder builder, const ImpellerRect *oval_bounds)
Definition: impeller.cc:391
IMPELLER_EXTERN_C ImpellerTypographyContext ImpellerTypographyContextNew()
Definition: impeller.cc:1286
IMPELLER_EXTERN_C float ImpellerParagraphGetAlphabeticBaseline(ImpellerParagraph paragraph)
Definition: impeller.cc:1270
IMPELLER_EXTERN_C void ImpellerPathRelease(ImpellerPath path)
Definition: impeller.cc:323
IMPELLER_EXTERN_C ImpellerImageFilter ImpellerImageFilterCreateBlurNew(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
Definition: impeller.cc:1000
IMPELLER_EXTERN_C void ImpellerColorSourceRetain(ImpellerColorSource color_source)
Definition: impeller.cc:810
IMPELLER_EXTERN_C float ImpellerParagraphGetMinIntrinsicWidth(ImpellerParagraph paragraph)
Definition: impeller.cc:1255
IMPELLER_EXTERN_C void ImpellerPaintSetStrokeWidth(ImpellerPaint paint, float width)
Definition: impeller.cc:496
IMPELLER_EXTERN_C void ImpellerMaskFilterRetain(ImpellerMaskFilter mask_filter)
Definition: impeller.cc:974
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawDashedLine(ImpellerDisplayListBuilder builder, const ImpellerPoint *from, const ImpellerPoint *to, float on_length, float off_length, ImpellerPaint paint)
Definition: impeller.cc:523
IMPELLER_EXTERN_C ImpellerPath ImpellerPathBuilderTakePathNew(ImpellerPathBuilder builder, ImpellerFillType fill)
Definition: impeller.cc:417
IMPELLER_EXTERN_C ImpellerPath ImpellerPathBuilderCopyPathNew(ImpellerPathBuilder builder, ImpellerFillType fill)
Definition: impeller.cc:411
IMPELLER_EXTERN_C void ImpellerColorSourceRelease(ImpellerColorSource color_source)
Definition: impeller.cc:815
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderClipRoundedRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, const ImpellerRoundingRadii *radii, ImpellerClipOperation op)
Definition: impeller.cc:437
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderClipRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, ImpellerClipOperation op)
Definition: impeller.cc:423
IMPELLER_EXTERN_C double ImpellerLineMetricsGetAscent(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1368
constexpr Matrix ToImpellerType(const ImpellerMatrix &m)
Definition: formats.h:201
IMPELLER_EXTERN_C size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1450
IMPELLER_EXTERN_C ImpellerColorSource ImpellerColorSourceCreateRadialGradientNew(const ImpellerPoint *center, float radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation)
Definition: impeller.cc:859
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetTextAlignment(ImpellerParagraphStyle paragraph_style, ImpellerTextAlignment align)
Definition: impeller.cc:1125
IMPELLER_EXTERN_C void ImpellerTypographyContextRelease(ImpellerTypographyContext context)
Definition: impeller.cc:1301
IMPELLER_EXTERN_C ImpellerTexture ImpellerTextureCreateWithOpenGLTextureHandleNew(ImpellerContext context, const ImpellerTextureDescriptor *descriptor, uint64_t external_gl_handle)
Definition: impeller.cc:633
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawRoundedRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, const ImpellerRoundingRadii *radii, ImpellerPaint paint)
Definition: impeller.cc:553
IMPELLER_EXTERN_C ImpellerTexture ImpellerTextureCreateWithContentsNew(ImpellerContext context, const ImpellerTextureDescriptor *descriptor, const ImpellerMapping *contents, void *contents_on_release_user_data)
Definition: impeller.cc:588
IMPELLER_EXTERN_C void ImpellerPathBuilderMoveTo(ImpellerPathBuilder builder, const ImpellerPoint *location)
Definition: impeller.cc:343
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderTransform(ImpellerDisplayListBuilder builder, const ImpellerMatrix *transform)
Definition: impeller.cc:287
IMPELLER_EXTERN_C double ImpellerLineMetricsGetWidth(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1389
IMPELLER_EXTERN_C void ImpellerColorFilterRelease(ImpellerColorFilter color_filter)
Definition: impeller.cc:954
IMPELLER_EXTERN_C bool ImpellerTypographyContextRegisterFont(ImpellerTypographyContext context, const ImpellerMapping *contents, void *contents_on_release_user_data, const char *family_name_alias)
Definition: impeller.cc:1306
IMPELLER_EXTERN_C double ImpellerLineMetricsGetLeft(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1399
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontWeight(ImpellerParagraphStyle paragraph_style, ImpellerFontWeight weight)
Definition: impeller.cc:1088
IMPELLER_EXTERN_C float ImpellerParagraphGetMaxIntrinsicWidth(ImpellerParagraph paragraph)
Definition: impeller.cc:1260
IMPELLER_EXTERN_C ImpellerColorSource ImpellerColorSourceCreateLinearGradientNew(const ImpellerPoint *start_point, const ImpellerPoint *end_point, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation)
Definition: impeller.cc:837
IMPELLER_EXTERN_C ImpellerSurface ImpellerVulkanSwapchainAcquireNextSurfaceNew(ImpellerVulkanSwapchain swapchain)
Definition: impeller.cc:219
IMPELLER_EXTERN_C ImpellerPathBuilder ImpellerPathBuilderNew()
Definition: impeller.cc:328
IMPELLER_EXTERN_C ImpellerContext ImpellerContextCreateMetalNew(uint32_t version)
Definition: impeller.cc:129
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontSize(ImpellerParagraphStyle paragraph_style, float size)
Definition: impeller.cc:1113
IMPELLER_EXTERN_C void ImpellerTextureRelease(ImpellerTexture texture)
Definition: impeller.cc:678
IMPELLER_EXTERN_C bool ImpellerContextGetVulkanInfo(ImpellerContext IMPELLER_NONNULL context, ImpellerContextVulkanInfo *out_vulkan_info)
Definition: impeller.cc:177
IMPELLER_EXTERN_C void ImpellerContextRelease(ImpellerContext context)
Definition: impeller.cc:172
IMPELLER_EXTERN_C void ImpellerImageFilterRelease(ImpellerImageFilter image_filter)
Definition: impeller.cc:995
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawParagraph(ImpellerDisplayListBuilder builder, ImpellerParagraph paragraph, const ImpellerPoint *point)
Definition: impeller.cc:1151
IMPELLER_EXTERN_C ImpellerContext ImpellerContextCreateOpenGLESNew(uint32_t version, ImpellerProcAddressCallback gl_proc_address_callback, void *gl_proc_address_callback_user_data)
Definition: impeller.cc:104
constexpr txt::FontWeight ToTxtType(ImpellerFontWeight weight)
Definition: formats.h:430
IMPELLER_EXTERN_C ImpellerColorSource ImpellerColorSourceCreateImageNew(ImpellerTexture image, ImpellerTileMode horizontal_tile_mode, ImpellerTileMode vertical_tile_mode, ImpellerTextureSampling sampling, const ImpellerMatrix *transformation)
Definition: impeller.cc:931
IMPELLER_EXTERN_C void ImpellerMaskFilterRelease(ImpellerMaskFilter mask_filter)
Definition: impeller.cc:979
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetFontFamily(ImpellerParagraphStyle paragraph_style, const char *family_name)
Definition: impeller.cc:1107
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetHeight(ImpellerParagraphStyle paragraph_style, float height)
Definition: impeller.cc:1119
IMPELLER_EXTERN_C void ImpellerPaintRetain(ImpellerPaint paint)
Definition: impeller.cc:461
IMPELLER_EXTERN_C void ImpellerContextRetain(ImpellerContext context)
Definition: impeller.cc:167
IMPELLER_EXTERN_C void ImpellerParagraphRelease(ImpellerParagraph paragraph)
Definition: impeller.cc:1235
IMPELLER_EXTERN_C void ImpellerPaintSetBlendMode(ImpellerPaint paint, ImpellerBlendMode mode)
Definition: impeller.cc:476
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderResetTransform(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:299
static std::string GetVersionAsString(uint32_t version)
Definition: impeller.cc:78
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderScale(ImpellerDisplayListBuilder builder, float x_scale, float y_scale)
Definition: impeller.cc:261
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetLocale(ImpellerParagraphStyle paragraph_style, const char *locale)
Definition: impeller.cc:1145
IMPELLER_EXTERN_C bool ImpellerSurfaceDrawDisplayList(ImpellerSurface surface, ImpellerDisplayList display_list)
Definition: impeller.cc:770
IMPELLER_EXTERN_C bool ImpellerSurfacePresent(ImpellerSurface surface)
Definition: impeller.cc:776
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawLine(ImpellerDisplayListBuilder builder, const ImpellerPoint *from, const ImpellerPoint *to, ImpellerPaint paint)
Definition: impeller.cc:512
IMPELLER_EXTERN_C size_t ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1444
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawDisplayList(ImpellerDisplayListBuilder builder, ImpellerDisplayList display_list, float opacity)
Definition: impeller.cc:716
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderRestore(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:256
IMPELLER_EXTERN_C ImpellerRange ImpellerParagraphGetWordBoundary(ImpellerParagraph paragraph, size_t code_unit_index)
Definition: impeller.cc:1280
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawShadow(ImpellerDisplayListBuilder builder, ImpellerPath path, const ImpellerColor *color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
Definition: impeller.cc:1158
IMPELLER_EXTERN_C void ImpellerVulkanSwapchainRelease(ImpellerVulkanSwapchain swapchain)
Definition: impeller.cc:214
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderTranslate(ImpellerDisplayListBuilder builder, float x_translation, float y_translation)
Definition: impeller.cc:274
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetForeground(ImpellerParagraphStyle paragraph_style, ImpellerPaint paint)
Definition: impeller.cc:1076
IMPELLER_EXTERN_C uint32_t ImpellerDisplayListBuilderGetSaveCount(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:305
IMPELLER_EXTERN_C ImpellerImageFilter ImpellerImageFilterCreateDilateNew(float x_radius, float y_radius)
Definition: impeller.cc:1009
IMPELLER_EXTERN_C void ImpellerPaintSetStrokeMiter(ImpellerPaint paint, float miter)
Definition: impeller.cc:501
IMPELLER_EXTERN_C ImpellerParagraphStyle ImpellerParagraphStyleNew()
Definition: impeller.cc:1061
IMPELLER_EXTERN_C void ImpellerTextureRetain(ImpellerTexture texture)
Definition: impeller.cc:673
IMPELLER_EXTERN_C ImpellerLineMetrics ImpellerParagraphGetLineMetrics(ImpellerParagraph paragraph)
Definition: impeller.cc:1323
IMPELLER_EXTERN_C void ImpellerPathBuilderCubicCurveTo(ImpellerPathBuilder builder, const ImpellerPoint *control_point_1, const ImpellerPoint *control_point_2, const ImpellerPoint *end_point)
Definition: impeller.cc:363
IMPELLER_EXTERN_C void ImpellerImageFilterRetain(ImpellerImageFilter image_filter)
Definition: impeller.cc:990
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawRoundedRectDifference(ImpellerDisplayListBuilder builder, const ImpellerRect *outer_rect, const ImpellerRoundingRadii *outer_radii, const ImpellerRect *inner_rect, const ImpellerRoundingRadii *inner_radii, ImpellerPaint paint)
Definition: impeller.cc:565
IMPELLER_EXTERN_C void ImpellerParagraphRetain(ImpellerParagraph paragraph)
Definition: impeller.cc:1230
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderRelease(ImpellerDisplayListBuilder builder)
Definition: impeller.cc:235
IMPELLER_EXTERN_C ImpellerColorFilter ImpellerColorFilterCreateBlendNew(const ImpellerColor *color, ImpellerBlendMode blend_mode)
Definition: impeller.cc:959
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderRestoreToCount(ImpellerDisplayListBuilder builder, uint32_t count)
Definition: impeller.cc:311
IMPELLER_EXTERN_C float ImpellerParagraphGetLongestLineWidth(ImpellerParagraph paragraph)
Definition: impeller.cc:1250
IMPELLER_EXTERN_C void ImpellerGlyphInfoRetain(ImpellerGlyphInfo glyph_info)
Definition: impeller.cc:1434
IMPELLER_EXTERN_C void ImpellerPaintSetMaskFilter(ImpellerPaint paint, ImpellerMaskFilter mask_filter)
Definition: impeller.cc:1055
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderSetTransform(ImpellerDisplayListBuilder builder, const ImpellerMatrix *transform)
Definition: impeller.cc:281
IMPELLER_EXTERN_C uint32_t ImpellerParagraphGetLineCount(ImpellerParagraph paragraph)
Definition: impeller.cc:1275
IMPELLER_EXTERN_C void ImpellerLineMetricsRetain(ImpellerLineMetrics line_metrics)
Definition: impeller.cc:1352
IMPELLER_EXTERN_C ImpellerImageFilter ImpellerImageFilterCreateErodeNew(float x_radius, float y_radius)
Definition: impeller.cc:1015
IMPELLER_EXTERN_C double ImpellerLineMetricsGetHeight(ImpellerLineMetrics metrics, size_t line)
Definition: impeller.cc:1394
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderGetTransform(ImpellerDisplayListBuilder builder, ImpellerMatrix *out_transform)
Definition: impeller.cc:293
IMPELLER_EXTERN_C void ImpellerSurfaceRelease(ImpellerSurface surface)
Definition: impeller.cc:765
constexpr void FromImpellerType(const Matrix &from, ImpellerMatrix &to)
Definition: formats.h:209
static std::string ReadString(const char *string)
Definition: impeller.cc:1099
IMPELLER_EXTERN_C void ImpellerPaintSetColorFilter(ImpellerPaint paint, ImpellerColorFilter color_filter)
Definition: impeller.cc:1037
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderRotate(ImpellerDisplayListBuilder builder, float angle_degrees)
Definition: impeller.cc:268
IMPELLER_EXTERN_C float ImpellerParagraphGetMaxWidth(ImpellerParagraph paragraph)
Definition: impeller.cc:1240
DEFINE_PEER_GETTER(ColorFilter, ImpellerColorFilter)
IMPELLER_EXTERN_C void ImpellerPathBuilderAddRoundedRect(ImpellerPathBuilder builder, const ImpellerRect *rect, const ImpellerRoundingRadii *rounding_radii)
Definition: impeller.cc:397
IMPELLER_EXTERN_C void ImpellerVulkanSwapchainRetain(ImpellerVulkanSwapchain swapchain)
Definition: impeller.cc:209
IMPELLER_EXTERN_C ImpellerVulkanSwapchain ImpellerVulkanSwapchainCreateNew(ImpellerContext context, void *vulkan_surface_khr)
Definition: impeller.cc:193
IMPELLER_EXTERN_C float ImpellerParagraphGetIdeographicBaseline(ImpellerParagraph paragraph)
Definition: impeller.cc:1265
constexpr flutter::DlColor ToDisplayListType(Color color)
Definition: formats.h:77
IMPELLER_EXTERN_C void ImpellerPaintSetDrawStyle(ImpellerPaint paint, ImpellerDrawStyle style)
Definition: impeller.cc:481
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawTexture(ImpellerDisplayListBuilder builder, ImpellerTexture texture, const ImpellerPoint *point, ImpellerTextureSampling sampling, ImpellerPaint paint)
Definition: impeller.cc:781
IMPELLER_EXTERN_C void ImpellerPaintSetImageFilter(ImpellerPaint paint, ImpellerImageFilter image_filter)
Definition: impeller.cc:1049
IMPELLER_EXTERN_C void ImpellerDisplayListRelease(ImpellerDisplayList display_list)
Definition: impeller.cc:701
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderClipPath(ImpellerDisplayListBuilder builder, ImpellerPath path, ImpellerClipOperation op)
Definition: impeller.cc:449
IMPELLER_EXTERN_C ImpellerColorSource ImpellerColorSourceCreateConicalGradientNew(const ImpellerPoint *start_center, float start_radius, const ImpellerPoint *end_center, float end_radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation)
Definition: impeller.cc:881
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawPath(ImpellerDisplayListBuilder builder, ImpellerPath path, ImpellerPaint paint)
Definition: impeller.cc:581
IMPELLER_EXTERN_C void ImpellerPathBuilderAddArc(ImpellerPathBuilder builder, const ImpellerRect *oval_bounds, float start_angle_degrees, float end_angle_degrees)
Definition: impeller.cc:380
IMPELLER_EXTERN_C void ImpellerDisplayListRetain(ImpellerDisplayList display_list)
Definition: impeller.cc:696
IMPELLER_EXTERN_C void ImpellerParagraphStyleSetBackground(ImpellerParagraphStyle paragraph_style, ImpellerPaint paint)
Definition: impeller.cc:1082
IMPELLER_EXTERN_C void ImpellerDisplayListBuilderDrawRect(ImpellerDisplayListBuilder builder, const ImpellerRect *rect, ImpellerPaint paint)
Definition: impeller.cc:539
IMPELLER_EXTERN_C void ImpellerPaintSetColor(ImpellerPaint paint, const ImpellerColor *color)
Definition: impeller.cc:471
IMPELLER_EXTERN_C void ImpellerParagraphBuilderAddText(ImpellerParagraphBuilder paragraph_builder, const uint8_t *data, uint32_t length)
Definition: impeller.cc:1210
ImpellerCallback IMPELLER_NULLABLE on_release
Definition: impeller.h:605
uint64_t length
Definition: impeller.h:604
const uint8_t *IMPELLER_NONNULL data
Definition: impeller.h:603
ImpellerPixelFormat pixel_format
Definition: impeller.h:597
ImpellerISize size
Definition: impeller.h:598
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:67
#define VALIDATION_LOG
Definition: validation.h:91