kei-lisp-plugin-graphics 2.0.0 → 3.0.0

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/README.md CHANGED
@@ -19,9 +19,14 @@ interpreter. Register it on a `LispInterpreter` and call drawing primitives
19
19
  > are welcome, but external pull requests are generally **not accepted** —
20
20
  > see [CONTRIBUTING.md](./CONTRIBUTING.md).
21
21
 
22
+ ![Shapes and text drawn from Lisp source with kei-lisp-plugin-graphics](./docs/assets/basic-drawing.png)
23
+
24
+ _The canvas above is painted entirely from Lisp source — try it in the
25
+ [**live demo**](https://ike-keichan.github.io/kei-lisp-plugin-graphics/)._
26
+
22
27
  ## Features
23
28
 
24
- - 45 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
29
+ - 75 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
25
30
  - Works with `HTMLCanvasElement` and `OffscreenCanvas`
26
31
  - ESM and CommonJS dual output with TypeScript types
27
32
  - Zero runtime dependencies
@@ -77,25 +82,38 @@ canvas's 2D rendering context.
77
82
 
78
83
  ## Provided Lisp functions
79
84
 
80
- | Category | Symbols |
81
- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
82
- | Lifecycle | `gopen`, `gclose`, `gclear`, `gsleep` |
83
- | Path | `gstart-path`, `gfinish-path`, `gmove-to`, `gline-to`, `gquadcurve-to`, `gbezcurve-to`, `garc`, `garc-to`, `grect` |
84
- | Fill / stroke | `gfill`, `gstroke`, `gfill-rect`, `gstroke-rect`, `gfill-tri`, `gstroke-tri`, `gfill-text`, `gstroke-text` |
85
- | Style | `gcolor`, `gfill-color`, `gstroke-color`, `gline-width`, `gline-cap`, `gline-join`, `galpha`, `gpattern` |
86
- | Shadow | `gshadow-color`, `gshadow-blur`, `gshadow-offsetx`, `gshadow-offsety` |
87
- | Text | `gtext-font`, `gtext-align`, `gtext-line`, `gtext-dire` |
88
- | Transform | `gtranslate`, `gscale`, `grotate` |
89
- | State | `gsave`, `grestore` |
90
- | Image / export | `gimage`, `gsave-png`, `gsave-jpeg` |
85
+ | Category | Symbols |
86
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87
+ | Lifecycle | `gopen`, `gclose`, `gclear`, `greset`, `gwidth`, `gheight`, `gsleep` |
88
+ | Path | `gstart-path`, `gfinish-path`, `gmove-to`, `gline-to`, `gquadcurve-to`, `gbezcurve-to`, `garc`, `garc-to`, `grect`, `ground-rect`, `gellipse`, `gclip`, `gis-point-in-path`, `gis-point-in-stroke` |
89
+ | Fill / stroke | `gfill`, `gstroke`, `gfill-rect`, `gstroke-rect`, `gfill-tri`, `gstroke-tri`, `gfill-text`, `gstroke-text` |
90
+ | Style | `gcolor`, `gfill-color`, `gstroke-color`, `gline-width`, `gline-cap`, `gline-join`, `gline-dash`, `gline-dash-offset`, `gmiter-limit`, `galpha`, `gpattern`, `gcomposite`, `gfilter`, `gimage-smoothing`, `glinear-gradient`, `gradial-gradient`, `gconic-gradient` |
91
+ | Shadow | `gshadow-color`, `gshadow-blur`, `gshadow-offsetx`, `gshadow-offsety` |
92
+ | Text | `gtext-font`, `gtext-align`, `gtext-baseline`, `gtext-direction`, `gmeasure-text`, `gletter-spacing`, `gword-spacing`, `gfont-kerning`, `gfont-stretch`, `gfont-variant`, `gtext-rendering` |
93
+ | Transform | `gtranslate`, `gscale`, `grotate`, `gtransform`, `gset-transform`, `greset-transform` |
94
+ | State | `gsave`, `grestore` |
95
+ | Image / export | `gimage`, `gsave-png`, `gsave-jpeg`, `gclear-rect`, `gpixel`, `gset-pixel` |
91
96
 
92
97
  Each function returns `t` on success. See [`docs/graphics.md`](./docs/graphics.md)
93
98
  for argument signatures and side effects.
94
99
 
100
+ ## Environment support
101
+
102
+ | Capability | Browser (`HTMLCanvasElement`) | `OffscreenCanvas` (worker) | Node.js (e.g. `@napi-rs/canvas`) |
103
+ | ------------------------------------- | -------------------------------------------------------- | -------------------------- | -------------------------------- |
104
+ | Drawing primitives (`g…`) | ✅ | ✅ | ✅ |
105
+ | `gimage` / `gpattern` (image loading) | ✅ | ⚠️ needs a global `Image` | ❌ returns `nil` |
106
+ | `gsave-png` / `gsave-jpeg` (download) | ✅ | ❌ returns `nil` | ❌ returns `nil` |
107
+ | `gsave-png` / `gsave-jpeg` (`path`) | ❌ returns `nil` | ⚠️ async `convertToBlob` | ✅ |
108
+ | Diagnostics | `console.error` (or host-provided `process.stderr` shim) | same | `process.stderr` |
109
+
95
110
  ## Reference
96
111
 
112
+ - [Live demo](https://ike-keichan.github.io/kei-lisp-plugin-graphics/) — the examples, served from GitHub Pages
113
+ - [API docs (TypeDoc)](https://ike-keichan.github.io/kei-lisp-plugin-graphics/api/) — generated API documentation
97
114
  - [API Reference](./docs/api.md) — TypeScript / JavaScript API
98
115
  - [Graphics Reference](./docs/graphics.md) — every `g…` Lisp function
116
+ - [Non-goals](./docs/non-goals.md) — what this project deliberately does not do
99
117
  - [kei-lisp Plugin Guide](https://github.com/ike-keichan/kei-lisp/blob/main/docs/plugins.md) — how plugins integrate with the interpreter
100
118
 
101
119
  ## Development