[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo/color colors.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo/color colors.py |
Date: |
Sun, 29 Sep 2002 06:56:07 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/29 06:56:07
Modified files:
gfx/demo/color : colors.py
Log message:
Visualize /etc/X11/rgb.txt
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/color/colors.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/color/colors.py
diff -c gzz/gfx/demo/color/colors.py:1.6 gzz/gfx/demo/color/colors.py:1.7
*** gzz/gfx/demo/color/colors.py:1.6 Sun Sep 29 04:33:37 2002
--- gzz/gfx/demo/color/colors.py Sun Sep 29 06:56:07 2002
***************
*** 124,132 ****
hash = {}
for rgb in colors:
! hash[rgb[3]] = (int(rgb[0])/255.,
! int(rgb[1])/255.,
! int(rgb[2])/255.)
return hash
class CIELABScene:
--- 124,132 ----
hash = {}
for rgb in colors:
! hash[" ".join(rgb[3:])] = (int(rgb[0])/255.,
! int(rgb[1])/255.,
! int(rgb[2])/255.)
return hash
class CIELABScene:
***************
*** 274,287 ****
class CIELABScene2:
def __init__(self):
self.angle = None
self.colors = None
def key(self, k):
a = self.angle or 0
! if k == "+": self.angle = a + 5
! if k == "-": self.angle = a - 5
if k == "0": self.angle = None
! if k == "c":
! self.colors = readcolors().values()
def scene(self, vs):
putnoc(vs, background((1.0,1.0,1.0)))
--- 274,322 ----
class CIELABScene2:
def __init__(self):
self.angle = None
+ self.angle2 = 0
self.colors = None
+ self.map = None
+ self.dsiz = 4
+
def key(self, k):
a = self.angle or 0
! if k == "Left": self.angle = a + 5
! if k == "Right": self.angle = a - 5
! if k == "Up": self.angle2 += 5
! if k == "Down": self.angle2 -= 5
if k == "0": self.angle = None
! if k == "c": self.colors = readcolors().values()
! AbstractUpdateManager.setNoAnimation()
!
! def mouse(self, ev):
! global globalx, globaly
! if ev.getID() == ev.MOUSE_CLICKED:
! dsiz = 800
! (a,b) = ((ev.getX() - 600.0) / self.dsiz,
! (ev.getY() - 450.0) / self.dsiz)
! print "A,B=", a,b
! minr2 = 1E8
! if not self.map: self.map = readcolors()
! for name in self.map.keys():
! lab = RGBtoLAB(self.map[name])
! r2 = round((lab[1]-a)**2 + (lab[2]-b)**2, 2)
! if r2 < minr2:
! minr2 = r2
! best = [name]
! elif r2 == minr2:
! best += [name]
! print "Best matches:"
! def round1(x): return round(x,1)
! def round2(x): return round(100*x,1)
! for name in best:
! rgb = self.map[name]
! print "%s: LAB=%s RGB=%s" % (name,
! map(round1, RGBtoLAB(rgb)),
! map(round2, rgb))
!
! AbstractUpdateManager.setNoAnimation()
!
def scene(self, vs):
putnoc(vs, background((1.0,1.0,1.0)))
***************
*** 296,314 ****
Color 1 0.1 1
"""))
- dsiz = 800
n = 16
if not self.colors:
for b in range(0,n):
l = 100 * (b+.5) /n
- vs.put(GLRen.createLABSlice(0, l),
- "labslice"+str(b),
- 10, 600, 450, dsiz*.01, dsiz*.01)
-
- cs = vs.coords.affineCoordsys(0, 10, 600, 450,
- dsiz*.005, 0, 0, dsiz*.005)
- vs.matcher.add(cs, "foo")
vs.map.put(getDList("""
Color 1 1 1
--- 331,346 ----
Color 1 0.1 1
"""))
n = 16
+ cs = vs.coords.affineCoordsys(0, 10, 600, 450,
+ self.dsiz, 0, 0, self.dsiz)
+ vs.matcher.add(cs, "foo")
+
if not self.colors:
for b in range(0,n):
l = 100 * (b+.5) /n
+ vs.map.put(GLRen.createLABSlice(0, l), cs)
vs.map.put(getDList("""
Color 1 1 1
***************
*** 353,360 ****
Vertex 200 +150
Vertex 200 -150
End
PopMatrix
! """ % (self.angle)), cs)
putnoc(vs, getDList("""
--- 385,400 ----
Vertex 200 +150
Vertex 200 -150
End
+ Rotate %s 0 0 1
+ Color 1 1 1
+ Begin QUADS
+ Vertex 0 -150
+ Vertex 0 +150
+ Vertex 200 +150
+ Vertex 200 -150
+ End
PopMatrix
! """ % (self.angle, self.angle2)), cs)
putnoc(vs, getDList("""