+(defun checksum-view ()
+ (format nil "~{~2,'0X~}"
+ (map 'list #'identity
+ (ironclad:digest-sequence :sha1 (coerce (clnl-interface:export-view) '(vector (unsigned-byte 8)))))))
+
+(defun save-view-to-ppm ()
+ (let
+ ((height 143) (width 143)) ; hardcoded in interface, hardcoded here, cry for me
+ (with-open-file (str "cl.ppm" :direction :output :if-exists :supersede :if-does-not-exist :create :element-type '(unsigned-byte 8))
+ (write-sequence (map 'vector #'char-code (format nil "P6~%")) str)
+ (write-sequence (map 'vector #'char-code (format nil "143 143~%")) str)
+ (write-sequence (map 'vector #'char-code (format nil "255~%")) str)
+ (let
+ ((image-data (clnl-interface:export-view)))
+ (dotimes (i width)
+ (dotimes (j height)
+ (write-byte (aref image-data (+ 0 (* 4 (+ (* (- (1- height) i) width) j)))) str)
+ (write-byte (aref image-data (+ 1 (* 4 (+ (* (- (1- height) i) width) j)))) str)
+ (write-byte (aref image-data (+ 2 (* 4 (+ (* (- (1- height) i) width) j)))) str)))))))
+