kei-lisp-plugin-graphics 1.1.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
@@ -9,9 +9,24 @@ A Canvas2D drawing plugin for the [kei-lisp](https://github.com/ike-keichan/kei-
9
9
  interpreter. Register it on a `LispInterpreter` and call drawing primitives
10
10
  (`gopen`, `gline-to`, `gfill-rect`, ...) directly from Lisp source.
11
11
 
12
+ > [!WARNING]
13
+ > This is a **toy / hobby project** built for learning and experimentation.
14
+ > **Use in production (or any other serious product) is not recommended.**
15
+ > APIs may change without notice, and maintenance and support are provided
16
+ > on a best-effort basis only.
17
+ >
18
+ > It is also a **personal project**: issue reports (bugs, questions, ideas)
19
+ > are welcome, but external pull requests are generally **not accepted** —
20
+ > see [CONTRIBUTING.md](./CONTRIBUTING.md).
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
+
12
27
  ## Features
13
28
 
14
- - 45 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
29
+ - 75 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
15
30
  - Works with `HTMLCanvasElement` and `OffscreenCanvas`
16
31
  - ESM and CommonJS dual output with TypeScript types
17
32
  - Zero runtime dependencies
@@ -67,25 +82,38 @@ canvas's 2D rendering context.
67
82
 
68
83
  ## Provided Lisp functions
69
84
 
70
- | Category | Symbols |
71
- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
72
- | Lifecycle | `gopen`, `gclose`, `gclear`, `gsleep` |
73
- | Path | `gstart-path`, `gfinish-path`, `gmove-to`, `gline-to`, `gquadcurve-to`, `gbezcurve-to`, `garc`, `garc-to`, `grect` |
74
- | Fill / stroke | `gfill`, `gstroke`, `gfill-rect`, `gstroke-rect`, `gfill-tri`, `gstroke-tri`, `gfill-text`, `gstroke-text` |
75
- | Style | `gcolor`, `gfill-color`, `gstroke-color`, `gline-width`, `gline-cap`, `gline-join`, `galpha`, `gpattern` |
76
- | Shadow | `gshadow-color`, `gshadow-blur`, `gshadow-offsetx`, `gshadow-offsety` |
77
- | Text | `gtext-font`, `gtext-align`, `gtext-line`, `gtext-dire` |
78
- | Transform | `gtranslate`, `gscale`, `grotate` |
79
- | State | `gsave`, `grestore` |
80
- | 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` |
81
96
 
82
97
  Each function returns `t` on success. See [`docs/graphics.md`](./docs/graphics.md)
83
98
  for argument signatures and side effects.
84
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
+
85
110
  ## Reference
86
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
87
114
  - [API Reference](./docs/api.md) — TypeScript / JavaScript API
88
115
  - [Graphics Reference](./docs/graphics.md) — every `g…` Lisp function
116
+ - [Non-goals](./docs/non-goals.md) — what this project deliberately does not do
89
117
  - [kei-lisp Plugin Guide](https://github.com/ike-keichan/kei-lisp/blob/main/docs/plugins.md) — how plugins integrate with the interpreter
90
118
 
91
119
  ## Development