texplay 0.2.920 → 0.2.930
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README.markdown +1 -1
- data/examples/example_alpha_blend.rb +1 -1
- data/examples/example_bezier.rb +2 -2
- data/examples/example_color_control.rb +2 -2
- data/examples/example_color_transform.rb +1 -1
- data/examples/example_color_transform_circle.rb +1 -5
- data/examples/example_darken.rb +27 -0
- data/examples/example_dup.rb +3 -3
- data/examples/example_each.rb +2 -2
- data/examples/example_effect.rb +2 -2
- data/examples/example_fill.rb +2 -2
- data/examples/example_fill_old.rb +2 -2
- data/examples/example_fluent.rb +1 -1
- data/examples/example_gen_eval.rb +2 -3
- data/examples/example_hash_arguments.rb +1 -1
- data/examples/example_light_multiply.rb +20 -0
- data/examples/example_lsystem.rb +3 -3
- data/examples/example_melt.rb +2 -2
- data/examples/example_polyline.rb +2 -2
- data/examples/example_scale.rb +1 -1
- data/examples/example_select.rb +30 -0
- data/examples/example_simple.rb +2 -2
- data/examples/example_splice.rb +2 -1
- data/examples/example_sync.rb +2 -2
- data/examples/example_turtle.rb +2 -2
- data/examples/example_weird.rb +1 -2
- data/ext/texplay/utils.c +3 -2
- data/lib/texplay/version.rb +1 -1
- metadata +6 -3
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
data/examples/example_bezier.rb
CHANGED
@@ -5,8 +5,8 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
9
|
-
@img = TexPlay
|
8
|
+
super(500, 500, false, 20)
|
9
|
+
@img = TexPlay.create_image(self, 500, 500)
|
10
10
|
|
11
11
|
# put a border on the image
|
12
12
|
@img.rect 0,0, @img.width - 1, @img.height - 1
|
@@ -4,7 +4,7 @@ require 'texplay'
|
|
4
4
|
|
5
5
|
class W < Gosu::Window
|
6
6
|
def initialize
|
7
|
-
super(
|
7
|
+
super(500, 500, false, 20)
|
8
8
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
9
9
|
@tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
10
10
|
@gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
|
@@ -58,7 +58,7 @@ class W < Gosu::Window
|
|
58
58
|
|
59
59
|
def draw
|
60
60
|
|
61
|
-
@img.draw
|
61
|
+
@img.draw 0, 0,1
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
@@ -6,7 +6,7 @@ require 'texplay'
|
|
6
6
|
|
7
7
|
class W < Gosu::Window
|
8
8
|
def initialize
|
9
|
-
super(
|
9
|
+
super(500, 500, false, 20)
|
10
10
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
11
|
@x = 100
|
12
12
|
@y = 100
|
@@ -29,7 +29,6 @@ class W < Gosu::Window
|
|
29
29
|
@x2 -= 3
|
30
30
|
@y2 += 3
|
31
31
|
|
32
|
-
|
33
32
|
@copy2.splice @img, 0, 0, :crop => [@x2 - @rad, @y2 - @rad, @x2 + @rad, @y2 + @rad], :sync_mode => :no_sync
|
34
33
|
@copy.splice @img, 0, 0, :crop => [@x - @rad, @y - @rad, @x + @rad, @y + @rad], :sync_mode => :no_sync
|
35
34
|
|
@@ -42,9 +41,6 @@ class W < Gosu::Window
|
|
42
41
|
@img.draw 10, 10,1
|
43
42
|
|
44
43
|
if button_down?(Gosu::KbEscape)
|
45
|
-
IL.Enable(IL::ORIGIN_SET)
|
46
|
-
IL.OriginFunc(IL::ORIGIN_UPPER_LEFT)
|
47
|
-
# screenshot.crop(0,0, 500, 500).save("screenshot.jpg").free
|
48
44
|
exit
|
49
45
|
end
|
50
46
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'common'
|
3
|
+
require 'gosu'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
|
7
|
+
class W < Gosu::Window
|
8
|
+
def initialize
|
9
|
+
super(500, 500, false, 20)
|
10
|
+
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
|
+
@img.rect 0,0, @img.width - 1, @img.height - 1, :color_control => { :mult => [0.25, 0.25, 0.25, 1] }, :fill => true
|
12
|
+
|
13
|
+
@img.rect 230, 240, 330, 340, :fill => true,
|
14
|
+
:color_control => { :mult => [4, 4, 4, 1] }
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def draw
|
19
|
+
@img.draw 0, 0,1
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
w = W.new
|
26
|
+
w.show
|
27
|
+
|
data/examples/example_dup.rb
CHANGED
@@ -6,7 +6,7 @@ require 'texplay'
|
|
6
6
|
|
7
7
|
class W < Gosu::Window
|
8
8
|
def initialize
|
9
|
-
super(
|
9
|
+
super(500, 500, false, 20)
|
10
10
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
11
|
@img.rect 0,0, @img.width - 1, @img.height - 1
|
12
12
|
|
@@ -63,8 +63,8 @@ class W < Gosu::Window
|
|
63
63
|
x = @img.width * rand
|
64
64
|
y = @img.height * rand
|
65
65
|
|
66
|
-
@img.draw
|
67
|
-
@bunk.draw
|
66
|
+
@img.draw 0, 0,1
|
67
|
+
@bunk.draw 0, 0,1
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
data/examples/example_each.rb
CHANGED
@@ -6,7 +6,7 @@ require 'texplay'
|
|
6
6
|
|
7
7
|
class W < Gosu::Window
|
8
8
|
def initialize
|
9
|
-
super(
|
9
|
+
super(500, 500, false, 20)
|
10
10
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
11
|
|
12
12
|
# each can accept a block of two types of arity:
|
@@ -31,7 +31,7 @@ class W < Gosu::Window
|
|
31
31
|
|
32
32
|
def draw
|
33
33
|
|
34
|
-
@img.draw
|
34
|
+
@img.draw 0, 0,1
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
data/examples/example_effect.rb
CHANGED
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
10
10
|
|
11
11
|
# put a border on the image
|
@@ -24,7 +24,7 @@ class W < Gosu::Window
|
|
24
24
|
fill (@img.width * rand), (@img.height * rand), :color => :random, :glow => true
|
25
25
|
}
|
26
26
|
|
27
|
-
@img.draw
|
27
|
+
@img.draw 0, 0,1
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
data/examples/example_fill.rb
CHANGED
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = TexPlay::create_blank_image(self, 1022, 800)
|
10
10
|
@tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
11
11
|
@gosu = Gosu::Image.new(self, "#{Common::MEDIA}/sand1.png")
|
@@ -33,7 +33,7 @@ class W < Gosu::Window
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def draw
|
36
|
-
@img.draw
|
36
|
+
@img.draw 0, 0,1
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
@@ -4,7 +4,7 @@ require 'texplay'
|
|
4
4
|
|
5
5
|
class W < Gosu::Window
|
6
6
|
def initialize
|
7
|
-
super(
|
7
|
+
super(500, 500, false, 20)
|
8
8
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
9
9
|
@tp = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
10
10
|
@gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
|
@@ -38,7 +38,7 @@ class W < Gosu::Window
|
|
38
38
|
|
39
39
|
def draw
|
40
40
|
|
41
|
-
@img.draw
|
41
|
+
@img.draw 0, 0,1
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
data/examples/example_fluent.rb
CHANGED
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
10
10
|
|
11
11
|
@width = @img.width
|
@@ -14,7 +14,6 @@ class W < Gosu::Window
|
|
14
14
|
# turn alpha blending and filling on
|
15
15
|
@img.set_options :alpha_blend => true, :fill => true
|
16
16
|
end
|
17
|
-
|
18
17
|
def draw
|
19
18
|
|
20
19
|
# Gen_eval lets us use local instance vars within the block
|
@@ -25,7 +24,7 @@ class W < Gosu::Window
|
|
25
24
|
:color => [rand, rand ,rand, rand]
|
26
25
|
}
|
27
26
|
|
28
|
-
@img.draw
|
27
|
+
@img.draw 0, 0,1
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'common'
|
3
|
+
require 'gosu'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
class W < Gosu::Window
|
7
|
+
def initialize
|
8
|
+
super(500, 500, false, 20)
|
9
|
+
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
10
|
+
@cover = TexPlay.create_image(self, @img.width, @img.height, :color => Gosu::Color.new(127, 127, 127, 127))
|
11
|
+
end
|
12
|
+
|
13
|
+
def draw
|
14
|
+
@img.draw 0, 0, 1
|
15
|
+
@cover.draw 0, 0, 1, 1, 1, Gosu::Color.new(0xffffffff), :multiply
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
W.new.show
|
20
|
+
|
data/examples/example_lsystem.rb
CHANGED
@@ -45,15 +45,15 @@ end
|
|
45
45
|
|
46
46
|
class W < Gosu::Window
|
47
47
|
def initialize
|
48
|
-
super(
|
48
|
+
super(500, 500, false, 20)
|
49
49
|
@img = TexPlay::create_blank_image(self, 500, 500)
|
50
50
|
@img.set_options :color => :rand
|
51
|
-
@img.lsystem(
|
51
|
+
@img.lsystem(0, 250, Bush3, :order => 6, :line_length => 4)
|
52
52
|
#@img.save("dragon.jpg")
|
53
53
|
end
|
54
54
|
|
55
55
|
def draw
|
56
|
-
@img.draw(
|
56
|
+
@img.draw(0,0,1)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
data/examples/example_melt.rb
CHANGED
@@ -6,7 +6,7 @@ require 'texplay'
|
|
6
6
|
|
7
7
|
class W < Gosu::Window
|
8
8
|
def initialize
|
9
|
-
super(
|
9
|
+
super(500, 500, false, 20)
|
10
10
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
11
|
end
|
12
12
|
|
@@ -16,7 +16,7 @@ class W < Gosu::Window
|
|
16
16
|
|
17
17
|
@img.splice @img, x, y + 1, :crop => [x, y, x + 100, y + 100]
|
18
18
|
|
19
|
-
@img.draw
|
19
|
+
@img.draw 0, 0,1
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
10
10
|
|
11
11
|
# put a border on the image
|
@@ -32,7 +32,7 @@ class W < Gosu::Window
|
|
32
32
|
|
33
33
|
# NOTE: (when viewing) the blue line is the extra line added to close the polygon,
|
34
34
|
# red lines are original polyline
|
35
|
-
@img.draw
|
35
|
+
@img.draw 0, 0,1
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
data/examples/example_scale.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'common'
|
3
|
+
require 'gosu'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
|
7
|
+
class W < Gosu::Window
|
8
|
+
def initialize
|
9
|
+
super(500, 500, false, 20)
|
10
|
+
@img = TexPlay.create_image(self, 500, 500)
|
11
|
+
@img.rect 100, 100, 200, 300, :color => :red, :fill => true
|
12
|
+
@img.rect 200, 100, 300, 300, :color => :blue, :fill => true
|
13
|
+
|
14
|
+
|
15
|
+
@img.line 0, 0, 500, 500, :dest_ignore => :red
|
16
|
+
|
17
|
+
@img.circle 200, 100, 50, :fill => true, :dest_select => [:red, :blue], :color => :orange
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def draw
|
22
|
+
@img.draw 100, 50,1
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
w = W.new
|
29
|
+
w.show
|
30
|
+
|
data/examples/example_simple.rb
CHANGED
@@ -32,8 +32,8 @@ class W < Gosu::Window
|
|
32
32
|
@img.line 200, 300, 300, 400, :thickness => 5,
|
33
33
|
:dest_select => :blue, :dest_ignore => :red
|
34
34
|
|
35
|
-
puts @img.get_pixel
|
36
|
-
puts @img.get_pixel
|
35
|
+
puts (@img.get_pixel 2000, 310).inspect
|
36
|
+
puts @img.get_pixel 2000, 310, :color_mode => :gosu
|
37
37
|
end
|
38
38
|
|
39
39
|
def draw
|
data/examples/example_splice.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require 'rubygems'
|
2
3
|
require 'common'
|
3
4
|
require 'texplay'
|
@@ -5,7 +6,7 @@ require 'texplay'
|
|
5
6
|
|
6
7
|
class W < Gosu::Window
|
7
8
|
def initialize
|
8
|
-
super(
|
9
|
+
super(500, 500, false, 20)
|
9
10
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/texplay.png")
|
10
11
|
@gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
|
11
12
|
|
data/examples/example_sync.rb
CHANGED
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
10
10
|
|
11
11
|
# sets the 'global' color for all actions in this image
|
@@ -51,7 +51,7 @@ class W < Gosu::Window
|
|
51
51
|
|
52
52
|
def draw
|
53
53
|
|
54
|
-
@img.draw
|
54
|
+
@img.draw 0, 0,1
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/examples/example_turtle.rb
CHANGED
@@ -5,7 +5,7 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/empty2.png")
|
10
10
|
|
11
11
|
# put a border on the image
|
@@ -29,7 +29,7 @@ class W < Gosu::Window
|
|
29
29
|
@length += 2
|
30
30
|
}
|
31
31
|
|
32
|
-
@img.draw
|
32
|
+
@img.draw 0, 0,1
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
data/examples/example_weird.rb
CHANGED
@@ -5,11 +5,10 @@ require 'texplay'
|
|
5
5
|
|
6
6
|
class W < Gosu::Window
|
7
7
|
def initialize
|
8
|
-
super(
|
8
|
+
super(500, 500, false, 20)
|
9
9
|
@img = Gosu::Image.new(self, "#{Common::MEDIA}/gob.png")
|
10
10
|
@sun = Gosu::Image.new(self, "#{Common::MEDIA}/sunset.png")
|
11
11
|
@img.splice @sun, 0, 0, :mode => :exclusion
|
12
|
-
# @img.rect 0, 10, 300, 300, :color => :blue, :fill => true, :mode => :softlight
|
13
12
|
end
|
14
13
|
|
15
14
|
def draw
|
data/ext/texplay/utils.c
CHANGED
@@ -281,13 +281,14 @@ save_rgba_to_image_local_color(VALUE image, rgba color)
|
|
281
281
|
bool
|
282
282
|
not_a_color(rgba color1)
|
283
283
|
{
|
284
|
-
return color1.red
|
284
|
+
return color1.red < 0 || color1.green < 0 ||
|
285
|
+
color1.blue < 0 || color1.alpha < 0;
|
285
286
|
}
|
286
287
|
|
287
288
|
bool
|
288
289
|
is_a_color(rgba color1)
|
289
290
|
{
|
290
|
-
return
|
291
|
+
return color1.red > 0 && color1.green > 0 && color1.blue > 0 && color1.alpha > 0;
|
291
292
|
}
|
292
293
|
|
293
294
|
bool
|
data/lib/texplay/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 930
|
9
|
+
version: 0.2.930
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Mair (banisterfiend)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-09 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- examples/example_color_control.rb
|
72
72
|
- examples/example_color_transform.rb
|
73
73
|
- examples/example_color_transform_circle.rb
|
74
|
+
- examples/example_darken.rb
|
74
75
|
- examples/example_dup.rb
|
75
76
|
- examples/example_each.rb
|
76
77
|
- examples/example_effect.rb
|
@@ -80,11 +81,13 @@ files:
|
|
80
81
|
- examples/example_gen_eval.rb
|
81
82
|
- examples/example_hash_arguments.rb
|
82
83
|
- examples/example_light.rb
|
84
|
+
- examples/example_light_multiply.rb
|
83
85
|
- examples/example_lsystem.rb
|
84
86
|
- examples/example_melt.rb
|
85
87
|
- examples/example_meyet.rb
|
86
88
|
- examples/example_polyline.rb
|
87
89
|
- examples/example_scale.rb
|
90
|
+
- examples/example_select.rb
|
88
91
|
- examples/example_simple.rb
|
89
92
|
- examples/example_splice.rb
|
90
93
|
- examples/example_sync.rb
|