[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx libcolor/spaces.py util/papersampler.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx libcolor/spaces.py util/papersampler.py |
Date: |
Sun, 09 Mar 2003 05:39:17 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 03/03/09 05:39:17
Modified files:
gfx/libcolor : spaces.py
gfx/util : papersampler.py
Log message:
Add gamma correction in the color space conversion so that the default
(nonlinear) display gamma can be used
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcolor/spaces.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/papersampler.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
Patches:
Index: gzz/gfx/libcolor/spaces.py
diff -u gzz/gfx/libcolor/spaces.py:1.15 gzz/gfx/libcolor/spaces.py:1.16
--- gzz/gfx/libcolor/spaces.py:1.15 Fri Feb 21 15:02:32 2003
+++ gzz/gfx/libcolor/spaces.py Sun Mar 9 05:39:16 2003
@@ -155,6 +155,15 @@
Wr,Wg,Wb = 0.3, 0.59, 0.11
+# Gamma correction used with the perceptual non-linearity in YtoL and LtoY
+# conversion functions.
+#
+gamma = 2
+#
+# Usually, the default display gamma of 1.0 actually yields an intensity
+# exponent of 0.5 so gamma correction of 2.0 here should result in linear
+# intensity. (The CIE L* computation assumes linear intensity).
+
def YSTtoRGB(v):
n = 1.0 / (Wr+Wg+Wb)
mat = [ [n, n*(Wg+Wb), n*(Wb - Wg) / math.sqrt(3) ],
@@ -212,6 +221,7 @@
Y: luminance between 0 and 1
returns: lightness between 0 and 100
"""
+ Y = Y**gamma
if Y <= (216./24389):
return Y * (24389./27)
else:
@@ -224,6 +234,6 @@
returns: luminance between 0 and 1
"""
if L <= 8:
- return L * (27./24389)
+ return pow(L * (27./24389), 1.0 / gamma)
else:
- return pow((L + 16.0) / 116, 3)
+ return pow((L + 16.0) / 116, 3.0 / gamma)
Index: gzz/gfx/util/papersampler.py
diff -u gzz/gfx/util/papersampler.py:1.26 gzz/gfx/util/papersampler.py:1.27
--- gzz/gfx/util/papersampler.py:1.26 Wed Mar 5 05:23:05 2003
+++ gzz/gfx/util/papersampler.py Sun Mar 9 05:39:17 2003
@@ -258,16 +258,16 @@
w.setLocation(0,0,xs,ys)
def star(vs):
- putText(vs, 0, "*", x=xs*.5-10, y=ys*.6, h = 100)
+ putText(vs, 0, "*", x=xs*.5-10, y=ys*.6-100, h = 100)
def space(vs):
- putText(vs, 0, "Press space to start", x=xs*.5-350, y=ys*.6, h =
100)
+ putText(vs, 0, "Press space to start", x=xs*.5-350, y=ys*.6-100, h
= 100)
doFrame(star, "tmp/star")
doFrame(space, "tmp/space")
- createPurePapers()
- createTextPapers()
+ #createPurePapers()
+ #createTextPapers()
gfxapi = GraphicsAPI.getInstance()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx libcolor/spaces.py util/papersampler.py,
Janne V. Kujala <=