FACADE. The public surface for a Clojure caller.
Thin on purpose: every function here either wires a stratum to its collaborator or forwards to one. No behaviour is defined in this namespace, because a facade that reimplements a stratum is a second copy of it, and the copy is the one that drifts.
Two ways in, and they are for different callers:
a hive host mounts hive-gimp.addon/addon-ctor and never sees this ns.
a program calls (connect) once and passes the result around.
Usage:
(require '[hive-gimp.core :as gimp]) (def g (gimp/connect)) (gimp/doctor g) (gimp/invoke g "new_canvas" {:width 800 :height 600}) (gimp/exec g ["Gimp.displays_flush()"])
FACADE. The public surface for a Clojure caller.
Thin on purpose: every function here either wires a stratum to its
collaborator or forwards to one. No behaviour is defined in this namespace,
because a facade that reimplements a stratum is a second copy of it, and the
copy is the one that drifts.
Two ways in, and they are for different callers:
a hive host mounts `hive-gimp.addon/addon-ctor` and never sees this ns.
a program calls `(connect)` once and passes the result around.
Usage:
(require '[hive-gimp.core :as gimp])
(def g (gimp/connect))
(gimp/doctor g)
(gimp/invoke g "new_canvas" {:width 800 :height 600})
(gimp/exec g ["Gimp.displays_flush()"])(connect)(connect overrides)A session: a transport plus the host-side Python port.
Opens no socket. The socket transport connects per command (the plugin hangs up after each one), so there is nothing to establish here and nothing to close. That is why this returns a plain map rather than something a caller must remember to release.
overrides may carry :host, :port, :timeout-ms, :connect-timeout-ms,
:python-executable and :transport; anything absent resolves from the
environment.
:transport selects the adapter, and both reach the same GIMP by the same
protocol:
:socket a JVM socket. No Python anywhere. The default. :python the same protocol driven from the embedded interpreter through libpython-clj, so GIMP commands and host-side pixel work share one Python context and an intermediate file never leaves it.
A session: a transport plus the host-side Python port.
Opens no socket. The socket transport connects per command (the plugin hangs
up after each one), so there is nothing to establish here and nothing to
close. That is why this returns a plain map rather than something a caller
must remember to release.
`overrides` may carry :host, :port, :timeout-ms, :connect-timeout-ms,
:python-executable and :transport; anything absent resolves from the
environment.
`:transport` selects the adapter, and both reach the same GIMP by the same
protocol:
:socket a JVM socket. No Python anywhere. The default.
:python the same protocol driven from the embedded interpreter through
libpython-clj, so GIMP commands and host-side pixel work share
one Python context and an intermediate file never leaves it.(describe command)One command's parameters, types, defaults and documentation, or nil.
One command's parameters, types, defaults and documentation, or nil.
(doctor session)Staged preflight: contract, plugin, GIMP version, optional Python.
Staged preflight: contract, plugin, GIMP version, optional Python.
(exec session code)(exec session code opts)Run Python inside GIMP's interpreter. Returns an Outcome.
Run Python inside GIMP's interpreter. Returns an `Outcome`.
(flush! session)Push pending drawing operations to the display.
Forwarded rather than inlined because the omission is the single most common way a correct GIMP script looks broken.
Push pending drawing operations to the display. Forwarded rather than inlined because the omission is the single most common way a correct GIMP script looks broken.
(invoke session command)(invoke session command args)Run a GIMP command. Returns an Outcome.
Run a GIMP command. Returns an `Outcome`.
(invoke! session command)(invoke! session command args)Run a GIMP command, returning the value and throwing on failure.
For REPL and script use. A tool handler wants invoke, because an MCP
client needs the error as data.
Run a GIMP command, returning the value and throwing on failure. For REPL and script use. A tool handler wants `invoke`, because an MCP client needs the error as data.
(python-status session)Why the optional host-side Python port is or is not usable.
Why the optional host-side Python port is or is not usable.
(search q)Commands whose name or documentation contains q.
Commands whose name or documentation contains `q`.
(with-transport transport)(with-transport transport host-python)A session driving transport.
The seam a caller needs to point hive-gimp at something that is not a socket: a recorded script, a tunnel, an in-process fake. Nothing downstream can tell the difference, which is the point of the port.
A session driving `transport`. The seam a caller needs to point hive-gimp at something that is not a socket: a recorded script, a tunnel, an in-process fake. Nothing downstream can tell the difference, which is the point of the port.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |