texplay 0.2.4 → 0.2.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/CHANGELOG +6 -0
- data/README.markdown +3 -3
- data/Rakefile +30 -55
- data/examples/example_bezier.rb +1 -1
- data/examples/example_blur.rb +59 -0
- data/examples/example_dup.rb +24 -1
- data/examples/example_lsystem.rb +9 -1
- data/examples/example_scale.rb +54 -0
- data/examples/media/logo.png +0 -0
- data/{src → ext/texplay}/actions.c +2 -2
- data/{src → ext/texplay}/actions.h +0 -0
- data/{src → ext/texplay}/bindings.c +0 -0
- data/{src → ext/texplay}/bindings.h +0 -0
- data/{src → ext/texplay}/cache.c +5 -2
- data/{src → ext/texplay}/cache.h +0 -0
- data/{src → ext/texplay}/compat.h +0 -0
- data/{src → ext/texplay}/extconf.rb +2 -2
- data/{src → ext/texplay}/gen_eval.c +0 -0
- data/{src → ext/texplay}/gen_eval.h +0 -0
- data/{src → ext/texplay}/object2module.c +0 -0
- data/{src → ext/texplay}/object2module.h +0 -0
- data/{src → ext/texplay}/texplay.c +1 -1
- data/{src → ext/texplay}/texplay.h +0 -0
- data/{src → ext/texplay}/utils.c +10 -7
- data/{src → ext/texplay}/utils.h +0 -0
- data/lib/texplay-contrib.rb +56 -35
- data/lib/texplay.rb +4 -4
- metadata +27 -24
- data/src/Makefile +0 -181
- data/src/TAGS +0 -286
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
INSTRUCTIONS
|
|
6
6
|
============
|
|
7
7
|
|
|
8
|
-
**TexPlay version 0.2.
|
|
8
|
+
**TexPlay version 0.2.5**
|
|
9
9
|
|
|
10
10
|
Gem installation:
|
|
11
11
|
|
|
@@ -13,11 +13,11 @@ Gem installation:
|
|
|
13
13
|
|
|
14
14
|
To compile TexPlay from source, ensure you are in the directory with the Rakefile and type:
|
|
15
15
|
|
|
16
|
-
+ rake
|
|
16
|
+
+ rake compile
|
|
17
17
|
|
|
18
18
|
OR
|
|
19
19
|
|
|
20
|
-
+ rake19
|
|
20
|
+
+ rake19 compile (assuming this is the name of your 1.9.1 version of rake)
|
|
21
21
|
|
|
22
22
|
**NB:** be sure to run the version of rake that corresponds to the ruby version you wish to use! on my system I use rake19 for ruby 1.9.1!
|
|
23
23
|
|
data/Rakefile
CHANGED
|
@@ -1,87 +1,62 @@
|
|
|
1
1
|
require 'rake/clean'
|
|
2
2
|
require 'rake/gempackagetask'
|
|
3
|
+
require 'rake/extensiontask'
|
|
3
4
|
|
|
4
|
-
TEXPLAY_VERSION = "0.2.
|
|
5
|
+
TEXPLAY_VERSION = "0.2.5"
|
|
5
6
|
|
|
6
7
|
$dlext = Config::CONFIG['DLEXT']
|
|
7
8
|
|
|
8
|
-
CLEAN.include("
|
|
9
|
+
CLEAN.include("ext/**/*.#{$dlext}", "ext/**/*.log", "ext/**/*.o", "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "ext/**/*.def", "ext/**/*.pdb")
|
|
9
10
|
CLOBBER.include("**/*.#{$dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
|
|
10
11
|
|
|
11
|
-
$make_program = if RUBY_PLATFORM =~ /win/
|
|
12
|
-
"nmake"
|
|
13
|
-
else
|
|
14
|
-
"make"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
task :default => [:build]
|
|
18
|
-
|
|
19
|
-
desc "Build TexPlay"
|
|
20
|
-
task :build => :clean do
|
|
21
|
-
puts "(2) building Makefile..."
|
|
22
|
-
chdir("./src/") do
|
|
23
|
-
ruby "extconf.rb"
|
|
24
|
-
puts "(3) building ctexplay.#{$dlext}..."
|
|
25
|
-
sh "#{$make_program}"
|
|
26
|
-
puts "(4) copying ctexplay.#{$dlext} to current directory..."
|
|
27
|
-
cp "ctexplay.#{$dlext}", "../lib" , :verbose => true
|
|
28
|
-
|
|
29
|
-
if RUBY_PLATFORM =~ /mswin/
|
|
30
|
-
if RUBY_VERSION =~ /1.9/
|
|
31
|
-
File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.19.#{$dlext}")
|
|
32
|
-
else
|
|
33
|
-
File.rename("../lib/ctexplay.#{$dlext}", "../lib/ctexplay.18.#{$dlext}")
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
puts "(5) ...done!"
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
12
|
specification = Gem::Specification.new do |s|
|
|
41
13
|
s.name = "texplay"
|
|
42
14
|
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
|
|
43
15
|
s.version = TEXPLAY_VERSION
|
|
44
|
-
s.date =
|
|
16
|
+
s.date = Time.now.strftime '%Y-%m-%d'
|
|
45
17
|
s.author = "John Mair (banisterfiend)"
|
|
46
18
|
s.email = 'jrmair@gmail.com'
|
|
47
19
|
s.description = s.summary
|
|
48
20
|
s.require_path = 'lib'
|
|
49
21
|
s.add_dependency("gosu",">=0.7.14")
|
|
22
|
+
s.platform = Gem::Platform::RUBY
|
|
23
|
+
s.extensions = ["ext/texplay/extconf.rb"]
|
|
50
24
|
s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
|
|
51
25
|
s.has_rdoc = false
|
|
52
26
|
s.files = ["Rakefile", "README.markdown", "CHANGELOG",
|
|
53
27
|
"lib/texplay.rb", "lib/texplay-contrib.rb"] +
|
|
54
|
-
FileList["
|
|
28
|
+
FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "examples/*.rb",
|
|
29
|
+
"examples/media/*"].to_a
|
|
30
|
+
|
|
55
31
|
|
|
56
|
-
if RUBY_PLATFORM =~ /mswin/
|
|
57
|
-
s.platform = Gem::Platform::CURRENT
|
|
58
|
-
s.files += ["lib/ctexplay.18.so", "lib/ctexplay.19.so"]
|
|
59
|
-
|
|
60
|
-
else
|
|
61
|
-
s.platform = Gem::Platform::RUBY
|
|
62
|
-
s.extensions = ["src/extconf.rb"]
|
|
63
|
-
end
|
|
64
32
|
end
|
|
33
|
+
|
|
65
34
|
Rake::GemPackageTask.new(specification) do |package|
|
|
66
35
|
package.need_zip = false
|
|
67
36
|
package.need_tar = false
|
|
68
37
|
end
|
|
69
38
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
puts "...done!"
|
|
39
|
+
Rake::ExtensionTask.new('texplay', specification) do |ext|
|
|
40
|
+
ext.config_script = 'extconf.rb'
|
|
41
|
+
ext.cross_compile = true
|
|
42
|
+
ext.cross_platform = 'i386-mswin32'
|
|
75
43
|
end
|
|
76
44
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
45
|
+
# SELENE = '/home/john/ruby/projects/selene'
|
|
46
|
+
# desc "update selene's version of texplay"
|
|
47
|
+
# task :selene => ["#{SELENE}/lib/texplay.rb", "#{SELENE}/lib/texplay-contrib.rb",
|
|
48
|
+
# "#{SELENE}/lib/ctexplay.so"] do
|
|
49
|
+
# puts "...done!"
|
|
50
|
+
# end
|
|
80
51
|
|
|
81
|
-
file "#{SELENE}/lib/texplay
|
|
82
|
-
|
|
83
|
-
end
|
|
52
|
+
# file "#{SELENE}/lib/texplay.rb" => "texplay.rb" do |t|
|
|
53
|
+
# cp t.prerequisites.first, t.name, :verbose => true
|
|
54
|
+
# end
|
|
84
55
|
|
|
85
|
-
file "#{SELENE}/lib/
|
|
86
|
-
|
|
87
|
-
end
|
|
56
|
+
# file "#{SELENE}/lib/texplay-contrib.rb" => "texplay-contrib.rb" do |t|
|
|
57
|
+
# cp t.prerequisites.first, t.name, :verbose => true
|
|
58
|
+
# end
|
|
59
|
+
|
|
60
|
+
# file "#{SELENE}/lib/ctexplay.#{$dlext}" => "ctexplay.#{$dlext}" do |t|
|
|
61
|
+
# cp t.prerequisites.first, t.name, :verbose => true
|
|
62
|
+
# end
|
data/examples/example_bezier.rb
CHANGED
|
@@ -15,7 +15,7 @@ class W < Gosu::Window
|
|
|
15
15
|
|
|
16
16
|
# NOTE: TexPlay also accepts points. a 'point' is any object that responds to 'x' or 'y'
|
|
17
17
|
# NOTE: current maximum points for a bezier is 13
|
|
18
|
-
(0..@img.width + 100).step(
|
|
18
|
+
(0..@img.width + 100).step(40) { |x|
|
|
19
19
|
p = TexPlay::TPPoint.new
|
|
20
20
|
p.x = x
|
|
21
21
|
p.y = @img.height * rand
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'common'
|
|
3
|
+
require 'gosu'
|
|
4
|
+
require 'texplay'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class W < Gosu::Window
|
|
8
|
+
def initialize
|
|
9
|
+
super(1024, 768, false, 20)
|
|
10
|
+
@img = Gosu::Image.new(self, "#{Common::MEDIA}/logo.png")
|
|
11
|
+
#@img.rect 0,0, @img.width - 1, @img.height - 1
|
|
12
|
+
@img2 = TexPlay::create_blank_image(self, @img.width, @img.height)
|
|
13
|
+
@img2.rect 0,0, 1000, 100, :fill => true
|
|
14
|
+
|
|
15
|
+
TexPlay::create_macro(:blur) do |*options|
|
|
16
|
+
options = options.first ? options.first : {}
|
|
17
|
+
|
|
18
|
+
radius = options[:blur_radius] || 1
|
|
19
|
+
|
|
20
|
+
self.each(options) { |c,x,y|
|
|
21
|
+
total = [0, 0, 0, 0]
|
|
22
|
+
for ky in (-radius..radius)
|
|
23
|
+
for kx in (-radius..radius)
|
|
24
|
+
v = get_pixel(x + kx, y + ky);
|
|
25
|
+
if v
|
|
26
|
+
total[0] += v[0]
|
|
27
|
+
total[1] += v[1]
|
|
28
|
+
total[2] += v[2]
|
|
29
|
+
total[3] += v[3]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
c[0] = total[0] / (radius * 2 + 1) ** 2
|
|
35
|
+
c[1] = total[1] / (radius * 2 + 1) ** 2
|
|
36
|
+
c[2] = total[2] / (radius * 2 + 1) ** 2
|
|
37
|
+
c[3] = total[3] / (radius * 2 + 1) ** 2
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
self
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
@img.blur :blur_radius => 4, :region => [0, 0, @img.width/2, @img.height]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def draw
|
|
47
|
+
x = @img.width * rand
|
|
48
|
+
y = @img.height * rand
|
|
49
|
+
|
|
50
|
+
@img2.draw 100, 50,1
|
|
51
|
+
@img.draw 100, 50,1
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
w = W.new
|
|
58
|
+
w.show
|
|
59
|
+
|
data/examples/example_dup.rb
CHANGED
|
@@ -32,7 +32,30 @@ class W < Gosu::Window
|
|
|
32
32
|
puts @bunk.little
|
|
33
33
|
|
|
34
34
|
# add a red line to the copy to identify it
|
|
35
|
-
|
|
35
|
+
#@bunk.line 0, 0, 1024, 1024, :color => :red
|
|
36
|
+
|
|
37
|
+
@bunk.each(:region =>[200,200,350,350]) { |c,x,y|
|
|
38
|
+
|
|
39
|
+
num_pixels = 0
|
|
40
|
+
total = [0, 0, 0, 0]
|
|
41
|
+
@bunk.circle x, y, 2,
|
|
42
|
+
:color_control => proc { |v|
|
|
43
|
+
if v
|
|
44
|
+
total[0] += v[0]
|
|
45
|
+
total[1] += v[1]
|
|
46
|
+
total[2] += v[2]
|
|
47
|
+
total[3] += v[3]
|
|
48
|
+
|
|
49
|
+
num_pixels += 1
|
|
50
|
+
end
|
|
51
|
+
:none
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
c[0] = total[0] / num_pixels.to_f
|
|
55
|
+
c[1] = total[1] / num_pixels.to_f
|
|
56
|
+
c[2] = total[2] / num_pixels.to_f
|
|
57
|
+
c[3] = total[3] / num_pixels.to_f
|
|
58
|
+
}
|
|
36
59
|
|
|
37
60
|
end
|
|
38
61
|
|
data/examples/example_lsystem.rb
CHANGED
|
@@ -10,6 +10,14 @@ Dragon = TexPlay::LSystem.new do
|
|
|
10
10
|
atom "FX"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
Koch = TexPlay::LSystem.new do
|
|
14
|
+
rule "F" => "F-F++F-F"
|
|
15
|
+
|
|
16
|
+
angle 60
|
|
17
|
+
|
|
18
|
+
atom "F"
|
|
19
|
+
end
|
|
20
|
+
|
|
13
21
|
Bush1 = TexPlay::LSystem.new do
|
|
14
22
|
rule "F" => "F[-F]F[+F][F]"
|
|
15
23
|
|
|
@@ -39,7 +47,7 @@ class W < Gosu::Window
|
|
|
39
47
|
def initialize
|
|
40
48
|
super(1024, 768, false, 20)
|
|
41
49
|
@img = TexPlay::create_blank_image(self, 500, 500)
|
|
42
|
-
@img.lsystem(
|
|
50
|
+
@img.lsystem(250, 250, Koch, :order => 8, :line_length => 10)
|
|
43
51
|
end
|
|
44
52
|
|
|
45
53
|
def draw
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'common'
|
|
3
|
+
require 'gosu'
|
|
4
|
+
require 'texplay'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class W < Gosu::Window
|
|
8
|
+
def initialize
|
|
9
|
+
super(1024, 768, false, 20)
|
|
10
|
+
@img = Gosu::Image.new(self, "#{Common::MEDIA}/logo.png")
|
|
11
|
+
#@img.rect 0,0, @img.width - 1, @img.height - 1
|
|
12
|
+
@img2 = TexPlay::create_blank_image(self, 500, 500)
|
|
13
|
+
#@img2.rect 0,0, 1000, 1000, :fill => true
|
|
14
|
+
|
|
15
|
+
TexPlay::create_macro(:splice_and_scale) do |img, cx, cy, *options|
|
|
16
|
+
options = options.first ? options.first : {}
|
|
17
|
+
|
|
18
|
+
options = {
|
|
19
|
+
:color_control => proc do |c1, c2, x, y|
|
|
20
|
+
factor = options[:factor] || 1
|
|
21
|
+
factor_x = options[:factor_x] || factor
|
|
22
|
+
factor_y = options[:factor_y] || factor
|
|
23
|
+
|
|
24
|
+
x = factor_x * (x - cx) + cx
|
|
25
|
+
y = factor_y * (y - cy) + cy
|
|
26
|
+
|
|
27
|
+
rect x, y, x + factor_x, y + factor_y, :color => c2, :fill => true
|
|
28
|
+
:none
|
|
29
|
+
end
|
|
30
|
+
}.merge!(options)
|
|
31
|
+
|
|
32
|
+
splice img, cx, cy, options
|
|
33
|
+
|
|
34
|
+
self
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@img2.splice_and_scale @img, 0, 50, :factor => 0.3, :factor_y => 4
|
|
39
|
+
@img2.splice @img, 0, 200
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def draw
|
|
43
|
+
x = @img.width * rand
|
|
44
|
+
y = @img.height * rand
|
|
45
|
+
|
|
46
|
+
@img2.draw 100, 100,1
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
w = W.new
|
|
53
|
+
w.show
|
|
54
|
+
|
|
Binary file
|
|
@@ -787,8 +787,8 @@ bezier_do_action(VALUE points, texture_info * tex, VALUE hash_arg, sync sync_mod
|
|
|
787
787
|
num_point_pairs = RARRAY_LEN(points) / 2;
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
-
if(num_point_pairs >
|
|
791
|
-
rb_raise(rb_eArgError, "too many points for bezier curve.
|
|
790
|
+
if(num_point_pairs > 17)
|
|
791
|
+
rb_raise(rb_eArgError, "too many points for bezier curve. 17 points is current maximum. got %d\n",
|
|
792
792
|
num_point_pairs);
|
|
793
793
|
|
|
794
794
|
/* get the first point */
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/{src → ext/texplay}/cache.c
RENAMED
|
@@ -30,7 +30,7 @@ cache_create_entry(int tname) {
|
|
|
30
30
|
if(cache.len >= CACHE_SIZE) { rb_raise(rb_eRuntimeError, "cache is full! increase CACHE_SIZE"); }
|
|
31
31
|
|
|
32
32
|
/* save current texture binding */
|
|
33
|
-
glGetIntegerv(GL_TEXTURE_BINDING_2D, &saved_tname);
|
|
33
|
+
/* glGetIntegerv(GL_TEXTURE_BINDING_2D, &saved_tname); */
|
|
34
34
|
|
|
35
35
|
/* opengl initialization code */
|
|
36
36
|
glEnable(GL_TEXTURE_2D);
|
|
@@ -54,7 +54,10 @@ cache_create_entry(int tname) {
|
|
|
54
54
|
cache.len++;
|
|
55
55
|
|
|
56
56
|
/* restore saved texture binding */
|
|
57
|
-
glBindTexture(GL_TEXTURE_2D, saved_tname);
|
|
57
|
+
/* glBindTexture(GL_TEXTURE_2D, saved_tname); */
|
|
58
|
+
|
|
59
|
+
glDisable(GL_TEXTURE_2D);
|
|
60
|
+
|
|
58
61
|
|
|
59
62
|
return &cache.entry[new_element];
|
|
60
63
|
}
|
data/{src → ext/texplay}/cache.h
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -11,11 +11,11 @@ elsif RUBY_PLATFORM =~ /darwin/
|
|
|
11
11
|
$CPPFLAGS += " -I/System/Library/Frameworks/GLUT.framework/Headers"
|
|
12
12
|
|
|
13
13
|
# windows
|
|
14
|
-
else
|
|
14
|
+
else
|
|
15
15
|
exit unless have_library("glut32")
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# 1.9 compatibility
|
|
19
19
|
$CPPFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /1.9/
|
|
20
20
|
|
|
21
|
-
create_makefile('
|
|
21
|
+
create_makefile('texplay')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/{src → ext/texplay}/utils.c
RENAMED
|
@@ -793,6 +793,8 @@ sync_to_gl(int tex_name, int x_offset, int y_offset, int width, int height, void
|
|
|
793
793
|
/* sync subtexture */
|
|
794
794
|
glTexSubImage2D(GL_TEXTURE_2D, 0, x_offset, y_offset, width, height,
|
|
795
795
|
GL_RGBA, GL_FLOAT, sub);
|
|
796
|
+
|
|
797
|
+
glDisable(GL_TEXTURE_2D);
|
|
796
798
|
}
|
|
797
799
|
|
|
798
800
|
void
|
|
@@ -948,21 +950,22 @@ fact(int n)
|
|
|
948
950
|
unsigned
|
|
949
951
|
comb(int n, int r)
|
|
950
952
|
{
|
|
951
|
-
double temp = fact(n) / (fact(r) * fact(n - r));
|
|
952
|
-
return temp;
|
|
953
|
-
|
|
953
|
+
/* double temp = fact(n) / (fact(r) * fact(n - r)); */
|
|
954
|
+
/* return temp; */
|
|
955
|
+
|
|
956
|
+
/* nCr is symmetrical about n / 2 */
|
|
957
|
+
if(r > (n / 2))
|
|
954
958
|
r = n - r;
|
|
955
959
|
|
|
956
960
|
return perm(n, r) / fact(r);
|
|
957
|
-
*/
|
|
958
961
|
}
|
|
959
962
|
|
|
960
963
|
unsigned
|
|
961
964
|
perm(int n, int r)
|
|
962
965
|
{
|
|
963
|
-
int val =
|
|
966
|
+
int val = 1;
|
|
964
967
|
int i;
|
|
965
|
-
for(i = n
|
|
968
|
+
for(i = n; i > (n - r); i--)
|
|
966
969
|
val *= i;
|
|
967
970
|
|
|
968
971
|
return val;
|
|
@@ -971,6 +974,6 @@ perm(int n, int r)
|
|
|
971
974
|
double
|
|
972
975
|
bernstein(int n, int k, float u)
|
|
973
976
|
{
|
|
974
|
-
double temp = comb(n, k) * pow(u, k) *
|
|
977
|
+
double temp = comb(n, k) * pow(u, k) * pow(1 - u, n - k);
|
|
975
978
|
return temp;
|
|
976
979
|
}
|
data/{src → ext/texplay}/utils.h
RENAMED
|
File without changes
|
data/lib/texplay-contrib.rb
CHANGED
|
@@ -79,47 +79,44 @@ TexPlay::create_macro(:forward) do |dist, *other|
|
|
|
79
79
|
}
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def initialize(&block)
|
|
88
|
-
@rules = {}
|
|
89
|
-
|
|
90
|
-
instance_eval(&block) if block
|
|
91
|
-
end
|
|
82
|
+
# L-System code
|
|
83
|
+
# adding LSystem class to TexPlay module
|
|
84
|
+
class TexPlay::LSystem
|
|
85
|
+
def initialize(&block)
|
|
86
|
+
@rules = {}
|
|
92
87
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
instance_eval(&block) if block
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def rule(new_rule)
|
|
92
|
+
@rules.merge!(new_rule)
|
|
93
|
+
end
|
|
96
94
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
def atom(new_atom)
|
|
96
|
+
@atom = new_atom
|
|
97
|
+
end
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
def angle(new_angle=nil)
|
|
100
|
+
return @angle if !new_angle
|
|
101
|
+
@angle = new_angle
|
|
102
|
+
end
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
end
|
|
104
|
+
def produce_string(order)
|
|
105
|
+
order = order[:order]
|
|
106
|
+
string = @atom.dup
|
|
107
|
+
|
|
108
|
+
order.times do
|
|
109
|
+
i = 0
|
|
110
|
+
while(i < string.length)
|
|
111
|
+
sub = @rules[string[i, 1]]
|
|
112
|
+
|
|
113
|
+
string[i] = sub if sub
|
|
114
|
+
|
|
115
|
+
i += sub ? sub.length : 1
|
|
119
116
|
end
|
|
120
|
-
|
|
121
|
-
string
|
|
122
117
|
end
|
|
118
|
+
|
|
119
|
+
string
|
|
123
120
|
end
|
|
124
121
|
end
|
|
125
122
|
|
|
@@ -148,3 +145,27 @@ TexPlay::create_macro(:lsystem) do |x, y, system, options|
|
|
|
148
145
|
end
|
|
149
146
|
}
|
|
150
147
|
end
|
|
148
|
+
|
|
149
|
+
# Scaling
|
|
150
|
+
# uses nearest-neighbour
|
|
151
|
+
TexPlay::create_macro(:splice_and_scale) do |img, cx, cy, *options|
|
|
152
|
+
options = options.first ? options.first : {}
|
|
153
|
+
|
|
154
|
+
options = {
|
|
155
|
+
:color_control => proc do |c1, c2, x, y|
|
|
156
|
+
factor = options[:factor] || 1
|
|
157
|
+
factor_x = options[:factor_x] || factor
|
|
158
|
+
factor_y = options[:factor_y] || factor
|
|
159
|
+
|
|
160
|
+
x = factor_x * (x - cx) + cx
|
|
161
|
+
y = factor_y * (y - cy) + cy
|
|
162
|
+
|
|
163
|
+
rect x, y, x + factor_x, y + factor_y, :color => c2, :fill => true
|
|
164
|
+
:none
|
|
165
|
+
end
|
|
166
|
+
}.merge!(options)
|
|
167
|
+
|
|
168
|
+
splice img, cx, cy, options
|
|
169
|
+
|
|
170
|
+
self
|
|
171
|
+
end
|
data/lib/texplay.rb
CHANGED
|
@@ -10,7 +10,7 @@ require 'rbconfig'
|
|
|
10
10
|
require 'gosu'
|
|
11
11
|
|
|
12
12
|
module TexPlay
|
|
13
|
-
TEXPLAY_VERSION = "0.2.
|
|
13
|
+
TEXPLAY_VERSION = "0.2.5"
|
|
14
14
|
|
|
15
15
|
def self::on_setup(&block)
|
|
16
16
|
raise "need a block" if !block
|
|
@@ -74,12 +74,12 @@ direc = File.dirname(__FILE__)
|
|
|
74
74
|
dlext = Config::CONFIG['DLEXT']
|
|
75
75
|
begin
|
|
76
76
|
if RUBY_VERSION && RUBY_VERSION =~ /1.9/
|
|
77
|
-
require "#{direc}/
|
|
77
|
+
require "#{direc}/1.9/texplay.#{dlext}"
|
|
78
78
|
else
|
|
79
|
-
require "#{direc}/
|
|
79
|
+
require "#{direc}/1.8/texplay.#{dlext}"
|
|
80
80
|
end
|
|
81
81
|
rescue LoadError => e
|
|
82
|
-
require "#{direc}/
|
|
82
|
+
require "#{direc}/texplay.#{dlext}"
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
require "#{direc}/texplay-contrib"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: texplay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Mair (banisterfiend)
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-10-05 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -27,7 +27,7 @@ email: jrmair@gmail.com
|
|
|
27
27
|
executables: []
|
|
28
28
|
|
|
29
29
|
extensions:
|
|
30
|
-
-
|
|
30
|
+
- ext/texplay/extconf.rb
|
|
31
31
|
extra_rdoc_files: []
|
|
32
32
|
|
|
33
33
|
files:
|
|
@@ -36,24 +36,22 @@ files:
|
|
|
36
36
|
- CHANGELOG
|
|
37
37
|
- lib/texplay.rb
|
|
38
38
|
- lib/texplay-contrib.rb
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
- src/gen_eval.c
|
|
56
|
-
- src/cache.c
|
|
39
|
+
- ext/texplay/extconf.rb
|
|
40
|
+
- ext/texplay/object2module.h
|
|
41
|
+
- ext/texplay/bindings.h
|
|
42
|
+
- ext/texplay/utils.h
|
|
43
|
+
- ext/texplay/actions.h
|
|
44
|
+
- ext/texplay/compat.h
|
|
45
|
+
- ext/texplay/cache.h
|
|
46
|
+
- ext/texplay/texplay.h
|
|
47
|
+
- ext/texplay/gen_eval.h
|
|
48
|
+
- ext/texplay/texplay.c
|
|
49
|
+
- ext/texplay/actions.c
|
|
50
|
+
- ext/texplay/object2module.c
|
|
51
|
+
- ext/texplay/utils.c
|
|
52
|
+
- ext/texplay/bindings.c
|
|
53
|
+
- ext/texplay/gen_eval.c
|
|
54
|
+
- ext/texplay/cache.c
|
|
57
55
|
- examples/example_dup.rb
|
|
58
56
|
- examples/example_turtle.rb
|
|
59
57
|
- examples/example_color_control.rb
|
|
@@ -67,6 +65,7 @@ files:
|
|
|
67
65
|
- examples/example_bezier.rb
|
|
68
66
|
- examples/example_simple.rb
|
|
69
67
|
- examples/example_fill_old.rb
|
|
68
|
+
- examples/example_blur.rb
|
|
70
69
|
- examples/example_each.rb
|
|
71
70
|
- examples/example_fluent.rb
|
|
72
71
|
- examples/example_sync.rb
|
|
@@ -74,15 +73,19 @@ files:
|
|
|
74
73
|
- examples/example_alpha_blend.rb
|
|
75
74
|
- examples/example_melt.rb
|
|
76
75
|
- examples/example_lsystem.rb
|
|
76
|
+
- examples/example_scale.rb
|
|
77
77
|
- examples/media/sand1.png
|
|
78
78
|
- examples/media/rose.bmp
|
|
79
79
|
- examples/media/maria.png
|
|
80
80
|
- examples/media/sunset.png
|
|
81
81
|
- examples/media/texplay.png
|
|
82
82
|
- examples/media/gosu.png
|
|
83
|
+
- examples/media/logo.png
|
|
83
84
|
- examples/media/empty2.png
|
|
84
|
-
has_rdoc:
|
|
85
|
+
has_rdoc: true
|
|
85
86
|
homepage: http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/
|
|
87
|
+
licenses: []
|
|
88
|
+
|
|
86
89
|
post_install_message:
|
|
87
90
|
rdoc_options: []
|
|
88
91
|
|
|
@@ -103,9 +106,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
106
|
requirements: []
|
|
104
107
|
|
|
105
108
|
rubyforge_project:
|
|
106
|
-
rubygems_version: 1.3.
|
|
109
|
+
rubygems_version: 1.3.5
|
|
107
110
|
signing_key:
|
|
108
|
-
specification_version:
|
|
111
|
+
specification_version: 3
|
|
109
112
|
summary: TexPlay is a light-weight image manipulation framework for Ruby and Gosu
|
|
110
113
|
test_files: []
|
|
111
114
|
|
data/src/Makefile
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
SHELL = /bin/sh
|
|
3
|
-
|
|
4
|
-
#### Start of system configuration section. ####
|
|
5
|
-
|
|
6
|
-
srcdir = .
|
|
7
|
-
topdir = /usr/local/include/ruby19-1.9.1
|
|
8
|
-
hdrdir = /usr/local/include/ruby19-1.9.1
|
|
9
|
-
arch_hdrdir = /usr/local/include/ruby19-1.9.1/$(arch)
|
|
10
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
|
11
|
-
prefix = $(DESTDIR)/usr/local
|
|
12
|
-
exec_prefix = $(prefix)
|
|
13
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
|
14
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
|
15
|
-
rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
|
|
16
|
-
vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
|
|
17
|
-
sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
|
|
18
|
-
mandir = $(datarootdir)/man
|
|
19
|
-
localedir = $(datarootdir)/locale
|
|
20
|
-
libdir = $(exec_prefix)/lib
|
|
21
|
-
psdir = $(docdir)
|
|
22
|
-
pdfdir = $(docdir)
|
|
23
|
-
dvidir = $(docdir)
|
|
24
|
-
htmldir = $(docdir)
|
|
25
|
-
infodir = $(datarootdir)/info
|
|
26
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
|
27
|
-
oldincludedir = $(DESTDIR)/usr/include
|
|
28
|
-
includedir = $(prefix)/include
|
|
29
|
-
localstatedir = $(prefix)/var
|
|
30
|
-
sharedstatedir = $(prefix)/com
|
|
31
|
-
sysconfdir = $(prefix)/etc
|
|
32
|
-
datadir = $(datarootdir)
|
|
33
|
-
datarootdir = $(prefix)/share
|
|
34
|
-
libexecdir = $(exec_prefix)/libexec
|
|
35
|
-
sbindir = $(exec_prefix)/sbin
|
|
36
|
-
bindir = $(exec_prefix)/bin
|
|
37
|
-
rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
|
|
38
|
-
archdir = $(rubylibdir)/$(arch)
|
|
39
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
|
40
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
|
41
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
|
42
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
|
43
|
-
|
|
44
|
-
CC = gcc
|
|
45
|
-
CXX = g++
|
|
46
|
-
LIBRUBY = $(LIBRUBY_A)
|
|
47
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
|
48
|
-
LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
|
|
49
|
-
LIBRUBYARG_STATIC = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
|
50
|
-
OUTFLAG = -o
|
|
51
|
-
COUTFLAG = -o
|
|
52
|
-
|
|
53
|
-
RUBY_EXTCONF_H =
|
|
54
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
|
55
|
-
optflags = -O2
|
|
56
|
-
debugflags = -g
|
|
57
|
-
warnflags = -Wall -Wno-parentheses
|
|
58
|
-
CFLAGS = -fPIC $(cflags)
|
|
59
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
|
60
|
-
DEFS = -D_FILE_OFFSET_BITS=64
|
|
61
|
-
CPPFLAGS = $(DEFS) $(cppflags) -DRUBY_19
|
|
62
|
-
CXXFLAGS = $(CFLAGS) $(cxxflags)
|
|
63
|
-
ldflags = -L. -rdynamic -Wl,-export-dynamic
|
|
64
|
-
dldflags =
|
|
65
|
-
archflag =
|
|
66
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
|
67
|
-
LDSHARED = $(CC) -shared
|
|
68
|
-
LDSHAREDXX = $(CXX) -shared
|
|
69
|
-
AR = ar
|
|
70
|
-
EXEEXT =
|
|
71
|
-
|
|
72
|
-
RUBY_INSTALL_NAME = ruby19
|
|
73
|
-
RUBY_SO_NAME = ruby19
|
|
74
|
-
arch = i686-linux
|
|
75
|
-
sitearch = i686-linux
|
|
76
|
-
ruby_version = 1.9.1
|
|
77
|
-
ruby = /usr/local/bin/ruby19
|
|
78
|
-
RUBY = $(ruby)
|
|
79
|
-
RM = rm -f
|
|
80
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
|
81
|
-
RMDIRS = $(RUBY) -run -e rmdir -- -p
|
|
82
|
-
MAKEDIRS = mkdir -p
|
|
83
|
-
INSTALL = /usr/bin/install -c
|
|
84
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
|
85
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
|
86
|
-
COPY = cp
|
|
87
|
-
|
|
88
|
-
#### End of system configuration section. ####
|
|
89
|
-
|
|
90
|
-
preload =
|
|
91
|
-
|
|
92
|
-
libpath = . $(libdir)
|
|
93
|
-
LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
|
|
94
|
-
DEFFILE =
|
|
95
|
-
|
|
96
|
-
CLEANFILES = mkmf.log
|
|
97
|
-
DISTCLEANFILES =
|
|
98
|
-
DISTCLEANDIRS =
|
|
99
|
-
|
|
100
|
-
extout =
|
|
101
|
-
extout_prefix =
|
|
102
|
-
target_prefix =
|
|
103
|
-
LOCAL_LIBS =
|
|
104
|
-
LIBS = -lglut -lpthread -lrt -ldl -lcrypt -lm -lc
|
|
105
|
-
SRCS = texplay.c actions.c object2module.c utils.c bindings.c gen_eval.c cache.c
|
|
106
|
-
OBJS = texplay.o actions.o object2module.o utils.o bindings.o gen_eval.o cache.o
|
|
107
|
-
TARGET = ctexplay
|
|
108
|
-
DLLIB = $(TARGET).so
|
|
109
|
-
EXTSTATIC =
|
|
110
|
-
STATIC_LIB =
|
|
111
|
-
|
|
112
|
-
BINDIR = $(bindir)
|
|
113
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
|
114
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
|
115
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
|
116
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
|
117
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
|
118
|
-
|
|
119
|
-
TARGET_SO = $(DLLIB)
|
|
120
|
-
CLEANLIBS = $(TARGET).so
|
|
121
|
-
CLEANOBJS = *.o *.bak
|
|
122
|
-
|
|
123
|
-
all: $(DLLIB)
|
|
124
|
-
static: $(STATIC_LIB)
|
|
125
|
-
|
|
126
|
-
clean-rb-default::
|
|
127
|
-
clean-rb::
|
|
128
|
-
clean-so::
|
|
129
|
-
clean: clean-so clean-rb-default clean-rb
|
|
130
|
-
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
|
131
|
-
|
|
132
|
-
distclean-rb-default::
|
|
133
|
-
distclean-rb::
|
|
134
|
-
distclean-so::
|
|
135
|
-
distclean: clean distclean-so distclean-rb-default distclean-rb
|
|
136
|
-
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
|
137
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
|
138
|
-
@-$(RMDIRS) $(DISTCLEANDIRS)
|
|
139
|
-
|
|
140
|
-
realclean: distclean
|
|
141
|
-
install: install-so install-rb
|
|
142
|
-
|
|
143
|
-
install-so: $(RUBYARCHDIR)
|
|
144
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
|
145
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
|
146
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
|
147
|
-
install-rb: pre-install-rb install-rb-default
|
|
148
|
-
install-rb-default: pre-install-rb-default
|
|
149
|
-
pre-install-rb: Makefile
|
|
150
|
-
pre-install-rb-default: Makefile
|
|
151
|
-
$(RUBYARCHDIR):
|
|
152
|
-
$(MAKEDIRS) $@
|
|
153
|
-
|
|
154
|
-
site-install: site-install-so site-install-rb
|
|
155
|
-
site-install-so: install-so
|
|
156
|
-
site-install-rb: install-rb
|
|
157
|
-
|
|
158
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
|
159
|
-
|
|
160
|
-
.cc.o:
|
|
161
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
|
162
|
-
|
|
163
|
-
.cxx.o:
|
|
164
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
|
165
|
-
|
|
166
|
-
.cpp.o:
|
|
167
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
|
168
|
-
|
|
169
|
-
.C.o:
|
|
170
|
-
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
|
171
|
-
|
|
172
|
-
.c.o:
|
|
173
|
-
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
|
174
|
-
|
|
175
|
-
$(DLLIB): $(OBJS) Makefile
|
|
176
|
-
@-$(RM) $(@)
|
|
177
|
-
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|
data/src/TAGS
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
actions.c,3564
|
|
3
|
-
do_sync(action_struct * cur, texture_info * tex) do_sync34,1286
|
|
4
|
-
line_do_action(int x1, int y1, int x2, int y2, texture_info * tex, VALUE hash_arg,line_do_action44,1509
|
|
5
|
-
#define SIMPLE_FORMAT SIMPLE_FORMAT126,3531
|
|
6
|
-
#define POINT_FORMAT POINT_FORMAT127,3555
|
|
7
|
-
polyline_point(VALUE points, int k, int * x, int * y, int format, int draw_offset_x,polyline_point131,3622
|
|
8
|
-
polyline_do_action(VALUE points, texture_info * tex, VALUE hash_arg,polyline_do_action154,4324
|
|
9
|
-
ngon_do_action(int x, int y, int r, int num_sides, texture_info * tex, VALUE hash_arg,ngon_do_action231,6780
|
|
10
|
-
rect_do_action(int x1, int y1, int x2, int y2, texture_info * tex, VALUE hash_arg,rect_do_action275,8056
|
|
11
|
-
circle_do_action(int x1, int y1, int r, texture_info * tex, VALUE hash_arg,circle_do_action329,9856
|
|
12
|
-
pixel_do_action(int x1, int y1, texture_info * tex, VALUE hash_arg,pixel_do_action403,12271
|
|
13
|
-
typedef struct { int x1, x2, y, dy; } LINESEGMENT;x1417,12704
|
|
14
|
-
typedef struct { int x1, x2, y, dy; } LINESEGMENT;x2417,12704
|
|
15
|
-
typedef struct { int x1, x2, y, dy; } LINESEGMENT;y417,12704
|
|
16
|
-
typedef struct { int x1, x2, y, dy; } LINESEGMENT;dy417,12704
|
|
17
|
-
typedef struct { int x1, x2, y, dy; } LINESEGMENT;LINESEGMENT417,12704
|
|
18
|
-
#define MAXDEPTH MAXDEPTH419,12756
|
|
19
|
-
#define PUSH(PUSH421,12780
|
|
20
|
-
#define POP(POP425,12997
|
|
21
|
-
flood_fill_do_action(int x, int y, texture_info * tex, VALUE hash_arg,flood_fill_do_action429,13142
|
|
22
|
-
glow_floodFill( int x, int y, rgba * seed_color, action_struct * cur, texture_info * tex, texture_info * tex2 )glow_floodFill498,15194
|
|
23
|
-
glow_fill_do_action(int x, int y, texture_info * tex, VALUE hash_arg,glow_fill_do_action552,17088
|
|
24
|
-
#define stackSize stackSize586,18167
|
|
25
|
-
int stack[stackSize];stack587,18194
|
|
26
|
-
int stackPointer;stackPointer588,18216
|
|
27
|
-
pop(int * x, int * y, int h) pop591,18247
|
|
28
|
-
push(int x, int y, int h) push608,18559
|
|
29
|
-
emptyStack() emptyStack623,18834
|
|
30
|
-
scan_fill_do_action(int x, int y, texture_info * tex, VALUE hash_arg,scan_fill_do_action630,18902
|
|
31
|
-
bezier_point(VALUE points, float u, float * x, float * y, int n, int format,bezier_point700,21601
|
|
32
|
-
bezier_do_action(VALUE points, texture_info * tex, VALUE hash_arg, sync sync_mode,bezier_do_action731,22561
|
|
33
|
-
set_color_array(VALUE ary, rgba * color)set_color_array831,25683
|
|
34
|
-
each_pixel_do_action(int x1, int y1, int x2, int y2, VALUE proc, texture_info * tex, VALUE hash_arg,each_pixel_do_action840,25963
|
|
35
|
-
splice_do_action(int x0, int y0, int cx1, int cy1, int cx2, int cy2, texture_info * splice_tex,splice_do_action869,26797
|
|
36
|
-
process_common_hash_args(action_struct * cur, VALUE * hash_arg, sync sync_mode, bool primary)process_common_hash_args940,29218
|
|
37
|
-
update_lazy_bounds(action_struct * cur, texture_info * tex)update_lazy_bounds1021,32185
|
|
38
|
-
update_bounds(action_struct * cur, int xmin, int ymin, int xmax, int ymax)update_bounds1044,33016
|
|
39
|
-
set_local_bounds(action_struct * cur, int xmin, int ymin, int xmax, int ymax, texture_info * tex)set_local_bounds1056,33341
|
|
40
|
-
draw_prologue(action_struct * cur, texture_info * tex, int xmin, int ymin, int xmax, int ymax,draw_prologue1072,33773
|
|
41
|
-
draw_epilogue(action_struct * cur, texture_info * tex, bool primary)draw_epilogue1089,34284
|
|
42
|
-
prepare_color_control(action_struct * cur)prepare_color_control1119,34991
|
|
43
|
-
exec_color_control_proc(action_struct * cur, texture_info * tex, int x, int y)exec_color_control_proc1135,35475
|
|
44
|
-
prepare_fill_texture(action_struct * payload)prepare_fill_texture1179,37313
|
|
45
|
-
set_pixel_color_with_style(action_struct * payload, texture_info * tex, int x, int y)set_pixel_color_with_style1195,37707
|
|
46
|
-
|
|
47
|
-
actions.h,45
|
|
48
|
-
#define GUARD_ACTIONS_HGUARD_ACTIONS_H2,24
|
|
49
|
-
|
|
50
|
-
bindings.c,2070
|
|
51
|
-
sync sync_mode = eager_sync;sync_mode31,585
|
|
52
|
-
process_x_y_pairs(VALUE image, int num_pairs, VALUE * argv, ...)process_x_y_pairs34,627
|
|
53
|
-
M_create_macro(VALUE self, VALUE method_name) M_create_macro78,1755
|
|
54
|
-
M_remove_macro(VALUE self, VALUE method_name) M_remove_macro96,2138
|
|
55
|
-
M_refresh_cache_all(VALUE self) M_refresh_cache_all107,2385
|
|
56
|
-
M_create_blank(VALUE self, VALUE window, VALUE width, VALUE height)M_create_blank116,2500
|
|
57
|
-
rb_lazy_bounds_to_image_bounds(VALUE image, image_bounds * bounds)rb_lazy_bounds_to_image_bounds128,2767
|
|
58
|
-
parse_sync_mode(VALUE user_sync_mode)parse_sync_mode143,3223
|
|
59
|
-
m_paint(int argc, VALUE * argv, VALUE self) m_paint166,3853
|
|
60
|
-
m_force_sync(VALUE self, VALUE ary)m_force_sync239,5754
|
|
61
|
-
m_dup_image(VALUE self)m_dup_image261,6219
|
|
62
|
-
m_clone_image(VALUE self)m_clone_image290,7033
|
|
63
|
-
m_user_set_options(VALUE self, VALUE options)m_user_set_options305,7329
|
|
64
|
-
m_user_delete_options(VALUE self)m_user_delete_options318,7587
|
|
65
|
-
m_get_options(VALUE self)m_get_options329,7723
|
|
66
|
-
m_getpixel(int argc, VALUE * argv, VALUE self) m_getpixel338,7882
|
|
67
|
-
m_circle(int argc, VALUE * argv, VALUE self) m_circle363,8384
|
|
68
|
-
m_ngon(int argc, VALUE * argv, VALUE self)m_ngon392,8958
|
|
69
|
-
m_flood_fill(int argc, VALUE * argv, VALUE self)m_flood_fill420,9519
|
|
70
|
-
m_line(int argc, VALUE * argv, VALUE self) m_line463,10488
|
|
71
|
-
m_rect(int argc, VALUE * argv, VALUE self) m_rect487,10973
|
|
72
|
-
m_pixel(int argc, VALUE * argv, VALUE self) m_pixel513,11463
|
|
73
|
-
m_bezier(int argc, VALUE * argv, VALUE self)m_bezier537,11925
|
|
74
|
-
m_polyline(int argc, VALUE * argv, VALUE self)m_polyline563,12455
|
|
75
|
-
m_splice(int argc, VALUE * argv, VALUE self) m_splice591,12982
|
|
76
|
-
m_clear(int argc, VALUE * argv, VALUE self) m_clear638,14314
|
|
77
|
-
m_offset(int argc, VALUE * argv, VALUE self) m_offset654,14599
|
|
78
|
-
m_color(int argc, VALUE * argv, VALUE self) m_color688,15349
|
|
79
|
-
m_missing(int argc, VALUE * argv, VALUE self) m_missing718,16182
|
|
80
|
-
m_cache_refresh(VALUE self) m_cache_refresh736,16672
|
|
81
|
-
m_quad_cached(VALUE self) m_quad_cached751,16895
|
|
82
|
-
m_each(int argc, VALUE * argv, VALUE self)m_each777,17450
|
|
83
|
-
|
|
84
|
-
bindings.h,47
|
|
85
|
-
#define GUARD_BINDINGS_HGUARD_BINDINGS_H2,25
|
|
86
|
-
|
|
87
|
-
cache.c,338
|
|
88
|
-
static cache_t cache = {0}; cache16,219
|
|
89
|
-
cache_create_entry(int tname) {cache_create_entry20,293
|
|
90
|
-
find_in_cache(int tname) {find_in_cache59,1556
|
|
91
|
-
find_or_create_cache_entry(int tname) {find_or_create_cache_entry73,1908
|
|
92
|
-
cache_refresh_all(void) {cache_refresh_all84,2130
|
|
93
|
-
cache_refresh_entry(int tname) {cache_refresh_entry109,2794
|
|
94
|
-
|
|
95
|
-
cache.h,350
|
|
96
|
-
#define GUARD_CACHE_HGUARD_CACHE_H5,71
|
|
97
|
-
#define CACHE_SIZE CACHE_SIZE8,108
|
|
98
|
-
int tname;tname12,167
|
|
99
|
-
int sidelength;sidelength13,182
|
|
100
|
-
float * tdata;tdata14,202
|
|
101
|
-
} cache_entry;cache_entry15,221
|
|
102
|
-
int len;len18,254
|
|
103
|
-
cache_entry entry[CACHE_SIZE]; entry19,267
|
|
104
|
-
} cache_t;cache_t20,344
|
|
105
|
-
|
|
106
|
-
compat.h,241
|
|
107
|
-
#define GUARD_COMPAT_HGUARD_COMPAT_H4,102
|
|
108
|
-
# define RUBY_19RUBY_1910,218
|
|
109
|
-
# define RCLASS_M_TBL(RCLASS_M_TBL15,309
|
|
110
|
-
# define RCLASS_SUPER(RCLASS_SUPER16,353
|
|
111
|
-
# define RCLASS_IV_TBL(RCLASS_IV_TBL17,397
|
|
112
|
-
#define KLASS_OF(KLASS_OF21,534
|
|
113
|
-
|
|
114
|
-
gen_eval.c,444
|
|
115
|
-
retrieve_hidden_self(VALUE duped_context)retrieve_hidden_self11,247
|
|
116
|
-
set_hidden_self(VALUE duped_context, VALUE hidden_self)set_hidden_self25,652
|
|
117
|
-
rb_capture(VALUE self) {rb_capture38,1103
|
|
118
|
-
redirect_iv_for_object(VALUE obj, VALUE dest)redirect_iv_for_object59,1553
|
|
119
|
-
release_iv_for_object(VALUE obj)release_iv_for_object79,2305
|
|
120
|
-
rb_gen_eval(int argc, VALUE * argv, VALUE self) {rb_gen_eval93,2658
|
|
121
|
-
Init_gen_eval() {Init_gen_eval185,5307
|
|
122
|
-
|
|
123
|
-
gen_eval.h,87
|
|
124
|
-
#define GUARD_GEN_EVAL_HGUARD_GEN_EVAL_H4,43
|
|
125
|
-
#define ADJUST_SELF(ADJUST_SELF14,345
|
|
126
|
-
|
|
127
|
-
object2module.c,410
|
|
128
|
-
class_alloc(VALUE flags, VALUE klass)class_alloc18,359
|
|
129
|
-
j_class_new(VALUE module, VALUE sup)j_class_new34,752
|
|
130
|
-
rb_to_module(VALUE self)rb_to_module81,1735
|
|
131
|
-
rb_reset_tbls(VALUE self)rb_reset_tbls115,2493
|
|
132
|
-
rb_gen_extend(int argc, VALUE * argv, VALUE self)rb_gen_extend124,2738
|
|
133
|
-
rb_gen_include(int argc, VALUE * argv, VALUE self)rb_gen_include145,3259
|
|
134
|
-
void Init_object2module()Init_object2module163,3696
|
|
135
|
-
|
|
136
|
-
object2module.h,57
|
|
137
|
-
#define GUARD_OBJECT2MODULE_HGUARD_OBJECT2MODULE_H4,53
|
|
138
|
-
|
|
139
|
-
texplay.c,410
|
|
140
|
-
Init_ctexplay() {Init_ctexplay29,843
|
|
141
|
-
m_init_TPPoint(int argc, VALUE * argv, VALUE self)m_init_TPPoint133,5456
|
|
142
|
-
m_init_EmptyImageStub(int argc, VALUE * argv, VALUE self)m_init_EmptyImageStub157,6066
|
|
143
|
-
m_EmptyImageStub_columns(VALUE self)m_EmptyImageStub_columns176,6583
|
|
144
|
-
m_EmptyImageStub_rows(VALUE self)m_EmptyImageStub_rows182,6672
|
|
145
|
-
m_EmptyImageStub_to_blob(VALUE self)m_EmptyImageStub_to_blob188,6758
|
|
146
|
-
|
|
147
|
-
texplay.h,2622
|
|
148
|
-
#define GUARD_TEXPLAY_HGUARD_TEXPLAY_H8,201
|
|
149
|
-
#define OOB_VAL OOB_VAL13,260
|
|
150
|
-
#define XMAX_OOB XMAX_OOB14,281
|
|
151
|
-
#define YMAX_OOB YMAX_OOB15,306
|
|
152
|
-
#define XMIN_OOB XMIN_OOB16,331
|
|
153
|
-
#define YMIN_OOB YMIN_OOB17,357
|
|
154
|
-
#define PI PI19,384
|
|
155
|
-
#define SWAP(SWAP22,426
|
|
156
|
-
#define ROUND(ROUND23,485
|
|
157
|
-
#define ARY_SIZE(ARY_SIZE24,519
|
|
158
|
-
#define SGN(SGN25,562
|
|
159
|
-
#define MAX(MAX26,597
|
|
160
|
-
#define MIN(MIN27,638
|
|
161
|
-
#define ABS(ABS28,680
|
|
162
|
-
typedef enum e_bool {e_bool31,732
|
|
163
|
-
false, truefalse32,754
|
|
164
|
-
false, truetrue32,754
|
|
165
|
-
} bool;bool33,770
|
|
166
|
-
typedef enum e_color {e_color35,779
|
|
167
|
-
red, green, blue, alphared36,802
|
|
168
|
-
red, green, blue, alphagreen36,802
|
|
169
|
-
red, green, blue, alphablue36,802
|
|
170
|
-
red, green, blue, alphaalpha36,802
|
|
171
|
-
} color_t;color_t37,830
|
|
172
|
-
typedef enum e_sync_mode {e_sync_mode39,842
|
|
173
|
-
lazy_sync, eager_sync, no_synclazy_sync40,869
|
|
174
|
-
lazy_sync, eager_sync, no_synceager_sync40,869
|
|
175
|
-
lazy_sync, eager_sync, no_syncno_sync40,869
|
|
176
|
-
} sync;sync41,904
|
|
177
|
-
typedef struct s_rgba {s_rgba44,927
|
|
178
|
-
float red, green, blue, alpha;red45,951
|
|
179
|
-
float red, green, blue, alpha;green45,951
|
|
180
|
-
float red, green, blue, alpha;blue45,951
|
|
181
|
-
float red, green, blue, alpha;alpha45,951
|
|
182
|
-
} rgba;rgba46,986
|
|
183
|
-
int width, height; width50,1036
|
|
184
|
-
int width, height; height50,1036
|
|
185
|
-
float top, left; top51,1063
|
|
186
|
-
float top, left; left51,1063
|
|
187
|
-
int tname;tname52,1088
|
|
188
|
-
float * td_array;td_array53,1103
|
|
189
|
-
int yincr, firstpixel;yincr54,1125
|
|
190
|
-
int yincr, firstpixel;firstpixel54,1125
|
|
191
|
-
int x_offset, y_offset;x_offset55,1152
|
|
192
|
-
int x_offset, y_offset;y_offset55,1152
|
|
193
|
-
VALUE image;image56,1180
|
|
194
|
-
} texture_info;texture_info57,1197
|
|
195
|
-
#define IMAGE_BOUNDS(IMAGE_BOUNDS61,1239
|
|
196
|
-
int xmin;xmin63,1303
|
|
197
|
-
int ymin;ymin64,1317
|
|
198
|
-
int xmax;xmax65,1331
|
|
199
|
-
int ymax;ymax66,1345
|
|
200
|
-
} image_bounds;image_bounds67,1359
|
|
201
|
-
typedef struct action_struct {action_struct69,1376
|
|
202
|
-
int xmin, ymin, xmax, ymax;xmin70,1407
|
|
203
|
-
int xmin, ymin, xmax, ymax;ymin70,1407
|
|
204
|
-
int xmin, ymin, xmax, ymax;xmax70,1407
|
|
205
|
-
int xmin, ymin, xmax, ymax;ymax70,1407
|
|
206
|
-
rgba color;color71,1439
|
|
207
|
-
sync sync_mode;sync_mode72,1455
|
|
208
|
-
VALUE color_control_proc;color_control_proc75,1504
|
|
209
|
-
bool has_color_control_proc;has_color_control_proc76,1534
|
|
210
|
-
int color_control_arity;color_control_arity77,1567
|
|
211
|
-
texture_info source_tex;source_tex80,1620
|
|
212
|
-
bool has_source_texture;has_source_texture81,1649
|
|
213
|
-
bool alpha_blend;alpha_blend84,1701
|
|
214
|
-
texture_info * tex;tex89,1880
|
|
215
|
-
VALUE hash_arg;hash_arg91,1909
|
|
216
|
-
} action_struct;action_struct92,1929
|
|
217
|
-
|
|
218
|
-
utils.c,4100
|
|
219
|
-
static const rgba not_a_color_v = { -1.0, -1.0, -1.0, -1.0 };not_a_color_v36,974
|
|
220
|
-
lowercase(char * string) lowercase40,1067
|
|
221
|
-
sym2string(VALUE sym) sym2string53,1228
|
|
222
|
-
string2sym(char * string) string2sym59,1298
|
|
223
|
-
is_a_hash(VALUE try_hash)is_a_hash65,1373
|
|
224
|
-
is_an_array(VALUE try_array)is_an_array71,1446
|
|
225
|
-
bool is_a_num(VALUE try_num)is_a_num76,1519
|
|
226
|
-
get_from_hash(VALUE hash, char * sym) get_from_hash82,1625
|
|
227
|
-
set_hash_value(VALUE hash, char * sym, VALUE val)set_hash_value91,1808
|
|
228
|
-
delete_from_hash(VALUE hash, char * sym)delete_from_hash101,2016
|
|
229
|
-
hash_value_is(VALUE hash, char * sym, VALUE val)hash_value_is111,2295
|
|
230
|
-
has_optional_hash_arg(VALUE hash, char * sym) has_optional_hash_arg122,2482
|
|
231
|
-
set_array_value(VALUE array, int index, VALUE val)set_array_value134,2710
|
|
232
|
-
get_from_array(VALUE array, int index) get_from_array144,2913
|
|
233
|
-
init_image_local(VALUE image)init_image_local154,3092
|
|
234
|
-
set_image_local(VALUE image, int name, VALUE val)set_image_local173,3553
|
|
235
|
-
get_image_local(VALUE image, int name)get_image_local183,3731
|
|
236
|
-
convert_image_local_color_to_rgba(VALUE image)convert_image_local_color_to_rgba252,5880
|
|
237
|
-
save_rgba_to_image_local_color(VALUE image, rgba color)save_rgba_to_image_local_color266,6319
|
|
238
|
-
create_image(VALUE window, int width, int height)create_image283,6877
|
|
239
|
-
not_a_color(rgba color1) not_a_color303,7451
|
|
240
|
-
is_a_color(rgba color1)is_a_color309,7516
|
|
241
|
-
cmp_color(rgba color1, rgba color2) cmp_color315,7583
|
|
242
|
-
color_copy(float * source, float * dest) color_copy323,7778
|
|
243
|
-
zero_color(float * tex) zero_color330,7908
|
|
244
|
-
get_pixel_color_from_chunk(float * chunk, int width, int height, int x, int y)get_pixel_color_from_chunk336,7982
|
|
245
|
-
get_pixel_color(texture_info * tex, int x, int y) get_pixel_color357,8429
|
|
246
|
-
get_pixel_data(texture_info * tex, int x, int y) get_pixel_data379,9024
|
|
247
|
-
set_pixel_color(rgba * pixel_color, texture_info * tex, int x, int y) set_pixel_color388,9204
|
|
248
|
-
find_color_from_string(char * try_color) find_color_from_string410,9769
|
|
249
|
-
convert_rgba_to_rb_color(rgba * pix)convert_rgba_to_rb_color471,12271
|
|
250
|
-
convert_rb_color_to_rgba(VALUE cval)convert_rb_color_to_rgba487,12747
|
|
251
|
-
check_mask(VALUE mask) check_mask530,13964
|
|
252
|
-
check_image(VALUE image) check_image548,14470
|
|
253
|
-
is_gosu_image(VALUE try_image)is_gosu_image555,14634
|
|
254
|
-
#define outcode outcode565,14808
|
|
255
|
-
const int RIGHT = 8; //1000RIGHT566,14828
|
|
256
|
-
const int TOP = 4; //0100TOP567,14857
|
|
257
|
-
const int LEFT = 2; //0010LEFT568,14886
|
|
258
|
-
const int BOTTOM = 1; //0001BOTTOM569,14915
|
|
259
|
-
ComputeOutCode (int x, int y, int xmin, int ymin, int xmax, int ymax)ComputeOutCode574,15083
|
|
260
|
-
cohen_sutherland_clip (int * x0, int * y0,int * x1, int * y1, int xmin, int ymin,cohen_sutherland_clip592,15643
|
|
261
|
-
constrain_boundaries(int * x0, int * y0, int * x1, int * y1, int width, int height) constrain_boundaries669,18664
|
|
262
|
-
bound_by_rect_and_inner(int x, int y, int x0, int y0, int x1, int y1, int inner) bound_by_rect_and_inner692,19249
|
|
263
|
-
bound_by_rect(int x, int y, int x0, int y0, int x1, int y1) bound_by_rect701,19577
|
|
264
|
-
calc_pixel_offset_for_action(action_struct * cur, texture_info * tex, int x, int y) calc_pixel_offset_for_action708,19783
|
|
265
|
-
calc_pixel_offset(texture_info * tex, int x, int y) calc_pixel_offset717,20019
|
|
266
|
-
max_quad_size(void)max_quad_size726,20217
|
|
267
|
-
check_for_texture_info(VALUE image) check_for_texture_info751,20843
|
|
268
|
-
allocate_texture(int width, int height)allocate_texture772,21587
|
|
269
|
-
sync_to_gl(int tex_name, int x_offset, int y_offset, int width, int height, void * sub)sync_to_gl787,21894
|
|
270
|
-
create_subtexture_and_sync_to_gl(image_bounds * img_bounds, texture_info * tex)create_subtexture_and_sync_to_gl799,22251
|
|
271
|
-
get_image_chunk(texture_info * tex, int xmin, int ymin, int xmax, int ymax)get_image_chunk823,23096
|
|
272
|
-
get_texture_info(VALUE image, texture_info * tex) get_texture_info852,23802
|
|
273
|
-
is_a_point(VALUE try_point)is_a_point897,25165
|
|
274
|
-
point_x(VALUE point)point_x907,25380
|
|
275
|
-
point_y(VALUE point)point_y913,25461
|
|
276
|
-
power(float base, int exp)power920,25598
|
|
277
|
-
fact(int n)fact940,25926
|
|
278
|
-
comb(int n, int k)comb948,26031
|
|
279
|
-
bernstein(int n, int k, float u)bernstein955,26132
|
|
280
|
-
|
|
281
|
-
utils.h,201
|
|
282
|
-
#define GUARD_UTILS_HGUARD_UTILS_H2,22
|
|
283
|
-
#define DRAW_OFFSET DRAW_OFFSET6,102
|
|
284
|
-
#define LAZY_BOUNDS LAZY_BOUNDS7,124
|
|
285
|
-
#define IMAGE_COLOR IMAGE_COLOR8,146
|
|
286
|
-
#define USER_DEFAULTS USER_DEFAULTS9,168
|