Liking cljdoc? Tell your friends :D

hive-gimp.polyfill

PROMOTE. Commands the listening plug-in cannot answer, written as the GIMP 3 Python that answers them, as DATA.

The reference Python plug-in has no handler for place_image (only the native plug-in does) and nothing at all for color_to_alpha. Both are a few calls of GIMP 3's own PyGObject API, which the plug-in's exec fallback runs unchanged. This namespace turns a built command's wire params into those statements; hive-gimp.compose is the boundary that sends them.

Pure, and .cljc, so every program this emits is asserted on the JVM without a GIMP anywhere: the anchor arithmetic, the size rule, which statements a missing parameter leaves out, and how a string reaches Python.

Two facts about the exec channel shape the output, both measured against GIMP 3.2.6:

  1. Each string is exec'd as its own statement, in one long-lived context. So a program is a vector of single statements, and its names carry a _hg_ prefix to stay clear of whatever a caller left in that context.
  2. eval runs in a DIFFERENT context from exec and cannot see what exec bound. The only way a result comes back is stdout, so every program ends by printing one JSON object, which the boundary reads as the value.
PROMOTE. Commands the listening plug-in cannot answer, written as the GIMP 3
Python that answers them, as DATA.

The reference Python plug-in has no handler for `place_image` (only the
native plug-in does) and nothing at all for `color_to_alpha`. Both are a few
calls of GIMP 3's own PyGObject API, which the plug-in's exec fallback runs
unchanged. This namespace turns a built command's wire params into those
statements; `hive-gimp.compose` is the boundary that sends them.

Pure, and .cljc, so every program this emits is asserted on the JVM without a
GIMP anywhere: the anchor arithmetic, the size rule, which statements a
missing parameter leaves out, and how a string reaches Python.

Two facts about the exec channel shape the output, both measured against
GIMP 3.2.6:

1. Each string is exec'd as its own statement, in one long-lived context. So
   a program is a vector of single statements, and its names carry a `_hg_`
   prefix to stay clear of whatever a caller left in that context.
2. `eval` runs in a DIFFERENT context from `exec` and cannot see what exec
   bound. The only way a result comes back is stdout, so every program ends
   by printing one JSON object, which the boundary reads as the value.
raw docstring

anchorsclj/s

Anchor name -> the fraction of the layer's width and height that sits at (x, y). The same nine names place_text documents, so one vocabulary places both text and images.

Anchor name -> the fraction of the layer's width and height that sits at
(x, y). The same nine names `place_text` documents, so one vocabulary places
both text and images.
sourceraw docstring

color-to-alpha-programclj/s

(color-to-alpha-program {:strs [color transparency_threshold opacity_threshold
                                layer_name image_index]})

The statements that make color transparent on a layer, through GEGL.

The layer gains an alpha channel first: color-to-alpha on a layer without one has nowhere to put the transparency and changes nothing.

The statements that make `color` transparent on a layer, through GEGL.

The layer gains an alpha channel first: color-to-alpha on a layer without
one has nowhere to put the transparency and changes nothing.
sourceraw docstring

flipsclj/s

Flip name -> the GIMP orientations applied, in order. both is a half turn by two mirrors, which keeps the layer's own centre where it was.

Flip name -> the GIMP orientations applied, in order. `both` is a half turn
by two mirrors, which keeps the layer's own centre where it was.
sourceraw docstring

place-image-problemclj/s

(place-image-problem {:strs [anchor flip]})

nil, or the reason these place_image wire params cannot be composed.

nil, or the reason these `place_image` wire params cannot be composed.
sourceraw docstring

place-image-programclj/s

(place-image-program {:strs [file_path x y anchor width height opacity name flip
                             image_index]})

The statements that place the file in params as a new top layer.

Order matters and is the point of writing it down: scale, then mirror, then offset, because the offset is computed from the FINAL size and an anchor other than top-left moves with it.

The statements that place the file in `params` as a new top layer.

Order matters and is the point of writing it down: scale, then mirror, then
offset, because the offset is computed from the FINAL size and an anchor
other than top-left moves with it.
sourceraw docstring

py-strclj/s

(py-str s)

s as a Python string literal.

Hand-escaped rather than borrowed from a JSON writer because this namespace is .cljc. str/escape maps each character once, so the backslash an escape adds is never escaped again, on either platform.

`s` as a Python string literal.

Hand-escaped rather than borrowed from a JSON writer because this namespace
is .cljc. `str/escape` maps each character once, so the backslash an escape
adds is never escaped again, on either platform.
sourceraw docstring

size-statementclj/s

(size-statement width height)

The statement binding _hg_w/_hg_h, the layer's final size.

Width or height alone keeps the aspect ratio; both stretch to exactly that box; neither keeps the file's own size. Decided here, in Clojure, so the Python that runs is one assignment and never a branch.

The statement binding `_hg_w`/`_hg_h`, the layer's final size.

Width or height alone keeps the aspect ratio; both stretch to exactly that
box; neither keeps the file's own size. Decided here, in Clojure, so the
Python that runs is one assignment and never a branch.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close