texplay 0.2.970 → 0.2.975
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/README.markdown +1 -1
- data/examples/example_transparent3.rb +22 -0
- data/examples/media/object.png +0 -0
- data/ext/texplay/utils.c +2 -2
- data/lib/texplay.rb +1 -2
- data/lib/texplay/version.rb +1 -1
- metadata +5 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
14/8/10
|
2
|
+
version 0.2.975
|
3
|
+
* fixed :tolerance bug (was in special_cmp_color_with_tolerance, was checking color1.alpha <= tolerance instead of color2.alpha <= tolerance)
|
4
|
+
* modified TexPlay.create_image() so it only draws a colored, filled rect if a :color parameter is specified
|
5
|
+
|
1
6
|
14/8/10
|
2
7
|
version 0.2.970
|
3
8
|
* fixed :transparent bug (bug was in rb_convert_rb_color_to_rgba(), :transparent was being matched as
|
data/README.markdown
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'common'
|
3
|
+
require 'gosu'
|
4
|
+
require 'texplay'
|
5
|
+
|
6
|
+
class W < Gosu::Window
|
7
|
+
def initialize
|
8
|
+
super(400, 300, false, 20)
|
9
|
+
@img = Gosu::Image.new(self, "#{Common::MEDIA}/object.png")
|
10
|
+
|
11
|
+
@img.rect 0, 0, 200, 100, :color => :green, :fill => true, :dest_select => :transparent, :tolerance => 0.5
|
12
|
+
end
|
13
|
+
|
14
|
+
def draw
|
15
|
+
@img.draw 100, 100, 1
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
w = W.new
|
22
|
+
w.show
|
Binary file
|
data/ext/texplay/utils.c
CHANGED
@@ -329,9 +329,9 @@ static bool
|
|
329
329
|
special_cmp_color_with_tolerance(rgba color1, rgba color2, float tolerance)
|
330
330
|
{
|
331
331
|
if (is_transparent_color(color1))
|
332
|
-
return (
|
332
|
+
return (color2.alpha) <= tolerance;
|
333
333
|
else if (is_transparent_color(color2))
|
334
|
-
return
|
334
|
+
return color1.alpha <= tolerance;
|
335
335
|
else
|
336
336
|
return false;
|
337
337
|
}
|
data/lib/texplay.rb
CHANGED
@@ -31,10 +31,9 @@ module TexPlay
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def create_blank_image(window, width, height, options={})
|
34
|
-
options = { :color => [0, 0, 0, 0] }.merge!(options)
|
35
34
|
|
36
35
|
img = Gosu::Image.new(window, EmptyImageStub.new(width, height))
|
37
|
-
img.rect 0, 0, img.width - 1, img.height - 1, :color => options[:color], :fill => true
|
36
|
+
img.rect 0, 0, img.width - 1, img.height - 1, :color => options[:color], :fill => true if options[:color]
|
38
37
|
|
39
38
|
img
|
40
39
|
end
|
data/lib/texplay/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1929
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 975
|
10
|
+
version: 0.2.975
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Mair (banisterfiend)
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- examples/example_trace.rb
|
100
100
|
- examples/example_transparent.rb
|
101
101
|
- examples/example_transparent2.rb
|
102
|
+
- examples/example_transparent3.rb
|
102
103
|
- examples/example_turtle.rb
|
103
104
|
- examples/example_weird.rb
|
104
105
|
- examples/media/bird.png
|
@@ -108,6 +109,7 @@ files:
|
|
108
109
|
- examples/media/green.png
|
109
110
|
- examples/media/logo.png
|
110
111
|
- examples/media/maria.png
|
112
|
+
- examples/media/object.png
|
111
113
|
- examples/media/rose.bmp
|
112
114
|
- examples/media/sand1.png
|
113
115
|
- examples/media/sunset.png
|