|
1 | 1 | [](https://github.com/onecoolx/agave/actions/workflows/windows.yml) |
2 | 2 | [](https://github.com/onecoolx/agave/actions/workflows/linux.yml) |
3 | 3 | [](https://deepwiki.com/onecoolx/agave) |
4 | | -# agave |
5 | | -A fast, lightweight and full featured web browser |
| 4 | + |
| 5 | +# Agave Web Engine |
| 6 | + |
| 7 | +A fast, lightweight and self-contained web rendering engine for embedded systems and resource-constrained platforms. Agave provides a complete browser engine stack — HTML/CSS parsing, JavaScript execution (QuickJS / ES2020), and pure-software rasterization (Picasso 2D) — exposed through a clean C API. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **HTML5 / CSS3** — Flexbox, Grid, transitions, animations, `@keyframes`, filters, gradients, `clip-path`, `mask-image`, `mix-blend-mode`, CSS custom properties (`var()`), `calc()`, media queries |
| 12 | +- **JavaScript** — QuickJS engine (ES2020): `async/await`, `Promise`, `class`, optional chaining, nullish coalescing |
| 13 | +- **Web APIs** — `fetch`, `XMLHttpRequest`, `WebSocket`, `localStorage`/`sessionStorage` (SQLite-backed), `MutationObserver`, `querySelector`/`querySelectorAll`, `classList`, `dataset`, `getBoundingClientRect`, `getComputedStyle`, `navigator`, `location`, `console` |
| 14 | +- **Pure software rendering** — No GPU required; works on any SoC with a framebuffer |
| 15 | +- **Tile-buffer scrolling** — Decouples page layout size from display resolution for smooth scrolling |
| 16 | +- **Configurable pixel formats** — BGRA32, RGBA32, BGR24, RGB24, RGB16(565) |
| 17 | +- **Multi-platform** — Linux, Windows; integrates with LVGL, Qt5, SDL, or any custom framebuffer |
| 18 | + |
| 19 | +## Example Applications |
| 20 | + |
| 21 | +| Example | Description | |
| 22 | +|---------|-------------| |
| 23 | +| `watchweb` | Round-screen watch browser (480×480, LVGL) | |
| 24 | +| `touchweb` | Mobile touch browser (Qt5) | |
| 25 | +| `agave_test` | Headless test harness | |
| 26 | + |
| 27 | +## Requirements |
| 28 | + |
| 29 | +- CMake ≥ 3.16 |
| 30 | +- C++11 compiler (GCC / Clang / MSVC) |
| 31 | +- libcurl (network) |
| 32 | +- FreeType2 (fonts) |
| 33 | +- SQLite3 (Web Storage) |
| 34 | +- Qt5 (touchweb only) |
| 35 | +- LVGL (watchweb only) |
| 36 | + |
| 37 | +## Build |
| 38 | + |
| 39 | +### Linux (with ASan for development) |
| 40 | + |
| 41 | +```bash |
| 42 | +mkdir proj && cd proj |
| 43 | +cmake .. -DCMAKE_BUILD_TYPE=Debug |
| 44 | +make -j$(nproc) |
| 45 | +``` |
| 46 | + |
| 47 | +### Linux (release / no ASan) |
| 48 | + |
| 49 | +```bash |
| 50 | +mkdir proj_no_asan && cd proj_no_asan |
| 51 | +cmake .. -DCMAKE_BUILD_TYPE=Release -DOPT_USE_ASAN=OFF |
| 52 | +make -j$(nproc) |
| 53 | +``` |
| 54 | + |
| 55 | +### Build a specific target |
| 56 | + |
| 57 | +```bash |
| 58 | +make watchweb -j$(nproc) # watch-face browser (LVGL) |
| 59 | +make touchweb -j$(nproc) # mobile browser (Qt5) |
| 60 | +make agave_test -j$(nproc) # headless test runner |
| 61 | +make unit_tests -j$(nproc) # unit test suite |
| 62 | +``` |
| 63 | + |
| 64 | +### Windows (MSVC) |
| 65 | + |
| 66 | +```bat |
| 67 | +mkdir build && cd build |
| 68 | +cmake .. -G "Visual Studio 17 2022" |
| 69 | +cmake --build . --config Release |
| 70 | +``` |
| 71 | + |
| 72 | +## Run |
| 73 | + |
| 74 | +```bash |
| 75 | +# watchweb — round-screen browser (SDL headless for CI) |
| 76 | +env SDL_VIDEODRIVER=dummy ./watchweb https://example.com |
| 77 | + |
| 78 | +# touchweb — Qt5 browser |
| 79 | +./touchweb https://example.com |
| 80 | + |
| 81 | +# unit tests |
| 82 | +./unit_tests |
| 83 | +``` |
| 84 | + |
| 85 | +## API Overview |
| 86 | + |
| 87 | +The public API is in `include/macross.h`. Key entry points: |
| 88 | + |
| 89 | +```c |
| 90 | +#include "macross.h" |
| 91 | + |
| 92 | +// 1. Initialize engine (once per process) |
| 93 | +macross_initialize(PIXEL_FORMAT_BGRA32, width, height); |
| 94 | + |
| 95 | +// 2. Register callbacks |
| 96 | +MC_CALLBACK_INFO cb = {}; |
| 97 | +cb.cb_invalidate_rect = on_dirty; // schedule repaint |
| 98 | +cb.cb_loading_progress = on_progress; |
| 99 | +cb.cb_set_ime_enable = on_ime; // show/hide soft keyboard |
| 100 | +macross_set_callback(&cb); |
| 101 | + |
| 102 | +// 3. Create a view backed by a pixel buffer |
| 103 | +uint8_t* buf = malloc(width * height * 4); |
| 104 | +MaCrossView* view = macross_view_create(buf, width, height, width*4, userdata); |
| 105 | + |
| 106 | +// 4. Load content |
| 107 | +macross_view_open_url(view, "https://example.com"); |
| 108 | + |
| 109 | +// 5. Main loop |
| 110 | +while (running) { |
| 111 | + macross_event_dispatch(); // process timers / network / layout |
| 112 | + if (dirty) { |
| 113 | + macross_view_update(view, NULL); // render into buf |
| 114 | + blit_to_screen(buf); |
| 115 | + } |
| 116 | +} |
| 117 | + |
| 118 | +// 6. Cleanup |
| 119 | +macross_view_destroy(view); |
| 120 | +macross_shutdown(); |
| 121 | +``` |
| 122 | +
|
| 123 | +Full API documentation: [`docs/sdk/api-datasheet-en.md`](docs/sdk/api-datasheet-en.md) |
| 124 | +Programming guide: [`docs/sdk/programming-guide-en.md`](docs/sdk/programming-guide-en.md) |
| 125 | +Technical whitepaper: [`docs/sdk/whitepaper-en.md`](docs/sdk/whitepaper-en.md) |
| 126 | +
|
| 127 | +## CMake Options |
| 128 | +
|
| 129 | +| Option | Default | Description | |
| 130 | +|--------|---------|-------------| |
| 131 | +| `OPT_USE_ASAN` | ON | Enable AddressSanitizer | |
| 132 | +| `OPT_USE_QJS` | ON | Use QuickJS (ES2020) | |
| 133 | +| `OPT_USE_KJS` | OFF | Use legacy KJS engine | |
| 134 | +| `OPT_MODERN_FLEXBOX` | ON | Modern CSS Flexbox layout | |
| 135 | +| `OPT_UNITTEST` | ON | Build unit tests | |
| 136 | +| `OPT_FREE_TYPE2` | ON | FreeType2 font rendering | |
| 137 | +| `OPT_FONT_CONFIG` | OFF | Use fontconfig (OFF = built-in font config) | |
| 138 | +
|
| 139 | +## License |
| 140 | +
|
| 141 | +Copyright © 2009–2026 Zhang Ji Peng. All rights reserved. |
| 142 | +
|
| 143 | +Third-party components: QuickJS (MIT), Picasso (LGPL), libcurl (curl), FreeType2 (FTL/GPLv2), SQLite3 (public domain). |
0 commit comments