'clj-pnm' core functions namespace.
'clj-pnm' core functions namespace.
(blank? s)
Returns true if the string is either nil, empty or contains only whitespace.
Returns true if the string is either nil, empty or contains only whitespace.
(comment-line? line)
Returns true if a string is considered a Netpbm format comment line (starts with '#' character). Otherwise returns false.
Returns true if a string is considered a Netpbm format comment line (starts with '#' character). Otherwise returns false.
(fourth v)
Returns the fourth element of the collection.
Returns the fourth element of the collection.
(get-comments v)
Returns all the Netpbm comments lines from the collection of strings.
Returns all the Netpbm comments lines from the collection of strings.
(normalize-whitespace v)
Goes through the collection of strings and reduces multiple white-spaces in a string to just one and trims it.
Goes through the collection of strings and reduces multiple white-spaces in a string to just one and trims it.
Parses the vector of Netpbm lines to a map. Supports 'pbm', 'pgm' and 'ppm' formats. Throws an Exception or JS error if format is unsupported.
Parses the vector of Netpbm lines to a map. Supports 'pbm', 'pgm' and 'ppm' formats. Throws an Exception or JS error if format is unsupported.
Reads string lines for the given source. In Clojure environments the function supports string and file sources and in ClojureScript environment only string sources.
Reads string lines for the given source. In Clojure environments the function supports string and file sources and in ClojureScript environment only string sources.
(read-pnm pnm)
Main function for reading Netpbm format. Accepts the string or a file and returns a Netpbm map representation.
Main function for reading Netpbm format. Accepts the string or a file and returns a Netpbm map representation.
(read-str s)
Reads the object from the string. In Clojure environment uses 'read-string' and in ClojureScript environment uses 'cljs.reader/read-string'.
Reads the object from the string. In Clojure environment uses 'read-string' and in ClojureScript environment uses 'cljs.reader/read-string'.
(remove-comments v)
Removes all the Netpbm comment lines from the collection of strings.
Removes all the Netpbm comment lines from the collection of strings.
(split-on-space-char s)
Splits the given string on space character returning a vector of the parts.
Splits the given string on space character returning a vector of the parts.
(third v)
Returns the third element of the collection.
Returns the third element of the collection.
(tokenize v)
Tokenizes a collection of strings by splitting each one on space character and flattening the resulting collection.
Tokenizes a collection of strings by splitting each one on space character and flattening the resulting collection.
(write-comments writer comments)
Writes a comment line to a Writer. Prepends the '# ' sequence to the string. The function is exposed only in Clojure environment.
Writes a comment line to a Writer. Prepends the '# ' sequence to the string. The function is exposed only in Clojure environment.
(write-map writer m)
Writes the Netpbm bit/value map to a Writer. The function is exposed only in Clojure environment.
Writes the Netpbm bit/value map to a Writer. The function is exposed only in Clojure environment.
(write-pnm pnm file-name)
(write-pnm pnm file-name comments)
The main function for writing Netpbm format to a file. Accepts a Netpbm map representation and a file name. Can optionally accept a set of comments that will be written in a file after the header. The function is exposed only in Clojure environment.
The main function for writing Netpbm format to a file. Accepts a Netpbm map representation and a file name. Can optionally accept a set of comments that will be written in a file after the header. The function is exposed only in Clojure environment.
(writeln writer line)
Writes a string to a Writer. Appends a newline character to a string first. The function is exposed only in Clojure environment.
Writes a string to a Writer. Appends a newline character to a string first. The function is exposed only in Clojure environment.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close