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)

returns the function that will output a value given a vector of inputs

((<<fn 5 5 5) 10 20 30) => 10910

<<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)

returns a vector representation given an input value

((>>fn 5 5 5) 10910) => 10 20 30

>>form

added in 3.0

(>>form elems)

array-fn

added in 3.0

(array-fn elems)

returns the appropriate array function for the given inputs

(array-fn 5 5 5) => short-array

(array-fn 8 8 8 8) => int-array

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)

returns the mask and start values given a list of elements

(form-params 5 5 5) => ’[(31 31 31) 0 5 10]

(form-params 8 8 8 8) => ’[(255 255 255 255) 0 8 16 24]

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

type-lookup