@geastack/core 0.1.50 → 0.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/include/canvas.h CHANGED
@@ -221,8 +221,9 @@ public:
221
221
  void drawTextFontFamilyRotated90(const char *text, int lx, int ly, pixel::native_t color, int family_id, int size_px);
222
222
  void drawTextFontFamilyOnBackground(const char *text, int x, int y, pixel::native_t color,
223
223
  int family_id, int size_px, pixel::native_t background);
224
- int measureTextFontFamily(const char *text, int family_id, int size_px);
225
- int measureTextInkCenterFontFamily(const char *text, int family_id, int size_px);
224
+ // Font metrics only: no pixels or canvas state, so callers need no surface.
225
+ static int measureTextFontFamily(const char *text, int family_id, int size_px);
226
+ static int measureTextInkCenterFontFamily(const char *text, int family_id, int size_px);
226
227
  static void measureTextFont(const char *text, int max_width, int font_id, int *out_w, int *out_h);
227
228
  void fillRoundedRect(int x, int y, int w, int h, int tl, int tr, int br, int bl, pixel::native_t color);
228
229
  void strokeRoundedRect(int x, int y, int w, int h, int tl, int tr, int br, int bl, int lw, pixel::native_t color);
@@ -25,6 +25,13 @@ namespace gea::framework::display
25
25
  // Registers the painter for the screen area it covers; replaces any
26
26
  // previous one. The caller marks the area dirty to have it repainted.
27
27
  static void set(Paint paint, void *user, int x0, int y0, int x1, int y1);
28
+ // Declares that the painter writes every pixel of its area (a 3D frame
29
+ // with a background colour). `set` resets it to false.
30
+ static void setOpaque(bool opaque);
31
+ // True when an opaque underlay paints all of [x0, x1] x [y0, y1]: a
32
+ // refresh that paints it there repaints that rect completely, so the
33
+ // display need not restore the rect's old pixels first.
34
+ static bool covers(int x0, int y0, int x1, int y1);
28
35
  static void clear();
29
36
  static bool active();
30
37
  // Paints the part of [x0, x1] x [y0, y1] the underlay covers.
package/include/image.h CHANGED
@@ -82,6 +82,11 @@ struct ImageSlot {
82
82
  // Preserve whether the source has no alpha channel so materialization can
83
83
  // discard the synthetic all-255 alpha plane and use the opaque blit path.
84
84
  bool deferredOpaque = false;
85
+ // Where a deferred decode came from, kept after it materializes so
86
+ // releaseIdleDecodes() can drop the pixels and decode again on next use.
87
+ const std::uint8_t *sourceData = nullptr;
88
+ int sourceLength = 0;
89
+ bool sourceOpaque = false;
85
90
  };
86
91
 
