xrvg 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +6 -0
- data/README +1 -1
- data/Rakefile +1 -1
- data/lib/color.rb +7 -6
- data/lib/interpolation.rb +2 -1
- data/lib/xrvg.rb +2 -2
- data/test/test_color.rb +7 -0
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= CHANGES
|
2
2
|
|
3
|
+
== 0.0.5 (2008.03.22)
|
4
|
+
=== Content
|
5
|
+
- Add GeoVariety classes
|
6
|
+
=== Debug
|
7
|
+
- color interpolation right again, but color trim is no longer done
|
8
|
+
|
3
9
|
== 0.0.4 (2008.03.16)
|
4
10
|
Really big functional release. Several additional releases are needed to add appropriate tests and docs.
|
5
11
|
=== Content
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -63,7 +63,7 @@ RDOC_FILES = FileList["README", "CHANGES"]
|
|
63
63
|
|
64
64
|
# Ruby library code.
|
65
65
|
LIB_DIR = "lib"
|
66
|
-
PRE_LIB_FILES = FileList["trace.rb", "samplation.rb", "interpolation.rb", "parametriclength.rb", "utils.rb", "geometry2D.rb", "color.rb", "frame.rb", "shape.rb", "render.rb", "shape.rb", "style.rb", "bezier.rb", "bezierspline.rb", "fitting.rb", "bezierbuilders.rb", "beziermotifs.rb", "beziertools.rb", "interbezier.rb", "xrvg.rb"]
|
66
|
+
PRE_LIB_FILES = FileList["trace.rb", "samplation.rb", "interpolation.rb", "parametriclength.rb", "utils.rb", "geometry2D.rb", "color.rb", "frame.rb", "shape.rb", "render.rb", "shape.rb", "style.rb", "bezier.rb", "bezierspline.rb", "fitting.rb", "bezierbuilders.rb", "beziermotifs.rb", "beziertools.rb", "interbezier.rb", "geovariety.rb", "xrvg.rb"]
|
67
67
|
LIB_FILES = FileList["#{LIB_DIR}/*.rb"]
|
68
68
|
|
69
69
|
# Example code.
|
data/lib/color.rb
CHANGED
@@ -35,10 +35,11 @@ class Color
|
|
35
35
|
#
|
36
36
|
# r, g, b, a must be between 0.0 and 1.0
|
37
37
|
def initialize( r, g, b, a)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
# cannot trim because otherwise color interpolation cannot be right !!
|
39
|
+
# r = Range.O.trim( r )
|
40
|
+
# g = Range.O.trim( g )
|
41
|
+
# b = Range.O.trim( b )
|
42
|
+
# a = Range.O.trim( a )
|
42
43
|
@items = [r,g,b,a]
|
43
44
|
end
|
44
45
|
|
@@ -129,8 +130,8 @@ class Color
|
|
129
130
|
|
130
131
|
# return a random color vector, with 1.0 opacity !!
|
131
132
|
# Color.rand => Color[0.2345, 0.987623, 0.4123, 1.0]
|
132
|
-
def Color.rand
|
133
|
-
return Color[Kernel::rand,Kernel::rand,Kernel::rand,
|
133
|
+
def Color.rand( opacity )
|
134
|
+
return Color[Kernel::rand,Kernel::rand,Kernel::rand,opacity]
|
134
135
|
end
|
135
136
|
|
136
137
|
# return a black color vector
|
data/lib/interpolation.rb
CHANGED
@@ -42,7 +42,8 @@ module Interpolation
|
|
42
42
|
if dindex == index
|
43
43
|
return value
|
44
44
|
end
|
45
|
-
result = pvalue + ((value + pvalue * (-1.0) ) * ((dindex - pindex) / (index - pindex )))
|
45
|
+
result = pvalue + ((value + (pvalue * (-1.0)) ) * ((dindex - pindex) / (index - pindex )))
|
46
|
+
Trace("pindex #{pindex} pvalue #{pvalue.inspect} index #{index} value #{value.inspect} dindex #{dindex} result #{result.inspect}")
|
46
47
|
break
|
47
48
|
end
|
48
49
|
pvalue, pindex = value, index
|
data/lib/xrvg.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Please refer to README for XRVG introduction
|
4
4
|
|
5
5
|
# XRVG version (used in rakefile)
|
6
|
-
XRVG_VERSION = "0.0.
|
6
|
+
XRVG_VERSION = "0.0.5"
|
7
7
|
|
8
8
|
# XRVG namespace
|
9
9
|
module XRVG
|
@@ -38,7 +38,7 @@ require 'bezierbuilders'
|
|
38
38
|
require 'beziermotifs'
|
39
39
|
require 'beziertools'
|
40
40
|
require 'interbezier'
|
41
|
-
|
41
|
+
require 'geovariety'
|
42
42
|
# require 'spiral'
|
43
43
|
# require 'graph'
|
44
44
|
|
data/test/test_color.rb
CHANGED
@@ -29,6 +29,10 @@ class ColorTest < Test::Unit::TestCase
|
|
29
29
|
assert_equal( orange, Color.orange )
|
30
30
|
end
|
31
31
|
|
32
|
+
def test_rand
|
33
|
+
assert_equal( 0.3, Color.rand( 0.3 ).a )
|
34
|
+
end
|
35
|
+
|
32
36
|
def test_svg
|
33
37
|
assert_equal( "rgb(0,0,0)", Color.black.svg )
|
34
38
|
end
|
@@ -77,6 +81,7 @@ class ColorTest < Test::Unit::TestCase
|
|
77
81
|
|
78
82
|
def test_format255
|
79
83
|
assert_equal( [255,255,255,255], Color.white.format255 )
|
84
|
+
assert_equal( [25,25,25,25], Color[0.1,0.1,0.1,0.1].format255 )
|
80
85
|
end
|
81
86
|
|
82
87
|
end
|
@@ -88,6 +93,8 @@ class PaletteTest < Test::Unit::TestCase
|
|
88
93
|
palette = Palette.new( :colorlist, [ 0.0, Color.black, 1.0, Color.white ] )
|
89
94
|
assert_equal( Color[0.5, 0.5, 0.5, 1.0], palette.color( 0.5 ) )
|
90
95
|
assert_equal( Color[0.5, 0.5, 0.5, 1.0], palette.sample( 0.5 ) )
|
96
|
+
palette = Palette[ :colorlist, [ 0.0, Color.blue, 0.3, Color.orange, 0.5, Color.yellow, 0.7, Color.green, 1.0, Color.blue] ]
|
97
|
+
assert_equal( Color[1.0, 0.75, 0.0, 1.0], palette.sample( 0.4 ) )
|
91
98
|
end
|
92
99
|
|
93
100
|
def test_reverse
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: xrvg
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2008-03-
|
6
|
+
version: 0.0.5
|
7
|
+
date: 2008-03-22 00:00:00 +01:00
|
8
8
|
summary: Ruby vector graphics library
|
9
9
|
require_paths:
|
10
10
|
- lib
|