libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-dlo.h
Go to the documentation of this file.
1/*
2 * lws abstract display
3 *
4 * Copyright (C) 2019 - 2022 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * lws display_list and display_list objects (dlo)
25 */
26
27#if !defined(__LWS_DLO_H__)
28#define __LWS_DLO_H__
29
30#include <stdint.h>
31
33struct lws_surface_info;
35struct lws_display_font;
36struct lws_dlo_text;
37struct lws_display;
38struct lws_dlo_text;
39struct lws_dlo;
40
41#define LWSDC_RGBA(_r, _g, _b, _a) (((uint32_t)(_r) & 0xff) | \
42 (((uint32_t)(_g) & 0xff) << 8) | \
43 (((uint32_t)(_b) & 0xff) << 16) | \
44 (((uint32_t)(_a) & 0xff) << 24))
45
46#define LWSDC_R(_c) ((_c) & 0xff)
47#define LWSDC_G(_c) ((_c >> 8) & 0xff)
48#define LWSDC_B(_c) ((_c >> 16) & 0xff)
49#define LWSDC_ALPHA(_c) ((_c >> 24) & 0xff)
50
51#define RGB_TO_Y(_r, _g, _b) ((((_r) * 299) + ((_g) * 587) + ((_b) * 114)) / 1000)
52/* stores Y in RGBY */
53#define PALETTE_RGBY(_r, _g, _b) LWSDC_RGBA(_r, _g, _b, (RGB_TO_Y(_r, _g, _b)))
54
55typedef struct {
59
60/*
61 * When using RGBA to describe native greyscale, R is Y and A is A, GB is ignored
62 */
63
64/* composed at start of larger, font-specific glyph struct */
65
66typedef struct lws_font_glyph {
68
73
74 int8_t x; /* x offset inside the glyph */
75
76 void *pin; /* font-private: what to unpin on free */
78
80typedef lws_font_glyph_t * (*lws_dlo_image_glyph_t)(
81 struct lws_dlo_text *text,
82 uint32_t unicode, char attach);
83typedef void (*lws_dlo_destroy_t)(struct lws_dlo *dlo);
84
85typedef struct lws_display_id {
87
88 char id[16];
89 lws_box_t box; /* taken from DLO after layout */
90
91 void *priv_user;
93
94 char exists;
95 char iframe; /* 1 = render html as if partial
96 * is the origin, otherwise
97 * render html with surface
98 * (0,0) as origin and rs->box
99 * is a viewport on to that */
101
102/*
103 * Common dlo object that joins the display list, composed into a subclass
104 * object like lws_dlo_rect_t etc
105 */
106
107typedef struct lws_dlo {
109
110 lws_dll2_t col_list; /* lws_dlo_t: column-mates */
111 lws_dll2_t row_list; /* lws_dlo_t: row-mates */
112
113 /* children are rendered "inside" the parent DLO box after allowing
114 * for parent padding */
116
117 /* only used for dlo rect representing whole table */
118
119 lws_dll2_owner_t table_cols; /* lhp_table_col_t */
120 lws_dll2_owner_t table_rows; /* lhp_table_row_t */
121
122 /* may point to dlo whose width or height decides our x or y:
123 * abut_y is the positioned ancestor a bottom-anchored absolute
124 * box waits on, box.y meanwhile holding the offset up from its
125 * bottom edge (layout) */
126
129
130 lws_dlo_destroy_t _destroy; /* dlo-type specific cb */
131 lws_dlo_renderer_t render; /* dlo-type specific cb */
132
134 lws_fx_t padding[4]; /* child origin */
135
136 lws_display_id_t *id; /* only valid until ids destroyed */
137
140
141 uint8_t budget; /* limit spinning */
142 int16_t base_up; /* baseline: distance up from the
143 * box bottom, 0 = bottom edge
144 * (layout) */
145
146 uint8_t flag_toplevel:1; /* don't scan up with me (different owner) */
147 uint8_t flag_block:1; /* block-level box (layout) */
148 uint8_t flag_row:1; /* table row box (layout) */
149 uint8_t flag_cell:1; /* table cell box (layout) */
150 uint8_t flag_abs:1; /* positioned box (layout) */
151 uint8_t flag_float:1; /* floated box (layout) */
152 uint8_t flag_zraise:1; /* positioned, z-index > 0 */
153 uint8_t flag_online:1; /* item of the line being ended (layout) */
154 uint8_t flag_bg_homed:1; /* css background image moved into
155 * its element's own dlo (layout) */
156 uint8_t flag_inline_bg:1; /* background rect of the text
157 * run that follows it (layout) */
158 uint8_t flag_flex_item:1; /* item of a row flex container
159 * (layout) */
160 uint8_t flag_fixed_h:1; /* has a css height: not
161 * stretched (layout) */
162 uint8_t flag_abs_stretch:1; /* waiting on abut_y
163 * to stretch between top and
164 * bottom, box.h meanwhile the
165 * bottom offset (layout) */
166 uint8_t flex_grow; /* flex-grow, for flag_flex_item */
167 uint8_t align_self; /* LCSP_PROPVAL_* or 0 = auto */
168
169 /* render-specific members ... */
171
172typedef struct lws_circle {
174
175 /* rasterization temps */
176 lws_fx_t orx; /* abs pixel x for centre */
177 lws_fx_t ory; /* abs pixel y for centre */
181
182typedef struct lws_dlo_rect {
184 lws_circle_t c[4]; /* t-l, t-r, b-l, b-r */
185 lws_fx_t b[4]; /* border width on t/r/b/l */
186 lws_display_colour_t dcb; /* border colour */
187
188 /* rasterization temps */
189
193
196 /* 0 = full box, else fill the triangle at the named corner: the css
197 * border-triangle idiom (transparent adjacent borders on an empty
198 * box) */
199 uint8_t tri; /* 1 t-l, 2 t-r, 3 b-l, 4 b-r */
201
205
206/*
207 * Non-printing hit region: renders nothing, but marks the area of its box
208 * as belonging to something, eg, the link whose url it carries. Being a
209 * dlo it is placed and moved by the layout with the things around it, and
210 * its position in the paint order decides which of several overlapping
211 * regions a point belongs to (the last, as a viewer sees it on top).
212 */
213
214/*
215 * The pointer shape a hit region asks for while the pointer is over it, in
216 * platform-neutral terms: a windowing backend maps these to whatever it
217 * has (X11 font cursors, NSCursor, LoadCursor...). A link asks for the
218 * pointing hand, editable text for the I-beam, css cursor: for the rest.
219 */
231
232typedef struct lws_dlo_hit {
234 const char *url; /* as written in the document, in
235 * the same allocation; NULL for a
236 * region that only sets the
237 * cursor */
238 uint8_t fill; /* takes its parent's size */
239 uint8_t cursor; /* lws_dlo_cursor_t */
241
242typedef struct lws_font_choice {
243 const char *family_name;
244 const char *generic_name;
246 uint16_t style; /* normal, italic, oblique */
249
250/*
251 * Something that can be waiting for a font to arrive from the server (a
252 * document's layout, a render): when the fetch it waits on completes, or
253 * fails, sul is scheduled with cb. Embedded in the waiting object, and
254 * removed from the wait when that is destroyed
255 */
261
262typedef struct lws_display_font {
264
266
267 const uint8_t *data; /* may be cast to imp struct */
268 uint8_t *priv; /* only used by implementation */
269 size_t data_len;
272
273 lws_fx_t em; /* 1 em in pixels */
274 lws_fx_t ex; /* 1 ex in pixels */
276
277typedef struct lws_dlo_filesystem {
279
280 const char *name;
281 const void *data;
282 size_t len;
284
285#define LWSDLO_TEXT_FLAG_WRAP (1 << 0)
286
287typedef struct lws_dlo_text {
291 lws_box_t bounding_box; /* { 0, 0, w, h } relative
292 * to and subject to
293 * clipping by .dlo.box */
294
295 /* referred to by glyphs */
296 const struct lws_surface_info *ic;
297 struct lwsac *ac_glyphs;
300 uint16_t glyph_row; /* rows the glyph run decoders
301 * have produced since attach */
302
303 char *text;
305 size_t text_len;
308
310
313 int16_t font_height;
315
318
319 uint16_t font_gen; /* the font copy the glyphs
320 * were attached from */
321
324
330
331typedef struct lws_dlo_png {
332 lws_dlo_t dlo; /* ordering: first */
333 lws_flow_t flow; /* ordering: second */
334 char name[25];
336 uint32_t emitted; /* decoded rows issued so far,
337 * for viewport re-scans */
338 uint8_t *row; /* copy of the last row issued, for
339 * repeating it when scaled up */
341 lws_reclaimable_t rc; /* payload + decoder, once complete */
342 uint8_t evicted; /* renew from the asset cache
343 * before the next render */
344 uint8_t yields; /* consecutive OOM yields */
345 uint8_t failed; /* the decoder returned FATAL:
346 * nothing more from it */
348
349typedef struct lws_dlo_jpeg {
350 lws_dlo_t dlo; /* ordering: first */
351 lws_flow_t flow; /* ordering: second */
352 char name[25];
354 uint32_t emitted; /* decoded rows issued so far,
355 * for viewport re-scans */
356 uint8_t *row; /* copy of the last row issued, for
357 * repeating it when scaled up */
359 lws_reclaimable_t rc; /* payload + decoder, once complete */
360 uint8_t evicted; /* renew from the asset cache
361 * before the next render */
362 uint8_t failed; /* the decoder returned FATAL:
363 * nothing more from it */
365
366typedef struct lws_dlo_svg {
367 lws_dlo_t dlo; /* ordering: first */
368 lws_flow_t flow; /* ordering: second */
369 char name[25];
372
373/*
374 * Unlike the png and jpeg dlos, the gif dlo keeps the whole asset payload
375 * retained in one buffer, so the decode can start again from the top when the
376 * render does. It is freed once the frame has decoded. Interlaced rows
377 * arrive out of screen order, so those images are decoded once into a frame
378 * of palette indices (bounded in size) that the render reads lines from.
379 */
380
381typedef struct lws_dlo_gif {
382 lws_dlo_t dlo; /* ordering: first */
383 lws_flow_t flow; /* ordering: second */
384 char name[25];
386 uint8_t *whole; /* retained asset payload */
387 size_t whole_len;
389 size_t pos; /* decode feed cursor in whole */
390 uint8_t *frame; /* interlaced: decoded rows */
391 uint8_t *frame_have; /* bitmap of rows in frame */
392 char whole_done; /* whole fully decoded */
394
402
413
418
419typedef struct lws_dl_rend {
421 int w;
422 int h;
423 char clipped; /* the layout dropped content that
424 * landed below h */
426
428 lws_dlo_t *dlo; /* position in dlo owner */
429 lws_box_t co; /* our origin as parent */
431
432/*
433 * How deep a display list the dlo tree walkers (render, dump, hit test) can
434 * follow. Deeper nesting than this is truncated, it is not an error: the
435 * walkers all carry the stack by value, so on a constrained target the
436 * ceiling is what keeps them off a couple of KB of stack apiece.
437 */
438
439#if !defined(LWS_DLO_STACK_DEPTH)
440#if defined(LWS_ESP_PLATFORM)
441#define LWS_DLO_STACK_DEPTH 16
442#else
443#define LWS_DLO_STACK_DEPTH 64
444#endif
445#endif
446
448 lws_sorted_usec_list_t sul; /* return to event loop statefully */
449 struct lws_display_state *lds; /* optional, if using lws_display */
450
452
453 const struct lws_surface_info *ic; /* display dimensions, palette */
454
456 /* DLO child stack */
457 int sp; /* DLO child stack level */
458
459 uint8_t *line; /* Y or RGB line comp buffer */
460
462
463 /* the html document ss currently bound to this render state, when
464 * browsed with lws_lhp_ss_browse(); used by lws_lhp_ss_cancel() */
465
466 struct lws_ss_handle *hss_html;
467
470
471 char html;
472 char retained; /* nonzero: keep DLOs when the
473 * render cursor passes them, so
474 * the display list can be re-
475 * scanned at other offsets */
476 char layout_clipped; /* set when the html
477 * completes if the layout dropped
478 * content below the surface: a
479 * taller surface would show more */
480 int32_t viewport_h; /* 0, or the height css
481 * viewport units and the root
482 * element's height resolve
483 * against, when the layout
484 * surface is taller than what is
485 * shown at once (a scrolling
486 * window) */
487 struct lws_context *cx; /* set by lws_lhp_ss_browse_filter() */
488
489 lws_font_waiter_t font_wait; /* render waiting for a
490 * font from the server */
491
493
494
497
500
503
506
509
512
523
524//#if defined(_DEBUG)
527//#endif
528
538lws_display_list_destroy(struct lws_context *cx, lws_displaylist_t *dl);
539
542
545
548
549/*
550 * lws_display_list_render_line() - render a single raster line of the list
551 *
552 * \param rs: prepared render state object
553 *
554 * Allocates a line pair buffer into ds->line if necessary, and renders the
555 * current line (set by ds->curr) of the display list rasterization into it
556 */
559
562
563/*
564 * rect
565 */
566
569 lws_box_t *box, const lws_fx_t *radii,
571
574
575/*
576 * hit region
577 */
578
594 const lws_box_t *box, const char *url, size_t url_len);
595
598
601
616
630
631/*
632 * dlo text
633 */
634
637 lws_box_t *box, const lws_display_font_t *font);
638
641 lws_fx_t indent, const char *utf8, size_t text_len);
642
654 size_t text_len, lws_fx_t *total,
655 lws_fx_t *longest_word);
656
659
660/*
661 * PNG
662 */
663
666 lws_box_t *box, const char *name, size_t len);
667
670
673
676
677/*
678 * JPEG
679 */
680
683 lws_box_t *box, const char *name, size_t len);
684
687
690
693
694/*
695 * SVG
696 */
697
700 lws_box_t *box, const char *name, size_t len);
701
704
707
710
711/*
712 * GIF
713 */
714
717 lws_box_t *box, const char *name, size_t len);
718
721
724
727
728/*
729 * Take rx payload for a gif dlo into its retained buffer; the gif flow
730 * keeps the payload rather than consuming it from the flow buflist.
731 * Returns 0, or nonzero on allocation failure or over the retention cap.
732 */
733
735lws_display_dlo_gif_rx(lws_dlo_gif_t *dlo_gif, const uint8_t *buf, size_t len);
736
737/*
738 * SS / dlo images
739 */
740
741struct lhp_ctx;
742
757
760
762lws_dlo_ss_find(struct lws_context *cx, const char *url, lws_dlo_image_t *u);
763
774lws_dlo_ss_assets_active(struct lws_context *cx);
775
785lws_dlo_ss_stop_any_active(struct lws_context *cx);
786
802lws_dlo_ss_detach_lhp(struct lws_context *cx, struct lhp_ctx *lhp);
803
817lws_dlo_ss_renew_images(struct lws_context *cx);
818
829lws_dlo_ss_renew_image(struct lws_context *cx, lws_dlo_t *dlo);
830
831
832/*
833 * The context dlo asset cache (see the dlo_asset_cache_dir member of
834 * lws_context_creation_info) stores fetched image assets in a self-maintaining
835 * file-backed cache, so still-valid assets are reused instead of refetched.
836 */
837
838#if !defined(LWS_DLO_ASSET_BLOB_DEFAULT_MAX_FOOTPRINT)
839#define LWS_DLO_ASSET_BLOB_DEFAULT_MAX_FOOTPRINT (64 * 1024 * 1024)
842#endif
843
844#if !defined(LWS_DLO_ASSET_BLOB_MAX_PAYLOAD)
845#define LWS_DLO_ASSET_BLOB_MAX_PAYLOAD (16 * 1024 * 1024)
847#endif
848
849#if !defined(LWS_DLO_ASSET_L1_MAX_FOOTPRINT)
850#define LWS_DLO_ASSET_L1_MAX_FOOTPRINT (8 * 1024 * 1024)
852#endif
853
854#if !defined(LWS_DLO_ASSET_L1_MAX_ITEMS)
855#define LWS_DLO_ASSET_L1_MAX_ITEMS 256
857#endif
858
859#if !defined(LWS_DLO_ASSET_CACHE_EXPIRY_S)
860#define LWS_DLO_ASSET_CACHE_EXPIRY_S (24 * 60 * 60)
863#endif
864
875LWS_VISIBLE LWS_EXTERN struct lws_cache_ttl_lru *
876lws_dlo_asset_cache(struct lws_context *cx);
877
879lhp_displaylist_layout(struct lhp_ctx *ctx, char reason);
880
881/*
882 * These image accessor macros adapt to the image types that were built in.
883 * Because they are macros, the svg arms have to be selected at compile time
884 * or they would reference svg apis that were not built.
885 */
886
887#if defined(LWS_WITH_SVG) && defined(LWS_WITH_GIF)
888
889#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
890 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
891 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
892 (_u)->type == LWSDLOSS_TYPE_SVG ? \
893 (int)lws_svg_get_width((_u)->u.dlo_svg->svg) : \
894 (_u)->type == LWSDLOSS_TYPE_GIF ? \
895 (int)lws_gif_get_width((_u)->u.dlo_gif->gif) : \
896 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
897#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
898 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
899 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
900 (_u)->type == LWSDLOSS_TYPE_SVG ? \
901 (int)lws_svg_get_height((_u)->u.dlo_svg->svg) : \
902 (_u)->type == LWSDLOSS_TYPE_GIF ? \
903 (int)lws_gif_get_height((_u)->u.dlo_gif->gif) : \
904 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
905
906#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
907 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
908 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
909 (_u)->type == LWSDLOSS_TYPE_SVG ? \
910 lws_display_dlo_svg_metadata_scan((_u)->u.dlo_svg) : \
911 (_u)->type == LWSDLOSS_TYPE_GIF ? \
912 lws_display_dlo_gif_metadata_scan((_u)->u.dlo_gif) : \
913 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
914
915#elif defined(LWS_WITH_SVG)
916
917#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
918 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
919 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
920 (_u)->type == LWSDLOSS_TYPE_SVG ? \
921 (int)lws_svg_get_width((_u)->u.dlo_svg->svg) : \
922 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
923#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
924 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
925 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
926 (_u)->type == LWSDLOSS_TYPE_SVG ? \
927 (int)lws_svg_get_height((_u)->u.dlo_svg->svg) : \
928 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
929
930#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
931 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
932 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
933 (_u)->type == LWSDLOSS_TYPE_SVG ? \
934 lws_display_dlo_svg_metadata_scan((_u)->u.dlo_svg) : \
935 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
936
937#elif defined(LWS_WITH_GIF)
938
939#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
940 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
941 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
942 (_u)->type == LWSDLOSS_TYPE_GIF ? \
943 (int)lws_gif_get_width((_u)->u.dlo_gif->gif) : \
944 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
945#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
946 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
947 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
948 (_u)->type == LWSDLOSS_TYPE_GIF ? \
949 (int)lws_gif_get_height((_u)->u.dlo_gif->gif) : \
950 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
951
952#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
953 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
954 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
955 (_u)->type == LWSDLOSS_TYPE_GIF ? \
956 lws_display_dlo_gif_metadata_scan((_u)->u.dlo_gif) : \
957 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
958
959#else
960
961#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
962 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
963 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
964 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
965#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
966 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
967 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
968 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
969
970#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
971 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
972 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
973 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
974
975#endif
976
977/*
978 * Font registry
979 *
980 * Register fonts (currently, psfu) to the lws_context, and select the closest
981 * matching. Used to pick fonts from whatever CSS information is available.
982 */
983
985lws_font_register(struct lws_context *cx, const uint8_t *data, size_t data_len);
986
999lws_font_register_file(struct lws_context *cx, const char *path);
1000
1013lws_fonts_register_dir(struct lws_context *cx, const char *dirpath);
1014
1048lws_fonts_register_manifest(struct lws_context *cx, const char *url);
1049
1051lws_font_choose(struct lws_context *cx, const lws_font_choice_t *hints);
1052
1054lws_fonts_destroy(struct lws_context *cx);
1055
1056/*
1057 * Static blob registry (built-in, name-accessible blobs)
1058 */
1059
1061lws_dlo_file_register(struct lws_context *cx, const lws_dlo_filesystem_t *f);
1062
1063/* only needed if f dynamically heap-allocated... doesn't free data; data
1064 * is typically overallocated after the lws_dlo_filesystem_t and freed when
1065 * that is freed by this. */
1066
1069
1071lws_dlo_file_unregister_by_name(struct lws_context *cx, const char *name);
1072
1074lws_dlo_file_choose(struct lws_context *cx, const char *name);
1075
1077lws_dlo_file_destroy(struct lws_context *cx);
1078
1080#endif
struct lws_dll2 lws_dll2_t
struct lws_dll2_owner lws_dll2_owner_t
struct lws_flow lws_flow_t
struct lws_reclaimable lws_reclaimable_t
#define LWS_EXTERN_FOR_DATA
unsigned short uint16_t
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
struct lws_fixed3232 lws_fx_t
lws_stateful_ret_t
#define LWS_VISIBLE
uint32_t lws_display_colour_t
Definition lws-display.h:31
int16_t lws_display_list_coord_t
Definition lws-display.h:28
uint16_t lws_display_scalar
Definition lws-display.h:29
struct lws_box lws_box_t
lws_flow_t flow
Definition lws-dlo.h:351
uint8_t flag_abs_stretch
Definition lws-dlo.h:162
uint8_t init
Definition lws-dlo.h:194
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_text_update(lws_dlo_text_t *text, lws_display_colour_t dc, lws_fx_t indent, const char *utf8, size_t text_len)
LWS_VISIBLE LWS_EXTERN lws_dlo_cursor_t lws_display_dl_cursor_at(lws_displaylist_t *dl, int x, int y)
int16_t font_line_height
Definition lws-dlo.h:314
lws_display_colour_t dc
Definition lws-dlo.h:139
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_renew_image(struct lws_context *cx, lws_dlo_t *dlo)
LWS_VISIBLE LWS_EXTERN lws_dlo_filesystem_t * lws_dlo_file_register(struct lws_context *cx, const lws_dlo_filesystem_t *f)
uint8_t flag_block
Definition lws-dlo.h:147
char whole_done
Definition lws-dlo.h:392
uint8_t * kern
Definition lws-dlo.h:304
LWS_VISIBLE LWS_EXTERN const lws_display_font_t * lws_font_choose(struct lws_context *cx, const lws_font_choice_t *hints)
lws_font_glyph_t *(* lws_dlo_image_glyph_t)(struct lws_dlo_text *text, uint32_t unicode, char attach)
Definition lws-dlo.h:80
struct lws_dlo_hit lws_dlo_hit_t
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_find(struct lws_context *cx, const char *url, lws_dlo_image_t *u)
uint8_t tri
Definition lws-dlo.h:199
lws_fx_t em
Definition lws-dlo.h:273
lws_dlo_cursor_t
Definition lws-dlo.h:220
@ LWS_DLO_CURSOR_NONE
Definition lws-dlo.h:229
@ LWS_DLO_CURSOR_WAIT
Definition lws-dlo.h:226
@ LWS_DLO_CURSOR_HELP
Definition lws-dlo.h:227
@ LWS_DLO_CURSOR_CROSSHAIR
Definition lws-dlo.h:224
@ LWS_DLO_CURSOR_DEFAULT
Definition lws-dlo.h:221
@ LWS_DLO_CURSOR_POINTER
Definition lws-dlo.h:222
@ LWS_DLO_CURSOR_NOT_ALLOWED
Definition lws-dlo.h:228
@ LWS_DLO_CURSOR_TEXT
Definition lws-dlo.h:223
@ LWS_DLO_CURSOR_MOVE
Definition lws-dlo.h:225
lws_displaylist_t * dl
Definition lws-dlo.h:420
uint16_t curr
Definition lws-dlo.h:299
LWS_VISIBLE LWS_EXTERN void lws_display_dl_init(lws_displaylist_t *dl, struct lws_display_state *ds)
lws_flow_t flow
Definition lws-dlo.h:368
void * priv_user
Definition lws-dlo.h:91
LWS_VISIBLE LWS_EXTERN void lws_dlo_contents(lws_dlo_t *parent, lws_dlo_dim_t *dim)
lws_dll2_t list
Definition lws-dlo.h:257
lws_displaylist_t displaylist
Definition lws-dlo.h:461
uint8_t flag_online
Definition lws-dlo.h:153
size_t text_len
Definition lws-dlo.h:305
struct lws_dlo * abut_x
Definition lws-dlo.h:127
LWS_VISIBLE LWS_EXTERN void lws_display_dl_dump(lws_displaylist_t *dl)
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_gif_rx(lws_dlo_gif_t *dlo_gif, const uint8_t *buf, size_t len)
struct lws_font_waiter lws_font_waiter_t
LWS_VISIBLE LWS_EXTERN struct lws_cache_ttl_lru * lws_dlo_asset_cache(struct lws_context *cx)
uint32_t emitted
Definition lws-dlo.h:336
const char * name
Definition lws-dlo.h:280
uint8_t * frame
Definition lws-dlo.h:390
lws_box_t box
Definition lws-dlo.h:89
LWS_VISIBLE LWS_EXTERN lws_dlo_png_t * lws_display_dlo_png_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_reclaimable_t rc
Definition lws-dlo.h:359
struct lhp_ctx * lhp
Definition lws-dlo.h:751
uint8_t cursor
Definition lws-dlo.h:239
struct lws_dlo_jpeg lws_dlo_jpeg_t
lws_upng_t * png
Definition lws-dlo.h:335
lws_display_scalar lowest_id_y
Definition lws-dlo.h:469
lws_fx_t height
Definition lws-dlo.h:71
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_stop_any_active(struct lws_context *cx)
lws_fx_t indent
Definition lws-dlo.h:309
struct lwsac * ac_glyphs
Definition lws-dlo.h:297
lws_dlo_image_type_t
Definition lws-dlo.h:395
@ LWSDLOSS_TYPE_JPEG
Definition lws-dlo.h:396
@ LWSDLOSS_TYPE_SVG
Definition lws-dlo.h:398
@ LWSDLOSS_TYPE_CSS
Definition lws-dlo.h:400
@ LWSDLOSS_TYPE_PNG
Definition lws-dlo.h:397
@ LWSDLOSS_TYPE_GIF
Definition lws-dlo.h:399
uint16_t style
Definition lws-dlo.h:246
lws_dll2_t list
Definition lws-dlo.h:278
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_jpeg_destroy(struct lws_dlo *dlo)
size_t whole_size
Definition lws-dlo.h:388
lws_sorted_usec_list_t sul
Definition lws-dlo.h:448
lws_fx_t btm
Definition lws-dlo.h:190
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_get_ids_boxes(lws_display_render_state_t *rs)
lws_dll2_t list
Definition lws-dlo.h:263
uint16_t glyph_row
Definition lws-dlo.h:300
size_t whole_len
Definition lws-dlo.h:387
LWS_VISIBLE LWS_EXTERN int lws_dlo_ensure_err_diff(lws_dlo_t *dlo)
lws_fx_t r
Definition lws-dlo.h:173
int16_t group_height
Definition lws-dlo.h:316
lws_dlo_renderer_t render
Definition lws-dlo.h:131
int16_t font_height
Definition lws-dlo.h:313
struct lws_dlo_gif lws_dlo_gif_t
uint8_t flag_toplevel
Definition lws-dlo.h:146
lws_flow_t flow
Definition lws-dlo.h:383
LWS_VISIBLE LWS_EXTERN int lws_fonts_register_manifest(struct lws_context *cx, const char *url)
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_text_destroy(struct lws_dlo *dlo)
lws_display_list_coord_t clkernpx
Definition lws-dlo.h:306
lws_dlo_t dlo
Definition lws-dlo.h:233
LWS_VISIBLE LWS_EXTERN lws_dlo_gif_t * lws_display_dlo_gif_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_dlo_t dlo
Definition lws-dlo.h:183
lws_dll2_owner_t dl
Definition lws-dlo.h:415
lws_sorted_usec_list_t * sul
Definition lws-dlo.h:258
lws_dll2_owner_t glyphs
Definition lws-dlo.h:290
lws_display_id_t * id
Definition lws-dlo.h:136
const void * data
Definition lws-dlo.h:281
const struct lws_surface_info * ic
Definition lws-dlo.h:453
uint8_t * row
Definition lws-dlo.h:338
struct lws_display_id lws_display_id_t
uint8_t evicted
Definition lws-dlo.h:342
const char * url
Definition lws-dlo.h:234
LWS_VISIBLE LWS_EXTERN void lws_display_render_dump_ids(lws_dll2_owner_t *ids)
struct lws_context * cx
Definition lws-dlo.h:744
LWS_VISIBLE LWS_EXTERN lws_dlo_rect_t * lws_display_dlo_rect_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const lws_fx_t *radii, lws_display_colour_t dc)
lws_jpeg_t * j
Definition lws-dlo.h:353
lws_dlo_svg_t * dlo_svg
lws_dlo_gif_t * dlo_gif
void(* lws_dlo_destroy_t)(struct lws_dlo *dlo)
Definition lws-dlo.h:83
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_gif_destroy(struct lws_dlo *dlo)
lws_fx_t ex
Definition lws-dlo.h:274
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_text_measure(lws_dlo_text_t *text, const char *utf8, size_t text_len, lws_fx_t *total, lws_fx_t *longest_word)
const char * generic_name
Definition lws-dlo.h:244
LWS_VISIBLE LWS_EXTERN void lws_dlo_ss_renew_images(struct lws_context *cx)
size_t pos
Definition lws-dlo.h:389
uint32_t row_len
Definition lws-dlo.h:340
size_t data_len
Definition lws-dlo.h:269
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_assets_active(struct lws_context *cx)
uint8_t * whole
Definition lws-dlo.h:386
LWS_VISIBLE LWS_EXTERN int lws_font_register(struct lws_context *cx, const uint8_t *data, size_t data_len)
const uint8_t * data
Definition lws-dlo.h:267
lws_dlo_jpeg_t * dlo_jpeg
struct lws_font_choice lws_font_choice_t
uint8_t flag_fixed_h
Definition lws-dlo.h:160
uint16_t fixed_height
Definition lws-dlo.h:247
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_destroy(lws_dlo_t **r)
lws_displaylist_t * dl
Definition lws-dlo.h:745
lws_dlo_t * dlo_parent
Definition lws-dlo.h:746
uint32_t emitted
Definition lws-dlo.h:354
lws_dlo_t dlo
Definition lws-dlo.h:350
lws_sorted_usec_list_t sul
Definition lws-dlo.h:327
lws_dll2_t col_list
Definition lws-dlo.h:110
uint8_t flag_float
Definition lws-dlo.h:151
lws_dll2_owner_t table_rows
Definition lws-dlo.h:120
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_svg_metadata_scan(lws_dlo_svg_t *ds)
lws_display_render_stack_t st[LWS_DLO_STACK_DEPTH]
Definition lws-dlo.h:455
lws_sorted_usec_list_t * on_rx_sul
Definition lws-dlo.h:749
lws_fx_t rsq
Definition lws-dlo.h:178
struct lws_dlo_filesystem lws_dlo_filesystem_t
struct lws_display_font lws_display_font_t
int16_t group_y_baseline
Definition lws-dlo.h:317
LWS_VISIBLE LWS_EXTERN lws_display_id_t * lws_display_render_get_id(lws_display_render_state_t *rs, const char *id)
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_unregister(lws_dlo_filesystem_t **f)
lws_fx_t cwidth
Definition lws-dlo.h:72
struct lws_context * cx
Definition lws-dlo.h:487
LWS_VISIBLE LWS_EXTERN lws_dlo_hit_t * lws_display_dlo_hit_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, const lws_box_t *box, const char *url, size_t url_len)
uint8_t flag_bg_homed
Definition lws-dlo.h:154
sul_cb_t cb
Definition lws-dlo.h:259
uint8_t flex_grow
Definition lws-dlo.h:166
struct lws_dlo_png lws_dlo_png_t
char name[25]
Definition lws-dlo.h:384
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_list_render_line(lws_display_render_state_t *rs)
lws_fx_t _cwidth
Definition lws-dlo.h:322
LWS_VISIBLE LWS_EXTERN lws_dlo_text_t * lws_display_dlo_text_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const lws_display_font_t *font)
uint32_t flags
Definition lws-dlo.h:311
struct lws_dlo_rect lws_dlo_rect_t
lws_dll2_owner_t ids
Definition lws-dlo.h:451
uint16_t weight
Definition lws-dlo.h:245
lws_dlo_t dlo
Definition lws-dlo.h:203
LWS_VISIBLE LWS_EXTERN lws_dlo_svg_t * lws_display_dlo_svg_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_unregister_by_name(struct lws_context *cx, const char *name)
lws_dll2_t list
Definition lws-dlo.h:67
const struct lws_surface_info * ic
Definition lws-dlo.h:296
struct lws_display_state * ds
Definition lws-dlo.h:416
uint8_t flag_flex_item
Definition lws-dlo.h:158
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_png_metadata_scan(lws_dlo_png_t *dp)
uint8_t * row
Definition lws-dlo.h:356
uint8_t align_self
Definition lws-dlo.h:167
uint8_t alt
Definition lws-dlo.h:195
lws_dlo_t dlo
Definition lws-dlo.h:288
lws_fx_t w
Definition lws-dlo.h:56
lws_dlo_image_t * u
Definition lws-dlo.h:752
uint8_t flag_abs
Definition lws-dlo.h:150
int16_t base_up
Definition lws-dlo.h:142
#define LWS_DLO_STACK_DEPTH
Definition lws-dlo.h:443
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_gif_metadata_scan(lws_dlo_gif_t *dg)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_hit(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_create(lws_dlo_ss_create_info_t *i, lws_dlo_t **pdlo)
lws_box_t bounding_box
Definition lws-dlo.h:291
lws_fx_t right
Definition lws-dlo.h:191
uint16_t font_gen
Definition lws-dlo.h:319
LWS_VISIBLE LWS_EXTERN_FOR_DATA const struct lws_plat_file_ops lws_dlo_fops
Definition lws-dlo.h:1079
lws_fx_t b[4]
Definition lws-dlo.h:185
lws_box_t db
Definition lws-dlo.h:192
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_gif(struct lws_display_render_state *rs)
lws_display_list_coord_t cwidth
Definition lws-dlo.h:307
const lws_display_font_t * font
Definition lws-dlo.h:289
lws_fx_t padding[4]
Definition lws-dlo.h:134
LWS_VISIBLE LWS_EXTERN const lws_dlo_filesystem_t * lws_dlo_file_choose(struct lws_context *cx, const char *name)
struct lws_dlo_svg lws_dlo_svg_t
char clipped
Definition lws-dlo.h:423
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_adjust_dims(lws_dlo_t *dlo, lws_dlo_dim_t *dim)
lws_display_scalar curr
Definition lws-dlo.h:468
lws_circle_t c[4]
Definition lws-dlo.h:184
lws_dlo_destroy_t _destroy
Definition lws-dlo.h:130
struct lws_display_state * lds
Definition lws-dlo.h:449
LWS_VISIBLE LWS_EXTERN void lws_dlo_ss_detach_lhp(struct lws_context *cx, struct lhp_ctx *lhp)
lws_fx_t xpx
Definition lws-dlo.h:70
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_add(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_dlo_t *dlo)
lws_dlo_t dlo
Definition lws-dlo.h:382
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_png(struct lws_display_render_state *rs)
uint8_t evicted
Definition lws-dlo.h:360
lws_dlo_t dlo
Definition lws-dlo.h:367
uint8_t flag_row
Definition lws-dlo.h:148
lws_dlo_renderer_t renderer
Definition lws-dlo.h:270
LWS_VISIBLE LWS_EXTERN void lws_fonts_destroy(struct lws_context *cx)
uint8_t failed
Definition lws-dlo.h:362
struct lws_dlo_circle lws_dlo_circle_t
lws_dlo_t dlo
Definition lws-dlo.h:332
uint8_t flag_zraise
Definition lws-dlo.h:152
uint8_t budget
Definition lws-dlo.h:141
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_png_destroy(struct lws_dlo *dlo)
uint8_t yields
Definition lws-dlo.h:344
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_svg(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN lws_dlo_jpeg_t * lws_display_dlo_jpeg_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_dlo_image_glyph_t image_glyph
Definition lws-dlo.h:271
lws_font_choice_t choice
Definition lws-dlo.h:265
uint8_t * frame_have
Definition lws-dlo.h:391
uint8_t flag_cell
Definition lws-dlo.h:149
int16_t font_y_baseline
Definition lws-dlo.h:312
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_jpeg_metadata_scan(lws_dlo_jpeg_t *dj)
char name[25]
Definition lws-dlo.h:352
lws_reclaimable_t rc
Definition lws-dlo.h:341
lws_flow_t flow
Definition lws-dlo.h:333
uint8_t flag_inline_bg
Definition lws-dlo.h:156
lws_display_colour_t dcb
Definition lws-dlo.h:186
LWS_VISIBLE LWS_EXTERN lws_dlo_hit_t * lws_display_dl_hit_test(lws_displaylist_t *dl, int x, int y, lws_box_t *abox)
uint32_t row_len
Definition lws-dlo.h:358
struct lws_circle lws_circle_t
lws_dll2_owner_t children
Definition lws-dlo.h:115
lws_stateful_ret_t(* lws_dlo_renderer_t)(struct lws_display_render_state *rs)
Definition lws-dlo.h:79
lws_fx_t margin[4]
Definition lws-dlo.h:133
char * text
Definition lws-dlo.h:303
char name[25]
Definition lws-dlo.h:369
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_jpeg(struct lws_display_render_state *rs)
struct lws_ss_handle * hss_html
Definition lws-dlo.h:466
lws_dll2_t list
Definition lws-dlo.h:108
lws_fx_t orx
Definition lws-dlo.h:176
lws_gif_t * gif
Definition lws-dlo.h:385
LWS_VISIBLE LWS_EXTERN int lws_fonts_register_dir(struct lws_context *cx, const char *dirpath)
void * priv_driver
Definition lws-dlo.h:92
lws_dll2_owner_t owner
Definition lws-dlo.h:326
char name[25]
Definition lws-dlo.h:334
lws_dlo_png_t * dlo_png
lws_dll2_t row_list
Definition lws-dlo.h:111
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_hit_destroy(struct lws_dlo *dlo)
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_svg_destroy(struct lws_dlo *dlo)
struct lws_dl_rend lws_dl_rend_t
lws_fx_t ys
Definition lws-dlo.h:179
lws_font_waiter_t font_wait
Definition lws-dlo.h:489
lws_svg_t * svg
Definition lws-dlo.h:370
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_rect(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN int lws_font_register_file(struct lws_context *cx, const char *path)
const char * family_name
Definition lws-dlo.h:243
LWS_VISIBLE LWS_EXTERN void lws_display_list_destroy(struct lws_context *cx, lws_displaylist_t *dl)
struct lws_font_glyph lws_font_glyph_t
uint8_t failed
Definition lws-dlo.h:345
void * pin
Definition lws-dlo.h:76
lws_fx_t ory
Definition lws-dlo.h:177
LWS_VISIBLE LWS_EXTERN lws_display_id_t * lws_display_render_add_id(lws_display_render_state_t *rs, const char *id, void *priv)
lws_box_t box
Definition lws-dlo.h:138
struct lws_dlo lws_dlo_t
struct lws_dlo_rasterize lws_dlo_rasterize_t
lws_dll2_owner_t table_cols
Definition lws-dlo.h:119
lws_dll2_t list
Definition lws-dlo.h:86
uint8_t fill
Definition lws-dlo.h:238
uint8_t * priv
Definition lws-dlo.h:268
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lhp_displaylist_layout(struct lhp_ctx *ctx, char reason)
lws_fx_t h
Definition lws-dlo.h:57
struct lws_dlo * abut_y
Definition lws-dlo.h:128
LWS_VISIBLE LWS_EXTERN void lws_display_render_free_ids(lws_display_render_state_t *rs)
struct lws_dlo_text lws_dlo_text_t
struct lws_displaylist lws_displaylist_t
struct lws_display_render_stack lws_display_render_stack_t
uint8_t * line
Definition lws-dlo.h:298
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_destroy(struct lws_context *cx)
struct lws_display_render_state lws_display_render_state_t
lws_fx_t xorg
Definition lws-dlo.h:69
struct lws_gif lws_gif_t
Definition lws-gif.h:44
struct lws_jpeg lws_jpeg_t
Definition lws-jpeg.h:36
struct lws_svg lws_svg_t
Definition lws-svg.h:39
void(* sul_cb_t)(struct lws_sorted_usec_list *sul)
struct lws_sorted_usec_list lws_sorted_usec_list_t
struct lws_upng_t lws_upng_t
Definition lws-upng.h:51
union lhp_ctx::@313012322054160254166174133215050156320073307327 u
lws_dlo_image_type_t type
Definition lws-dlo.h:410