87
92
  class ImageStore {
@@ -100,6 +105,13 @@ public:
100
105
  // during idle frames so a later first-draw (e.g. switching weather cities)
101
106
  // doesn't bunch every decode into a single visible hitch.
102
107
  bool materializeOneDeferred();
108
+ // Drop the decoded pixels of large deferred stills that nothing references
109
+ // (no node, no recorded display command); the encoded bytes stay in flash,
110
+ // so the next draw decodes them again. A full-screen backdrop shown once at
111
+ // boot otherwise holds its framebuffer-sized decode for the life of the app.
112
+ // Call once per frame, never between a release and the re-retain that
113
+ // follows it (a style recompute), so a still in use is not thrown away.
114
+ void releaseIdleDecodes();
103
115
  // Register an externally-owned native-format pixel buffer. `takeOwnership`
104
116
  // transfers ownership to the store (freed on dispose) — used by the iOS
105
117
  // camera capture, which hands over a freshly-allocated RGBA8888 still.
package/include/memory.h CHANGED
@@ -3,6 +3,19 @@
3
3
  #include <cstddef>
4
4
  #include <cstdint>
5
5
 
6
+ // Places a large, cold static buffer in external RAM where the target allows a
7
+ // PSRAM .bss (ESP32 with CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY); plain
8
+ // .bss elsewhere. Internal SRAM is the scarce resource on PSRAM boards: on the
9
+ // CrowPanel 7.0 the RGB bounce buffers leave too little of it for the display's
10
+ // SRAM staging strips, and every repaint then rasters straight into PSRAM.
11
+ // Use it for caches touched per record or per layout, not per pixel.
12
+ #if defined(ESP_PLATFORM)
13
+ #include "esp_attr.h"
14
+ #define GEA_EXT_BSS EXT_RAM_BSS_ATTR
15
+ #else
16
+ #define GEA_EXT_BSS
17
+ #endif
18
+
6
19
  namespace gea::framework::memory {
7
20
 
8
21
  class Allocator {
package/index.d.ts CHANGED
@@ -113,6 +113,8 @@ export interface GeaIntrinsicElements {
113
113
  ellipse: SvgEllipseProps
114
114
  rect: SvgRectProps
115
115
  defs: SvgGroupProps
116
+ linearGradient: SvgLinearGradientProps
117
+ stop: SvgStopProps
116
118
  title: SvgGroupProps
117
119
  desc: SvgGroupProps
118
120
  }
@@ -709,6 +711,14 @@ export interface NativeViewProps extends DataAttributes, NativeEventAttributes {
709
711
  pressId?: number
710
712
  pressValue?: number
711
713
  momentum?: boolean | string
714
+ /**
715
+ * A scroller whose pages are its own width (or height): a released drag
716
+ * settles on the nearest page, or the next one in a fling's direction, and a
717
+ * programmatic `scrollLeft`/`scrollTop` animates there -- LVGL's tabview
718
+ * content. A `scroll` event fires when it settles.
719
+ */
720
+ 'snap-page'?: boolean
721
+ onScroll?: (event: Event) => void
712
722
  children?: any
713
723
  }
714
724
 
@@ -766,6 +776,17 @@ export interface SvgEllipseProps extends SvgPresentationProps { cx?: SvgNumber;
766
776
  export interface SvgRectProps extends SvgPresentationProps {
767
777
  x?: SvgNumber; y?: SvgNumber; width?: SvgNumber; height?: SvgNumber; rx?: SvgNumber; ry?: SvgNumber
768
778
  }
779
+ // A paint server for fill/stroke="url(#id)": x1..y2 are fractions of the
780
+ // painted shape's box (objectBoundingBox, the default) or user-space units.
781
+ export interface SvgLinearGradientProps extends SvgPresentationProps {
782
+ x1?: SvgNumber; y1?: SvgNumber; x2?: SvgNumber; y2?: SvgNumber
783
+ gradientUnits?: 'objectBoundingBox' | 'userSpaceOnUse'
784
+ }
785
+ export interface SvgStopProps extends SvgPresentationProps {
786
+ offset?: SvgNumber
787
+ 'stop-color'?: string
788
+ 'stop-opacity'?: SvgNumber
789
+ }
769
790
 
770
791
  export interface GeaNode extends Node {}
771
792
  export interface GeaElement extends Element {}
@@ -1272,6 +1293,23 @@ export interface CanvasRenderingContext2D {
1272
1293
  * Allocate once, write every frame, then draw with `putImageData`.
1273
1294
  */
1274
1295
  createImageData565(width: number, height: number): ImageData565
1296
+ /**
1297
+ * How many display buffers a frame can be rendered into in place; 0 where it
1298
+ * cannot (no swap buffers, a panel that is not plain RGB565, the browser).
1299
+ */
1300
+ panelBufferCount(): number
1301
+ /**
1302
+ * An `ImageData565` whose `data16` is display buffer `index` itself: write a
1303
+ * whole frame there and `putImageData` it at (0, 0) without a copy. Make one
1304
+ * per buffer, once; each frame draw into the one `acquirePanelBuffer` names.
1305
+ */
1306
+ createPanelImageData565(index: number): ImageData565
1307
+ /**
1308
+ * Waits until the display has released the buffer the next frame draws into
1309
+ * and returns its index, or -1 when frames cannot be drawn in place. The
1310
+ * frame must repaint every pixel: the buffer holds an older frame.
1311
+ */
1312
+ acquirePanelBuffer(): number
1275
1313
  /** Draw an `ImageData565` with its top-left corner at (dx, dy): one blit. */
1276
1314
  putImageData(image: ImageData565, dx: number, dy: number): void
1277
1315
  /** Draw only the dirty rectangle of an `ImageData565`, at (dx + dirtyX, dy + dirtyY). */
@@ -1463,6 +1501,12 @@ export interface MemoryController {
1463
1501
  allocationPsramPeakBytes(): number
1464
1502
  stats(): EmbeddedMemoryStats
1465
1503
  config(): EmbeddedMemoryConfig
1504
+ // Typed arrays and other allocations made between these two calls prefer
1505
+ // fast on-chip RAM (ESP32-S3 SRAM instead of PSRAM), for tables read at
1506
+ // random per pixel. `bytes` is how much room to make: the display may give
1507
+ // up some internal staging for it. No-ops where there is one kind of RAM.
1508
+ beginInternal(bytes: number): void
1509
+ endInternal(): void
1466
1510
  }
1467
1511
 
1468
1512
  export declare const Memory: MemoryController
@@ -1740,6 +1784,30 @@ export interface NotifyController {
1740
1784
 
1741
1785
  export declare const Notify: NotifyController
1742
1786
 
1787
+ export interface SimdController {
1788
+ // Sums byte windows into a clamped byte grid, vectorized where the chip has
1789
+ // SIMD (ESP32-S3 PIE) and an exact scalar loop elsewhere:
1790
+ // dst[dstStart + r*dstStride + x] =
1791
+ // min(255, ((sum over k of src[offsets[k] + r*srcStride + x]) * multiplier) >> shift)
1792
+ // for r < rows, x < width, k < windows (at most 8). A call that would read
1793
+ // or write outside its arrays does nothing.
1794
+ sumWindowsU8(
1795
+ dst: Uint8Array,
1796
+ dstStart: number,
1797
+ dstStride: number,
1798
+ src: Uint8Array,
1799
+ offsets: Int32Array,
1800
+ windows: number,
1801
+ srcStride: number,
1802
+ width: number,
1803
+ rows: number,
1804
+ multiplier: number,
1805
+ shift: number,
1806
+ ): void
1807
+ }
1808
+
1809
+ export declare const Simd: SimdController
1810
+
1743
1811
  export interface DeviceControlController {
1744
1812
  // Run a host shell command, return combined stdout+stderr. macOS companion
1745
1813
  // only — drives the device-control + install/uninstall scripts over USB.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/core",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "GeaStack app API, reactivity headers, runtime sources, and type declarations.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/runtime/host.ts CHANGED
@@ -337,6 +337,8 @@ declare const __gea_Memory: {
337
337
  allocationPsramBytes(): number
338
338
  allocationSramPeakBytes(): number
339
339
  allocationPsramPeakBytes(): number
340
+ beginInternal(bytes: number): void
341
+ endInternal(): void
340
342
  }
341
343
  declare const __gea_Input: {
342
344
  // Reads-and-clears the one-shot back-button-pressed flag. Set by the
@@ -416,6 +418,21 @@ declare const __gea_Battery: {
416
418
  // Battery charge percentage (0-100) from the platform PMU.
417
419
  level(): number
418
420
  }
421
+ declare const __gea_Simd: {
422
+ sumWindowsU8(
423
+ dst: Uint8Array,
424
+ dstStart: number,
425
+ dstStride: number,
426
+ src: Uint8Array,
427
+ offsets: Int32Array,
428
+ windows: number,
429
+ srcStride: number,
430
+ width: number,
431
+ rows: number,
432
+ multiplier: number,
433
+ shift: number,
434
+ ): void
435
+ }
419
436
  declare const __gea_Notify: {
420
437
  // Transient host->app notification channel. text() is the latest message;
421
438
  // seq() increments on each post so an app can detect a new one.
@@ -1009,6 +1026,12 @@ export const Memory = {
1009
1026
  allocationPsramPeakBytes(): number {
1010
1027
  return __gea_Memory.allocationPsramPeakBytes()
1011
1028
  },
1029
+ beginInternal(bytes: number): void {
1030
+ __gea_Memory.beginInternal(bytes)
1031
+ },
1032
+ endInternal(): void {
1033
+ __gea_Memory.endInternal()
1034
+ },
1012
1035
  stats(): EmbeddedMemoryStats {
1013
1036
  return {
1014
1037
  internalFree: __gea_Memory.internalFree(),
@@ -1187,6 +1210,23 @@ export const Battery = {
1187
1210
  return __gea_Battery.level()
1188
1211
  },
1189
1212
  }
1213
+ export const Simd = {
1214
+ sumWindowsU8(
1215
+ dst: Uint8Array,
1216
+ dstStart: number,
1217
+ dstStride: number,
1218
+ src: Uint8Array,
1219
+ offsets: Int32Array,
1220
+ windows: number,
1221
+ srcStride: number,
1222
+ width: number,
1223
+ rows: number,
1224
+ multiplier: number,
1225
+ shift: number,
1226
+ ): void {
1227
+ __gea_Simd.sumWindowsU8(dst, dstStart, dstStride, src, offsets, windows, srcStride, width, rows, multiplier, shift)
1228
+ },
1229
+ }
1190
1230
  export const Notify = {
1191
1231
  text(): string {
1192
1232
  return __gea_Notify.text()