(
(define (my-indexget List i)
(let*
(
(j 0)
)
(while (< j i)
(set! List (cdr List))
(set! j (+ j 1))
)
(car List)
))
(define (my-seq-filename-jpg N i)
(let*
(
(str_i (number->string i))
(LEN_i (string-length str_i))
(LEN_N (string-length (number->string (- N 1))))
(N_zero (- LEN_N LEN_i))
(Zeros)
(i)
)
(set! Zeros "")
(set! i 0)
(while (< i N_zero)
(set! Zeros (string-append Zeros "0"))
(set! i (+ i 1))
)
(string-append "src/text/" Zeros str_i ".jpg")
))
(define (seq-text Lists)
(let*
(
(W 704) (H 396)
(fontsize 64)
(font "DejaVu Sans Mono Bold")
(theImage
(car
(gimp-image-new W H RGB)
))
(theLayer
(car
(gimp-layer-new
theImage
W H
RGBA-IMAGE
"base"
100
NORMAL
)))
(N) (i 0)
(List)
(Color)
(Color_inv)
(text)
(theText)
(w) (h)
(offset_x) (offset_y)
(filename)
)
(gimp-image-add-layer theImage theLayer 0)
(set! N (length Lists))
(while (< i N)
(set! List (my-indexget Lists i))
(set! Color (car List))
(set! Color_inv (car (cdr List)))
(set! text (car (cdr (cdr List))))
(gimp-context-set-background Color)
(gimp-drawable-fill theLayer BACKGROUND-FILL)
(gimp-context-set-foreground Color_inv)
(set! theText
(car
(gimp-text-fontname
theImage theLayer
0 0
text
0
TRUE
fontsize PIXELS
font
)))
(set! w (car (gimp-drawable-width theText)))
(set! h (car (gimp-drawable-height theText)))
(set! offset_x (/ (- W w) 2))
(set! offset_y (/ (- H h) 2))
(gimp-layer-set-offsets theText offset_x offset_y)
(gimp-floating-sel-anchor theText)
(set! filename (my-seq-filename-jpg N i))
(file-jpeg-save
1 theImage theLayer filename filename 1 0 0 0 "" 0 0 0 0)
(set! i (+ i 1))
)
))
(seq-text '(<lists>))
(gimp-quit 0)
)
2008年7月24日木曜日
(Code) seq-text.scm
分類:
Code