use vectors
This commit is contained in:
17
graphgif.scm
17
graphgif.scm
@@ -2,7 +2,8 @@
|
||||
|
||||
(use-modules (cairo)
|
||||
(srfi srfi-1)
|
||||
(srfi srfi-9 gnu))
|
||||
(srfi srfi-9 gnu)
|
||||
(srfi srfi-43))
|
||||
|
||||
(re-export (cairo-pattern-create-rgb . create-color))
|
||||
|
||||
@@ -141,16 +142,16 @@
|
||||
|
||||
(define (output-to-file surfaces filename)
|
||||
(define pngdir (mkdtemp "/tmp/graphgif_XXXXXX"))
|
||||
(do ([i 1 (1+ i)]
|
||||
[surfaces surfaces (cdr surfaces)])
|
||||
((null? surfaces))
|
||||
(cairo-surface-write-to-png
|
||||
(car surfaces)
|
||||
(string-append pngdir "/img-" (number->string i) ".png")))
|
||||
(vector-for-each
|
||||
(lambda (i surface)
|
||||
(cairo-surface-write-to-png
|
||||
surface
|
||||
(string-append pngdir "/img-" (number->string i) ".png")))
|
||||
surfaces)
|
||||
(system* "ffmpeg" "-i" (string-append pngdir "/img-%d.png") "-r" "1" filename))
|
||||
|
||||
(define-public (write-graphs-to-file graphs filename)
|
||||
(output-to-file (map draw-abstract-graph graphs) filename))
|
||||
(output-to-file (vector-map (lambda (_ graph) (draw-abstract-graph graph)) graphs) filename))
|
||||
|
||||
;; Local Variables:
|
||||
;; geiser-scheme-implementation: guile
|
||||
|
||||
Reference in New Issue
Block a user