[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Changes to badge exports.



commit 02fd753587926fc84b627719f9b654ac5d811e4d
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date:   Sat May 4 22:36:47 2013 -0700

    Changes to badge exports.
---
 proxy/Makefile              |   18 +++++-------------
 proxy/badge-export-lang.scm |   21 +++++++++++++++++++++
 proxy/export_badges.scm     |   27 ---------------------------
 3 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/proxy/Makefile b/proxy/Makefile
index 9fad8e5..8f3c9c7 100644
--- a/proxy/Makefile
+++ b/proxy/Makefile
@@ -1,19 +1,11 @@
-all:
-	:
+LANGS = de en pt ru
+
+all: $(addprefix badge-, $(addsuffix .png, $(LANGS)))
 
 test:
 	./flashproxy-test.js
 
-LANGS = de en ru
-badges: $(addprefix badge-, $(addsuffix .png, $(LANGS))) link
-
-link:
-	ln -s badge-en.png badge.png
-
 badge-%.png: badge.xcf
-	gimp -i -b '$(shell cat export_badges.scm) (eb "$*") (exit)'
-
-clean:
-	rm badge*.png
+	(cat badge-export-lang.scm; echo '(export "$*") (gimp-quit 0)') | gimp -i -b -
 
-.PHONY: all test badges link clean
+.PHONY: all test
diff --git a/proxy/badge-export-lang.scm b/proxy/badge-export-lang.scm
new file mode 100644
index 0000000..51f78f1
--- /dev/null
+++ b/proxy/badge-export-lang.scm
@@ -0,0 +1,21 @@
+; This is a Gimp script-fu script that selects and exports the appropriate
+; language layers from an input XCF containing multiple layers.
+
+(define xcf-filename "badge.xcf")
+
+(define (export lang)
+  (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE xcf-filename xcf-filename)))
+         (shine-layer (car (gimp-image-get-layer-by-name image "shine")))
+         (text-layer (car (gimp-image-get-layer-by-name image (string-append "text-" lang))))
+         (output-filename (string-append "badge-" lang ".png")))
+    ; Turn off all layers.
+    (for-each (lambda (x) (gimp-item-set-visible x FALSE))
+              (vector->list (cadr (gimp-image-get-layers image))))
+    ; Except the shine and the wanted text.
+    (gimp-item-set-visible shine-layer TRUE)
+    (gimp-item-set-visible text-layer TRUE)
+    (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
+    (file-png-save RUN-NONINTERACTIVE image
+                   (car (gimp-image-get-active-layer image))
+                   output-filename output-filename FALSE 9 FALSE FALSE FALSE FALSE FALSE)
+    ))
diff --git a/proxy/export_badges.scm b/proxy/export_badges.scm
deleted file mode 100644
index 3a2aece..0000000
--- a/proxy/export_badges.scm
+++ /dev/null
@@ -1,27 +0,0 @@
-(define (exit)
-  (gimp-quit 0))
-
-(define file "badge.xcf")
-
-(define (find_layer_by_name image layers name)
-  (define (loop ls)
-    (cond
-      ((null? ls) (error "Could not find layer?"))
-      ((string=? (car (gimp-drawable-get-name (car ls))) name) (car ls))
-      (else (loop (cdr ls)))
-    ))
-  (loop (vector->list layers)))
-
-(define (eb lang)
-  (let* (
-    (image (car (gimp-file-load RUN-NONINTERACTIVE file file)))
-    (layers (cadr (gimp-image-get-layers image)))
-    (layer (find_layer_by_name image layers (string-append "text-" lang)))
-    (filename (string-append "badge-" lang ".png"))
-  )
-  (gimp-drawable-set-visible layer TRUE)
-  (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
-  (file-png-save RUN-NONINTERACTIVE image
-    (car (gimp-image-get-active-layer image))
-    filename filename FALSE 9 FALSE FALSE FALSE FALSE FALSE)
-  ))
\ No newline at end of file



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits