Initial checkin - Alex
authorterminatorX <>
Mon, 1 Nov 2004 17:54:06 +0000 (17:54 +0000)
committerterminatorX <>
Mon, 1 Nov 2004 17:54:06 +0000 (17:54 +0000)
knob/Makefile [new file with mode: 0644]
knob/merge [new file with mode: 0755]
knob/pixbuf [new file with mode: 0755]
knob/render_all [new file with mode: 0755]
knob/tX_knob.pov [new file with mode: 0644]

diff --git a/knob/Makefile b/knob/Makefile
new file mode 100644 (file)
index 0000000..f83f0f2
--- /dev/null
@@ -0,0 +1,8 @@
+all:
+       ./render_all && ./merge && ./pixbuf
+
+clean:
+       rm -f knob*png merge*png knobs.pixbuf
+
+tX_knob.png: tX_knob.pov
+       /usr/local/share/povray-3.6/scripts/render_scene.sh tX_knob.pov
diff --git a/knob/merge b/knob/merge
new file mode 100755 (executable)
index 0000000..a354314
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+create_image() {
+
+echo -n Merging image $no:
+
+image=knob$no.png
+mask=knob$no-mask.png
+out=merge$no.png
+
+cat > tmp.scm <<EOF
+(let* (
+(mask (car (file-png-load 1 "$mask" "$mask")))
+(mask-drawable (car (gimp-image-active-drawable mask)))
+(img (car (file-png-load 1 "$image" "$image")))
+(img-drawable (car (gimp-image-active-drawable img)))
+(color (car (gimp-image-pick-color img img-drawable 0 0 0 0 1)))
+)
+(gimp-fuzzy-select mask-drawable 0 0 0 0 FALSE 0 1 0)
+(set! active-selection (car (gimp-selection-save mask)))
+(gimp-selection-all img)
+(gimp-edit-copy img-drawable)
+(gimp-selection-all mask)
+(set! mask-fs (car (gimp-edit-paste mask-drawable FALSE)))
+(gimp-floating-sel-anchor mask-fs)
+(gimp-selection-load active-selection)
+(plug-in-colortoalpha 1 img mask-drawable color)
+(gimp-image-crop mask 240 240 40 0)
+(gimp-image-scale mask 42 42)
+(file-png-save 1 mask mask-drawable "$out" "$out" 0 9 0 0 0 0 0)
+(gimp-quit TRUE)
+)
+EOF
+
+gimp -s -f -i -d --console-messages --batch '(load "tmp.scm" nil nil)'
+rm tmp.scm
+
+echo " done."
+
+}
+
+for no in {,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
+do
+       create_image;
+done
diff --git a/knob/pixbuf b/knob/pixbuf
new file mode 100755 (executable)
index 0000000..e99284b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+args=""
+
+for no in {,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
+do
+       args="$args knob"$no" merge"$no".png"   
+done
+
+gdk-pixbuf-csource --raw --build-list $args > knobs.pixbuf
+
diff --git a/knob/render_all b/knob/render_all
new file mode 100755 (executable)
index 0000000..e8fb50d
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+import os, sys
+
+def render(i, mask):
+       angle = 280.0*float(i)/49.0+40.0-180.0
+       
+       inf = open('tX_knob.pov')
+       outf = open('tmp.pov', 'w')
+       for line in inf:
+               out = line.replace('ROT_ANGLE','%lf' % angle)
+               
+               if mask:
+                       out = out.replace('BACKGROUND','Black')
+                       out = out.replace('MASKOPTION','no_shadow')
+               else:
+                       out = out.replace('BACKGROUND','Blue')
+                       out = out.replace('MASKOPTION','')
+               
+               outf.write(out)
+               
+       outf.close()
+       inf.close()
+       
+       os.system('/usr/local/share/povray-3.6/scripts/render_scene.sh tmp.pov')
+       if mask:
+               m = '-mask'
+       else:
+               m = ''
+               
+       os.rename('tmp.png', 'knob%0i%s.png' % (49-i,m))
+       os.unlink('tmp.pov')
+
+
+if len(sys.argv)>1:
+       img = []
+       for image in sys.argv[1:]:
+               img.append(int(image))
+else:
+       img = xrange(0,50)
+       
+print img      
+
+for i in img:
+       render(i, False)
+       render(i, True)
+       
diff --git a/knob/tX_knob.pov b/knob/tX_knob.pov
new file mode 100644 (file)
index 0000000..8d861fe
--- /dev/null
@@ -0,0 +1,172 @@
+// terminatorX - realtime audio scratching software
+// Copyright (C) 1999-2004  Alexander K├Ânig <alex@lisas.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// 
+// This is a povray scene that renders a knob for the terminatorX user
+// interface.
+
+// -w320 -h240 -icon
+// -w800 -h600 +a0.3
+
+#include "colors.inc"
+#include "metals.inc"
+#include "textures.inc"
+
+global_settings { assumed_gamma 2.2 }
+
+#declare chrome = texture { T_Chrome_2E }
+#declare silver = texture { Silver_Metal }
+
+#declare knob_height=2;
+
+#declare black_plastic =
+texture {
+    pigment { color rgb <0, 0, 0> }
+    finish {ambient 0.1 diffuse 0.8 phong 0.5 phong_size 100 }
+}
+
+#declare orange_plastic =
+texture {
+    pigment { color rgb <1, 0.2, 0> }
+    finish {ambient 0.1 diffuse 0.8 phong 0.5 phong_size 100 }
+}
+
+#declare white_plastic =
+texture {
+    pigment { color rgb <1, 1, 1> }
+    finish {ambient 0.1 diffuse 0.8 phong 0.5 phong_size 100 }
+}
+
+#if(1=1)
+  camera { orthographic location -z*3.3 look_at 0 }
+#else
+  camera { orthographic location -x*5 look_at 0 }
+#end
+
+plane {
+  z, 0.01
+  hollow on
+  pigment {BACKGROUND}
+}
+
+light_source { <-60, 80, -500> color Gray85}
+light_source { <50,  10, -900> color Gray65}
+
+#declare zyl=0;
+
+union {
+       difference {
+               intersection {
+                       union {
+                               cylinder {<0,0,0>,<0,0,-knob_height>,1}
+
+#declare w=0.2;
+#declare h=2.2;
+
+#declare A = 0;
+#while (A<9)
+                               box {
+                                       <-w/2,-h/2,0>,<w/2,h/2,-knob_height>
+                                       rotate z*(A*20)
+                               }
+#declare A=A+1;
+#end
+                       }
+
+                       sphere {
+                               <0,0,0>,knob_height
+                       }
+               
+               }
+#if(zyl=1)             
+               cylinder {<0,0,0>,<0,0,-2*knob_height>,0.75}
+#end
+               
+               texture { silver }
+       }
+
+       difference {
+               cylinder {<0,0,0>,<0,0,-knob_height>,0.9}
+               cylinder {<0,0,-1>,<0,0,-knob_height-1>,0.75}
+               texture { silver }
+       }
+
+#if(zyl=1)
+       intersection {
+#if(1=1)       
+               cylinder {<0,-1,-.7>,<0,1,-.7>,1.3}
+#else
+               union {
+#declare A = 0;
+#while (A<9)
+                       torus {
+                               A*0.1, 0.1
+                               rotate -90*x
+                               translate <0,0,-knob_height*0.8>
+                       }
+#declare A=A+1;
+#end
+               }
+#end
+               cylinder {<0,0,0>,<0,0,-2*knob_height>,0.75}
+               texture { silver }
+       }
+#end
+  
+       box {
+               <-0.1,0,0>,<0.1,1.1,-knob_height-.01>
+               texture {orange_plastic}
+       }
+
+       rotate z*ROT_ANGLE
+       MASKOPTION
+}
+
+difference {
+       cylinder {
+               <0,0,0>,<0,0,-0.005>,1.5
+       }
+       
+       cone {
+               <0, 0, 0>, 0    // Center and radius of one end
+               <0, -1.5, 0>, 0.85    // Center and radius of other end
+       }
+       
+       texture {black_plastic} 
+}
+
+union {
+#declare tiny_height=0.25;
+#declare tiny_width=0.1;
+
+#declare big_height=0.3;
+#declare big_width=0.2;
+
+#declare A = 1;
+#while (A<16)
+       box {
+#if((A=1) | (A=8) | (A=15))
+               <-big_width/2,-big_height/2,-0.01>,<big_width/2,big_height/2,-0.01>
+#else
+               <-tiny_width/2,-tiny_height/2,-0.01>,<tiny_width/2,tiny_height/2,-0.01>
+#end
+               translate <0,1.3,0>
+               rotate z*(A*20+20+180)
+       }
+#declare A=A+1;
+#end
+               texture {white_plastic} 
+}