std.image.base.util
<<
added in 3.0
(<< val elems)returns the low-level representation of data
(-> (<< [10 20 30 10 20 30] 5 5 5) vec) => 10910 10910
<<fn
added in 3.0
(<<fn elems)<<form
added in 3.0
(<<form elems)returns the form for evaluating a set of elements
(<<form 5 5 5) => ’(clojure.core/fn i2 i1 i0 (clojure.core/bit-or (clojure.core/bit-shift-left (clojure.core/bit-and i2 31) 10) (clojure.core/bit-shift-left (clojure.core/bit-and i1 31) 5) (clojure.core/bit-shift-left (clojure.core/bit-and i0 31) 0)))
>>
added in 3.0
(>> val elems)returns human readable version of the raw bytes
(-> (short-array 10910 10910) (>> 5 5 5)) => [10 20 30 10 20 30]
>>fn
added in 3.0
(>>fn elems)>>form
added in 3.0
(>>form elems)returns the form for turning an integer into representations
(>>form 5 5 5) => ’(clojure.core/fn v (clojure.core/bit-and (clojure.core/bit-shift-right v 10) 31) (clojure.core/bit-and (clojure.core/bit-shift-right v 5) 31) (clojure.core/bit-and (clojure.core/bit-shift-right v 0) 31))
array-fn
added in 3.0
(array-fn elems)byte-argb->byte-gray
added in 3.0
(byte-argb->byte-gray bytes)(byte-argb->byte-gray bytes length)(byte-argb->byte-gray from-bytes to-bytes length)converts a byte-argb array to byte-gray
(-> (byte-array 255 10 10 10 255 20 20 20) (byte-argb->byte-gray) (vec)) => 10 20
byte-gray->int-argb
added in 3.0
(byte-gray->int-argb bytes)(byte-gray->int-argb bytes length)(byte-gray->int-argb from-bytes to-ints length)converts a byte-gray array to int-argb
(->> (byte-array 10 20) (byte-gray->int-argb) (mapv int->bytes)) => [255 10 10 10 255 20 20 20]
bytes->int
added in 3.0
(bytes->int [b3 b2 b1 b0])returns the integer value for bytes
(bytes->int 255 10 34 56) => 4278854200
form-params
added in 3.0
(form-params elems)int->bytes
added in 3.0
(int->bytes v)returns bytes value given an integer
(int->bytes 4278854200) => 255 10 34 56
int-argb->byte-gray
added in 3.0
(int-argb->byte-gray ints)(int-argb->byte-gray ints length)(int-argb->byte-gray from-ints to-bytes length)converts a int-argb array to byte-gray
(->> [255 10 10 10 255 20 20 20] (map bytes->int) (int-array) (int-argb->byte-gray) (vec)) => 10 20
mask
added in 3.0
(mask n)returns the number representation of the binary bit mask of n digits
(mask 5) => 31 (mask 7) => 127