;; paperproto.scm: a "paper prototyping" system. ;; Copyright (C) 2005 by Akkana Peck, akkana@shallowsky.com. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License. ;; Words are delimited by newlines. (define (script-fu-get-word-list str) (strbreakup str "\n") ) (define (script-fu-paper-prototype text bgcolor w h font fontsize fontcolor) (let* ((old-fg-color (car (gimp-context-get-foreground))) (newimg (car (gimp-image-new w h RGB))) (bg (car (gimp-layer-new newimg w h RGBA-IMAGE "background" 100 NORMAL-MODE))) (words (script-fu-get-word-list text)) ) ;(gimp-message "Got into the function") (gimp-image-undo-disable newimg) (gimp-image-add-layer newimg bg -1) (gimp-context-set-foreground bgcolor) (gimp-drawable-fill bg FOREGROUND-FILL) (gimp-context-set-foreground fontcolor) (gimp-image-set-filename newimg "paperproto") (srand (realtime)) (while (not (null? words)) (let* ((textx (rand (- w 100))) (texty (rand (- h 25))) (text-layer (car (gimp-text-fontname newimg bg textx texty (car words) 5 TRUE fontsize PIXELS font))) ) (gimp-floating-sel-to-layer text-layer) (set! words (cdr words)) )) ;; Clean up (gimp-context-set-foreground old-fg-color) (gimp-image-undo-enable newimg) (gimp-display-new newimg) ) ) (script-fu-register "script-fu-paper-prototype" _"/Xtns/Script-Fu/Misc/Paper Prototype..." "Paper Prototyping" "Akkana Peck" "Akkana Peck" "August 2005" "" SF-TEXT _"Phrase list\n(one per line)" "" SF-COLOR _"Background color" '(255 255 255) SF-ADJUSTMENT _"Width" '(640 10 3000 1 10 0 1) SF-ADJUSTMENT _"Height" '(640 10 3000 1 10 0 1) SF-FONT _"Font" "Arial Bold Italic" SF-ADJUSTMENT _"Font size" '(20 2 500 1 10 0 1) SF-COLOR _"Text color" '(0 0 0) )