5 #ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_HPP_
11 #include <string_view>
22 #ifndef IMPELLER_HPP_NAMESPACE
23 #define IMPELLER_HPP_NAMESPACE impeller::hpp
29 "C++ bindings must be for the same version as the C API.");
37 const char*
name =
nullptr;
41 template <
class... Args>
43 return function(std::forward<Args>(args)...);
47 #define IMPELLER_HPP_EACH_PROC(PROC) \
48 PROC(ImpellerColorFilterCreateBlendNew) \
49 PROC(ImpellerColorFilterCreateColorMatrixNew) \
50 PROC(ImpellerColorFilterRelease) \
51 PROC(ImpellerColorFilterRetain) \
52 PROC(ImpellerColorSourceCreateConicalGradientNew) \
53 PROC(ImpellerColorSourceCreateImageNew) \
54 PROC(ImpellerColorSourceCreateLinearGradientNew) \
55 PROC(ImpellerColorSourceCreateRadialGradientNew) \
56 PROC(ImpellerColorSourceCreateSweepGradientNew) \
57 PROC(ImpellerColorSourceRelease) \
58 PROC(ImpellerColorSourceRetain) \
59 PROC(ImpellerContextCreateMetalNew) \
60 PROC(ImpellerContextCreateOpenGLESNew) \
61 PROC(ImpellerContextCreateVulkanNew) \
62 PROC(ImpellerContextGetVulkanInfo) \
63 PROC(ImpellerContextRelease) \
64 PROC(ImpellerContextRetain) \
65 PROC(ImpellerDisplayListBuilderClipOval) \
66 PROC(ImpellerDisplayListBuilderClipPath) \
67 PROC(ImpellerDisplayListBuilderClipRect) \
68 PROC(ImpellerDisplayListBuilderClipRoundedRect) \
69 PROC(ImpellerDisplayListBuilderCreateDisplayListNew) \
70 PROC(ImpellerDisplayListBuilderDrawDashedLine) \
71 PROC(ImpellerDisplayListBuilderDrawDisplayList) \
72 PROC(ImpellerDisplayListBuilderDrawLine) \
73 PROC(ImpellerDisplayListBuilderDrawOval) \
74 PROC(ImpellerDisplayListBuilderDrawPaint) \
75 PROC(ImpellerDisplayListBuilderDrawParagraph) \
76 PROC(ImpellerDisplayListBuilderDrawPath) \
77 PROC(ImpellerDisplayListBuilderDrawRect) \
78 PROC(ImpellerDisplayListBuilderDrawRoundedRect) \
79 PROC(ImpellerDisplayListBuilderDrawRoundedRectDifference) \
80 PROC(ImpellerDisplayListBuilderDrawShadow) \
81 PROC(ImpellerDisplayListBuilderDrawTexture) \
82 PROC(ImpellerDisplayListBuilderDrawTextureRect) \
83 PROC(ImpellerDisplayListBuilderGetSaveCount) \
84 PROC(ImpellerDisplayListBuilderGetTransform) \
85 PROC(ImpellerDisplayListBuilderNew) \
86 PROC(ImpellerDisplayListBuilderRelease) \
87 PROC(ImpellerDisplayListBuilderResetTransform) \
88 PROC(ImpellerDisplayListBuilderRestore) \
89 PROC(ImpellerDisplayListBuilderRestoreToCount) \
90 PROC(ImpellerDisplayListBuilderRetain) \
91 PROC(ImpellerDisplayListBuilderRotate) \
92 PROC(ImpellerDisplayListBuilderSave) \
93 PROC(ImpellerDisplayListBuilderSaveLayer) \
94 PROC(ImpellerDisplayListBuilderScale) \
95 PROC(ImpellerDisplayListBuilderSetTransform) \
96 PROC(ImpellerDisplayListBuilderTransform) \
97 PROC(ImpellerDisplayListBuilderTranslate) \
98 PROC(ImpellerDisplayListRelease) \
99 PROC(ImpellerDisplayListRetain) \
100 PROC(ImpellerGetVersion) \
101 PROC(ImpellerGlyphInfoGetGraphemeClusterBounds) \
102 PROC(ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin) \
103 PROC(ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd) \
104 PROC(ImpellerGlyphInfoGetTextDirection) \
105 PROC(ImpellerGlyphInfoIsEllipsis) \
106 PROC(ImpellerGlyphInfoRelease) \
107 PROC(ImpellerGlyphInfoRetain) \
108 PROC(ImpellerImageFilterCreateBlurNew) \
109 PROC(ImpellerImageFilterCreateComposeNew) \
110 PROC(ImpellerImageFilterCreateDilateNew) \
111 PROC(ImpellerImageFilterCreateErodeNew) \
112 PROC(ImpellerImageFilterCreateMatrixNew) \
113 PROC(ImpellerImageFilterRelease) \
114 PROC(ImpellerImageFilterRetain) \
115 PROC(ImpellerLineMetricsGetAscent) \
116 PROC(ImpellerLineMetricsGetBaseline) \
117 PROC(ImpellerLineMetricsGetCodeUnitEndIndex) \
118 PROC(ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace) \
119 PROC(ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline) \
120 PROC(ImpellerLineMetricsGetCodeUnitStartIndex) \
121 PROC(ImpellerLineMetricsGetDescent) \
122 PROC(ImpellerLineMetricsGetHeight) \
123 PROC(ImpellerLineMetricsIsHardbreak) \
124 PROC(ImpellerLineMetricsGetLeft) \
125 PROC(ImpellerLineMetricsGetUnscaledAscent) \
126 PROC(ImpellerLineMetricsGetWidth) \
127 PROC(ImpellerLineMetricsRelease) \
128 PROC(ImpellerLineMetricsRetain) \
129 PROC(ImpellerMaskFilterCreateBlurNew) \
130 PROC(ImpellerMaskFilterRelease) \
131 PROC(ImpellerMaskFilterRetain) \
132 PROC(ImpellerPaintNew) \
133 PROC(ImpellerPaintRelease) \
134 PROC(ImpellerPaintRetain) \
135 PROC(ImpellerPaintSetBlendMode) \
136 PROC(ImpellerPaintSetColor) \
137 PROC(ImpellerPaintSetColorFilter) \
138 PROC(ImpellerPaintSetColorSource) \
139 PROC(ImpellerPaintSetDrawStyle) \
140 PROC(ImpellerPaintSetImageFilter) \
141 PROC(ImpellerPaintSetMaskFilter) \
142 PROC(ImpellerPaintSetStrokeCap) \
143 PROC(ImpellerPaintSetStrokeJoin) \
144 PROC(ImpellerPaintSetStrokeMiter) \
145 PROC(ImpellerPaintSetStrokeWidth) \
146 PROC(ImpellerParagraphBuilderAddText) \
147 PROC(ImpellerParagraphBuilderBuildParagraphNew) \
148 PROC(ImpellerParagraphBuilderNew) \
149 PROC(ImpellerParagraphBuilderPopStyle) \
150 PROC(ImpellerParagraphBuilderPushStyle) \
151 PROC(ImpellerParagraphBuilderRelease) \
152 PROC(ImpellerParagraphBuilderRetain) \
153 PROC(ImpellerParagraphCreateGlyphInfoAtCodeUnitIndexNew) \
154 PROC(ImpellerParagraphCreateGlyphInfoAtParagraphCoordinatesNew) \
155 PROC(ImpellerParagraphGetAlphabeticBaseline) \
156 PROC(ImpellerParagraphGetHeight) \
157 PROC(ImpellerParagraphGetIdeographicBaseline) \
158 PROC(ImpellerParagraphGetLineCount) \
159 PROC(ImpellerParagraphGetLineMetrics) \
160 PROC(ImpellerParagraphGetLongestLineWidth) \
161 PROC(ImpellerParagraphGetMaxIntrinsicWidth) \
162 PROC(ImpellerParagraphGetMaxWidth) \
163 PROC(ImpellerParagraphGetMinIntrinsicWidth) \
164 PROC(ImpellerParagraphGetWordBoundary) \
165 PROC(ImpellerParagraphRelease) \
166 PROC(ImpellerParagraphRetain) \
167 PROC(ImpellerParagraphStyleNew) \
168 PROC(ImpellerParagraphStyleRelease) \
169 PROC(ImpellerParagraphStyleRetain) \
170 PROC(ImpellerParagraphStyleSetBackground) \
171 PROC(ImpellerParagraphStyleSetFontFamily) \
172 PROC(ImpellerParagraphStyleSetFontSize) \
173 PROC(ImpellerParagraphStyleSetFontStyle) \
174 PROC(ImpellerParagraphStyleSetFontWeight) \
175 PROC(ImpellerParagraphStyleSetForeground) \
176 PROC(ImpellerParagraphStyleSetHeight) \
177 PROC(ImpellerParagraphStyleSetLocale) \
178 PROC(ImpellerParagraphStyleSetMaxLines) \
179 PROC(ImpellerParagraphStyleSetTextAlignment) \
180 PROC(ImpellerParagraphStyleSetTextDirection) \
181 PROC(ImpellerPathBuilderAddArc) \
182 PROC(ImpellerPathBuilderAddOval) \
183 PROC(ImpellerPathBuilderAddRect) \
184 PROC(ImpellerPathBuilderAddRoundedRect) \
185 PROC(ImpellerPathBuilderClose) \
186 PROC(ImpellerPathBuilderCopyPathNew) \
187 PROC(ImpellerPathBuilderCubicCurveTo) \
188 PROC(ImpellerPathBuilderLineTo) \
189 PROC(ImpellerPathBuilderMoveTo) \
190 PROC(ImpellerPathBuilderNew) \
191 PROC(ImpellerPathBuilderQuadraticCurveTo) \
192 PROC(ImpellerPathBuilderRelease) \
193 PROC(ImpellerPathBuilderRetain) \
194 PROC(ImpellerPathBuilderTakePathNew) \
195 PROC(ImpellerPathRelease) \
196 PROC(ImpellerPathRetain) \
197 PROC(ImpellerSurfaceCreateWrappedFBONew) \
198 PROC(ImpellerSurfaceCreateWrappedMetalDrawableNew) \
199 PROC(ImpellerSurfaceDrawDisplayList) \
200 PROC(ImpellerSurfacePresent) \
201 PROC(ImpellerSurfaceRelease) \
202 PROC(ImpellerSurfaceRetain) \
203 PROC(ImpellerTextureCreateWithContentsNew) \
204 PROC(ImpellerTextureCreateWithOpenGLTextureHandleNew) \
205 PROC(ImpellerTextureGetOpenGLHandle) \
206 PROC(ImpellerTextureRelease) \
207 PROC(ImpellerTextureRetain) \
208 PROC(ImpellerTypographyContextNew) \
209 PROC(ImpellerTypographyContextRegisterFont) \
210 PROC(ImpellerTypographyContextRelease) \
211 PROC(ImpellerTypographyContextRetain) \
212 PROC(ImpellerVulkanSwapchainAcquireNextSurfaceNew) \
213 PROC(ImpellerVulkanSwapchainCreateNew) \
214 PROC(ImpellerVulkanSwapchainRelease) \
215 PROC(ImpellerVulkanSwapchainRetain)
219 const std::function<
void*(
const char* function_name)>& resolver) {
220 #define IMPELLER_HPP_PROC(proc) \
223 reinterpret_cast<decltype(proc.function)>(resolver(proc.name)); \
224 if (proc.function == nullptr) { \
229 #undef IMPELLER_HPP_PROC
233 #define IMPELLER_HPP_PROC(name) Proc<decltype(name)> name = {#name, nullptr};
235 #undef IMPELLER_HPP_PROC
244 template <
class T,
class Traits>
249 explicit Object(T
object) { Reset(
object); }
260 std::swap(object_, other.object_);
269 T
Get()
const {
return object_; }
271 explicit operator bool()
const {
return object_ !=
nullptr; }
276 void Reset(T other =
nullptr) {
277 if (object_ == other) {
281 Traits::Release(object_);
285 Traits::Retain(other);
290 [[nodiscard]] T Leak() {
297 #define IMPELLER_HPP_DEFINE_TRAITS(object) \
298 struct object##Traits { \
299 static void Retain(object ctx) { \
300 gGlobalProcTable.object##Retain(ctx); \
302 static void Release(object ctx) { \
303 gGlobalProcTable.object##Release(ctx); \
327 #undef IMPELLER_HPP_DEFINE_TRAITS
333 std::function<
void()> release_callback)
336 release_callback_(
std::move(release_callback)) {}
343 const uint8_t* mapping_ =
nullptr;
345 std::function<void()> release_callback_;
351 class Context final :
public Object<ImpellerContext, ImpellerContextTraits> {
359 const std::function<
void*(
const char*)>& gl_proc_address_resolver) {
361 std::function<
void*(
const char*)> resolver;
364 user_data.resolver = gl_proc_address_resolver;
366 void* user_data) ->
void* {
367 return reinterpret_cast<UserData*
>(user_data)->resolver(proc_name);
388 class Texture final :
public Object<ImpellerTexture, ImpellerTextureTraits> {
397 std::unique_ptr<Mapping> mapping =
nullptr) {
398 if (mapping ==
nullptr) {
399 mapping = std::make_unique<Mapping>(
nullptr, 0u,
nullptr);
402 c_mapping.
data = mapping->GetMapping();
403 c_mapping.
length = mapping->GetSize();
404 c_mapping.
on_release = [](
void* user_data) ->
void {
405 delete reinterpret_cast<Mapping*
>(user_data);
440 :
public Object<ImpellerColorFilter, ImpellerColorFilterTraits> {
467 :
public Object<ImpellerColorSource, ImpellerColorSourceTraits> {
509 horizontal_tile_mode,
596 :
public Object<ImpellerImageFilter, ImpellerImageFilterTraits> {
607 x_sigma, y_sigma, tile_mode),
617 outer.
Get(), inner.
Get()),
654 :
public Object<ImpellerMaskFilter, ImpellerMaskFilterTraits> {
672 :
public Object<ImpellerGlyphInfo, ImpellerGlyphInfoTraits> {
681 .ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeBegin(
Get());
688 return gGlobalProcTable.ImpellerGlyphInfoGetGraphemeClusterCodeUnitRangeEnd(
718 :
public Object<ImpellerLineMetrics, ImpellerLineMetricsTraits> {
799 .ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace(
Get(), line);
807 .ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline(
Get(), line);
815 :
public Object<ImpellerParagraph, ImpellerParagraphTraits> {
891 Get(), code_unit_index),
921 class Paint final :
public Object<ImpellerPaint, ImpellerPaintTraits> {
1018 :
public Object<ImpellerParagraphStyle, ImpellerParagraphStyleTraits> {
1117 ImpellerTypographyContextTraits> {
1127 const char* optional_family_name_alias =
nullptr) {
1132 c_mapping.
data = mapping->GetMapping();
1133 c_mapping.
length = mapping->GetSize();
1135 delete reinterpret_cast<Mapping*
>(user_data);
1141 optional_family_name_alias
1150 :
public Object<ImpellerParagraphBuilder, ImpellerParagraphBuilderTraits> {
1195 return AddText(
reinterpret_cast<const uint8_t*
>(
string.
data()),
1203 return AddText(
reinterpret_cast<const uint8_t*
>(
string.
data()),
1211 class Path final :
public Object<ImpellerPath, ImpellerPathTraits> {
1220 :
public Object<ImpellerPathBuilder, ImpellerPathBuilderTraits> {
1247 float start_angle_degrees,
1248 float end_angle_degrees) {
1251 start_angle_degrees,
1298 Get(), &control_point_1, &control_point_2, &end_point);
1333 :
public Object<ImpellerDisplayList, ImpellerDisplayListTraits> {
1336 :
Object(display_list, tag) {}
1368 void* metal_drawable) {
1371 context.
Get(), metal_drawable),
1380 display_list.
Get());
1395 :
public Object<ImpellerVulkanSwapchain, ImpellerVulkanSwapchainTraits> {
1398 :
Object(swapchain, tag) {}
1404 void* vulkan_surface_khr) {
1406 context.
Get(), vulkan_surface_khr),
1424 :
public Object<ImpellerDisplayListBuilder,
1425 ImpellerDisplayListBuilderTraits> {
1496 const Paint& paint) {
1510 float opacity = 1.0f) {
1512 Get(), display_list.
Get(), opacity);
1521 const Paint& paint) {
1534 const Paint& paint) {
1556 Get(), paragraph.
Get(), &point);
1566 bool occluder_is_transparent,
1567 float device_pixel_ratio) {
1569 Get(), path.
Get(), &shadow_color, elevation, occluder_is_transparent,
1570 device_pixel_ratio);
1597 const Paint& paint) {
1613 const Paint& paint) {
1630 const Paint& paint) {
1632 Get(), texture.
Get(), &point, sampling, paint.
Get());
1643 const Paint& paint) {
1715 const Paint* paint =
nullptr,
1720 paint ? paint->Get() : NULL,
1721 backdrop ? backdrop->Get() : NULL
static ColorFilter Blend(const ImpellerColor &color, ImpellerBlendMode mode)
static ColorFilter Matrix(const ImpellerColorMatrix &color_matrix)
ColorFilter(ImpellerColorFilter filter, AdoptTag tag)
ColorSource(ImpellerColorSource source, AdoptTag tag)
static ColorSource ConicalGradient(const ImpellerPoint &start_center, float start_radius, const ImpellerPoint &end_center, float end_radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource Image(const Texture &image, ImpellerTileMode horizontal_tile_mode, ImpellerTileMode vertical_tile_mode, ImpellerTextureSampling sampling, const ImpellerMatrix *transformation=nullptr)
static ColorSource SweepGradient(const ImpellerPoint ¢er, float start, float end, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource LinearGradient(const ImpellerPoint &start_point, const ImpellerPoint &end_point, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static ColorSource RadialGradient(const ImpellerPoint ¢er, float radius, uint32_t stop_count, const ImpellerColor *colors, const float *stops, ImpellerTileMode tile_mode, const ImpellerMatrix *transformation=nullptr)
static Context OpenGLES(const std::function< void *(const char *)> &gl_proc_address_resolver)
Context(ImpellerContext context, AdoptTag tag)
bool GetVulkanInfo(ImpellerContextVulkanInfo &info) const
DisplayListBuilder & Transform(const ImpellerMatrix &transform)
DisplayListBuilder & DrawRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, const Paint &paint)
DisplayListBuilder & Restore()
DisplayListBuilder & DrawLine(const ImpellerPoint &from, const ImpellerPoint &to, const Paint &paint)
DisplayListBuilder & Scale(float x_scale, float y_scale)
DisplayListBuilder & DrawRoundedRectDifference(const ImpellerRect &outer_rect, const ImpellerRoundingRadii &outer_radii, const ImpellerRect &inner_rect, const ImpellerRoundingRadii &inner_radii, const Paint &paint)
DisplayListBuilder & Rotate(float angle_degrees)
DisplayListBuilder & ClipRect(const ImpellerRect &rect, ImpellerClipOperation op)
DisplayListBuilder & DrawRect(const ImpellerRect &rect, const Paint &paint)
DisplayListBuilder & ResetTransform()
DisplayListBuilder & DrawTextureRect(const Texture &texture, const ImpellerRect &src_rect, const ImpellerRect &dst_rect, ImpellerTextureSampling sampling, const Paint &paint)
DisplayListBuilder & DrawParagraph(const Paragraph ¶graph, const ImpellerPoint &point)
DisplayListBuilder & DrawPaint(const Paint &paint)
DisplayListBuilder & DrawDashedLine(const ImpellerPoint &from, const ImpellerPoint &to, float on_length, float off_length, const Paint &paint)
DisplayListBuilder & DrawPath(const Path &path, const Paint &paint)
DisplayListBuilder & ClipRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &radii, ImpellerClipOperation op)
DisplayListBuilder & SaveLayer(const ImpellerRect &bounds, const Paint *paint=nullptr, const ImageFilter *backdrop=nullptr)
ImpellerMatrix GetTransform()
DisplayListBuilder & SetTransform(const ImpellerMatrix &transform)
DisplayListBuilder(const ImpellerRect *cull_rect=nullptr)
DisplayListBuilder & RestoreToCount(uint32_t count)
DisplayListBuilder & DrawOval(const ImpellerRect &oval_bounds, const Paint &paint)
DisplayListBuilder & Save()
DisplayListBuilder & DrawShadow(const Path &path, const ImpellerColor &shadow_color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
DisplayListBuilder & Translate(float x_translation, float y_translation)
DisplayListBuilder & DrawTexture(const Texture &texture, const ImpellerPoint &point, ImpellerTextureSampling sampling, const Paint &paint)
DisplayListBuilder & DrawDisplayList(const DisplayList &display_list, float opacity=1.0f)
DisplayListBuilder & ClipPath(const Path &path, ImpellerClipOperation op)
DisplayListBuilder & ClipOval(const ImpellerRect &oval_bounds, ImpellerClipOperation op)
DisplayList(ImpellerDisplayList display_list, AdoptTag tag)
size_t GetGraphemeClusterCodeUnitRangeEnd() const
GlyphInfo(ImpellerGlyphInfo info, AdoptTag tag)
size_t GetGraphemeClusterCodeUnitRangeBegin() const
ImpellerTextDirection GetTextDirection() const
ImpellerRect GetGraphemeClusterBounds() const
static ImageFilter Compose(const ImageFilter &outer, const ImageFilter &inner)
static ImageFilter Dilate(float x_radius, float y_radius)
static ImageFilter Matrix(const ImpellerMatrix &matrix, ImpellerTextureSampling sampling)
static ImageFilter Blur(float x_sigma, float y_sigma, ImpellerTileMode tile_mode)
static ImageFilter Erode(float x_radius, float y_radius)
ImageFilter(ImpellerImageFilter filter, AdoptTag tag)
bool IsHardbreak(size_t line) const
size_t GetCodeUnitEndIndex(size_t line) const
size_t GetCodeUnitStartIndex(size_t line) const
double GetHeight(size_t line) const
double GetDescent(size_t line) const
size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const
double GetUnscaledAscent(size_t line) const
double GetWidth(size_t line) const
size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const
double GetBaseline(size_t line) const
double GetLeft(size_t line) const
double GetAscent(size_t line) const
LineMetrics(ImpellerLineMetrics metrics, AdoptTag tag)
const uint8_t * GetMapping() const
Mapping(const uint8_t *mapping, size_t size, std::function< void()> release_callback)
static MaskFilter Blur(ImpellerBlurStyle style, float sigma)
MaskFilter(ImpellerMaskFilter filter, AdoptTag tag)
Object & operator=(const Object &other)
Object & operator=(Object &&other)
Object(T object, AdoptTag)
Object(const Object &other)
Paint & SetDrawStyle(ImpellerDrawStyle style)
Paint & SetColor(const ImpellerColor &color)
Paint & SetBlendMode(ImpellerBlendMode mode)
Paint & SetMaskFilter(const MaskFilter &filter)
Paint & SetStrokeJoin(ImpellerStrokeJoin join)
Paint & SetStrokeWidth(float width)
Paint & SetStrokeCap(ImpellerStrokeCap cap)
Paint & SetColorFilter(const ColorFilter &filter)
Paint & SetColorSource(const ColorSource &source)
Paint & SetImageFilter(const ImageFilter &filter)
Paint & SetStrokeMiter(float miter)
Paragraph Build(float width)
ParagraphBuilder & PushStyle(const ParagraphStyle &style)
ParagraphBuilder & PopStyle()
ParagraphBuilder(const TypographyContext &context)
ParagraphBuilder & AddText(const std::string &string)
ParagraphBuilder & AddText(const std::string_view &string)
ParagraphBuilder & AddText(const uint8_t *utf8_data, uint32_t length)
float GetMaxIntrinsicWidth()
LineMetrics GetLineMetrics() const
GlyphInfo GlyphInfoAtParagraphCoordinates(double x, double y)
GlyphInfo GlyphInfoAtCodeUnitIndex(size_t code_unit_index)
float GetAlphabeticBaseline()
ImpellerRange GetWordBoundary(size_t code_unit_index)
float GetIdeographicBaseline()
Paragraph(ImpellerParagraph paragraph, AdoptTag tag)
float GetLongestLineWidth()
float GetMinIntrinsicWidth()
ParagraphStyle & SetTextAlignment(ImpellerTextAlignment align)
ParagraphStyle & SetTextDirection(ImpellerTextDirection direction)
ParagraphStyle & SetFontSize(float size)
ParagraphStyle & SetForeground(const Paint &paint)
ParagraphStyle & SetLocale(const char *locale)
ParagraphStyle & SetBackground(const Paint &paint)
ParagraphStyle & SetFontStyle(ImpellerFontStyle style)
ParagraphStyle & SetFontFamily(const char *family_name)
ParagraphStyle & SetFontWeight(ImpellerFontWeight weight)
ParagraphStyle & SetMaxLines(uint32_t max_lines)
ParagraphStyle & SetHeight(float height)
PathBuilder & QuadraticCurveTo(const ImpellerPoint &control_point, const ImpellerPoint &end_point)
PathBuilder & AddRect(const ImpellerRect &rect)
PathBuilder & CubicCurveTo(const ImpellerPoint &control_point_1, const ImpellerPoint &control_point_2, const ImpellerPoint &end_point)
Path BuildCopy(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero) const
PathBuilder & AddArc(const ImpellerRect &oval_bounds, float start_angle_degrees, float end_angle_degrees)
Path Build(ImpellerFillType fill=ImpellerFillType::kImpellerFillTypeNonZero)
PathBuilder & MoveTo(const ImpellerPoint &location)
PathBuilder & LineTo(const ImpellerPoint &location)
PathBuilder & AddOval(const ImpellerRect &oval_bounds)
PathBuilder & AddRoundedRect(const ImpellerRect &rect, const ImpellerRoundingRadii &rounding_radii)
Path(ImpellerPath path, AdoptTag tag)
static Surface WrapFBO(const Context &context, uint64_t fbo, ImpellerPixelFormat format, const ImpellerISize &size)
Surface(ImpellerSurface surface, AdoptTag tag)
Surface(ImpellerSurface surface)
bool Draw(const DisplayList &display_list) const
static Surface WrapMetalDrawable(const Context &context, void *metal_drawable)
Texture(ImpellerTexture texture, AdoptTag adopt)
static Texture WithContents(const Context &context, const ImpellerTextureDescriptor &descriptor, std::unique_ptr< Mapping > mapping=nullptr)
static Texture WithOpenGLTexture(const Context &context, const ImpellerTextureDescriptor &descriptor, uint64_t handle)
uint64_t GetOpenGLHandle() const
bool RegisterFont(std::unique_ptr< Mapping > mapping, const char *optional_family_name_alias=nullptr)
VulkanSwapchain(ImpellerVulkanSwapchain swapchain, AdoptTag tag)
static VulkanSwapchain Create(const Context &context, void *vulkan_surface_khr)
Surface AcquireNextSurface() const
@ kImpellerFillTypeNonZero
#define IMPELLER_MAKE_VERSION(variant, major, minor, patch)
Pack a version in a uint32_t.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE ImpellerPathBuilderNew()
Create a new path builder. Paths themselves are immutable. A builder builds these immutable paths.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE ImpellerPaintNew()
Create a new paint with default values.
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...
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE ImpellerParagraphStyleNew()
Create a new paragraph style.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE ImpellerTypographyContextNew()
Create a new typography contents.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE ImpellerDisplayListBuilderNew(const ImpellerRect *IMPELLER_NULLABLE cull_rect)
Create a new display list builder.
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE ImpellerParagraphBuilderNew(ImpellerTypographyContext IMPELLER_NONNULL context)
Create a new paragraph builder.
#define IMPELLER_HPP_PROC(proc)
#define IMPELLER_HPP_EACH_PROC(PROC)
ProcTable gGlobalProcTable
IMPELLER_HPP_DEFINE_TRAITS(ImpellerColorFilter)
auto operator()(Args &&... args) const
bool Initialize(const std::function< void *(const char *function_name)> &resolver)
ImpellerCallback IMPELLER_NULLABLE on_release
const uint8_t *IMPELLER_NONNULL data
std::shared_ptr< const fml::Mapping > data