Function: indent-bars--row-data

indent-bars--row-data is a natively compiled function defined in indent-bars.el.

Signature

(indent-bars--row-data W PAD ROT WIDTH-FRAC)

Documentation

Calculate stipple row data to fit in character of width W.

The width of the pattern of filled pixels is determined by WIDTH-FRAC. The pattern itself is shifted up by PAD bits (which shifts the pattern to the right, for positive values of PAD). Subsequently, the value is shifted up (with W-bit wrap-around) by ROT bits, and returned. ROT is the starting bit offset of a character within the closest stipple repeat to the left; i.e. if pixel 1 of the stipple aligns with pixel 1 of the chacter, ROT=0. ROT should be less than W.

Source Code

;; Defined in /nix/store/zkcdcnmcj3605fj09x584bf58d85brax-emacs-packages-deps/share/emacs/site-lisp/elpa/indent-bars-1.0.1/indent-bars.el
(defun indent-bars--row-data (w pad rot width-frac)
  "Calculate stipple row data to fit in character of width W.
The width of the pattern of filled pixels is determined by
WIDTH-FRAC.  The pattern itself is shifted up by PAD bits (which
shifts the pattern to the right, for positive values of PAD).
Subsequently, the value is shifted up (with W-bit wrap-around) by
ROT bits, and returned.  ROT is the starting bit offset of a
character within the closest stipple repeat to the left; i.e. if
pixel 1 of the stipple aligns with pixel 1 of the chacter, ROT=0.
ROT should be less than W."
  (let* ((bar-width (max 1 (round (* w width-frac))))
	 (num (indent-bars--rot
	       (ash (indent-bars--block bar-width) pad) w rot)))
    (apply #'unibyte-string
	   (cl-loop for boff = 0 then (+ boff 8) while (< boff w)
		    for nbits = (min 8 (- w boff))
		    collect (ash (logand num
					 (ash (indent-bars--block nbits) boff))
				 (- boff))))))