texplay 0.2.965 → 0.2.970

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 CHANGED
@@ -1,3 +1,10 @@
1
+ 14/8/10
2
+ version 0.2.970
3
+ * fixed :transparent bug (bug was in rb_convert_rb_color_to_rgba(), :transparent was being matched as
4
+ not_a_color)
5
+ * limited not_a_color() to match just color.red == -1 && color.green == -1, etc rather than color.red < 0
6
+ * Now we can use negative values to define other pseudo-colors (in similar vein to :transparent)
7
+
1
8
  16/7/10
2
9
  version 0.2.965
3
10
  * fixed MAX_TEXTURE_SIZE at 1024 for linux (to avoid segfault)
data/README.markdown CHANGED
@@ -5,7 +5,7 @@
5
5
  INSTRUCTIONS
6
6
  ============
7
7
 
8
- **TexPlay version 0.2.965**
8
+ **TexPlay version 0.2.970**
9
9
 
10
10
  [Read The Documentation](http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/)
11
11
 
data/Rakefile CHANGED
@@ -52,7 +52,7 @@ end
52
52
  # s.description = s.summary
53
53
  # s.require_path = 'lib'
54
54
  # s.add_dependency("gosu",">=0.7.20")
55
- # s.platform = 'i386-mswin32'
55
+ # s.platform = 'i386-mingw32'
56
56
  # s.homepage = "http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/"
57
57
  # s.has_rdoc = false
58
58
 
@@ -0,0 +1,30 @@
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 = TexPlay.create_image(self, 400, 300)
10
+ @img.rect 100, 100, 200, 200, :color => :red, :fill => true
11
+
12
+ # Coloured transparent block with white border.
13
+ @img.rect 200, 100, 300, 200, :color => [1, 1, 1, 0], :fill => true
14
+ @img.rect 200, 100, 300, 200
15
+
16
+ @img.line 0, 120, 500, 120, :dest_select => :transparent, :color => :green
17
+ # @img.line 0, 140, 500, 140, :dest_select => :alpha
18
+ # @img.line 0, 160, 500, 160, :dest_select => :transparent # Should draw everywhere except the red block.
19
+ # @img.line 0, 180, 500, 180, :dest_ignore => :transparent # Should draw only on the red block.
20
+ end
21
+
22
+ def draw
23
+ @img.draw 0, 0, 1
24
+ end
25
+
26
+ end
27
+
28
+
29
+ w = W.new
30
+ w.show
@@ -0,0 +1,26 @@
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 = TexPlay.create_image(self, 400, 300)
10
+ @img.rect 0, 0, 200, 100, :color => [1,1,1,0], :fill => true
11
+ @img.rect 200, 100, 400, 300, :color => [1,1,1,0.1], :fill => true
12
+
13
+
14
+ @img.line 0, 120, 500, 120,
15
+ :dest_select => :transparent, :color => :green, :tolerance => 0.1
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
data/ext/texplay/utils.c CHANGED
@@ -279,14 +279,14 @@ save_rgba_to_image_local_color(VALUE image, rgba color)
279
279
  bool
280
280
  not_a_color(rgba color1)
281
281
  {
282
- return color1.red < 0 || color1.green < 0 ||
283
- color1.blue < 0 || color1.alpha < 0;
282
+ return color1.red == -1 || color1.green == -1 ||
283
+ color1.blue == -1 || color1.alpha == -1;
284
284
  }
285
285
 
286
286
  bool
287
287
  is_a_color(rgba color1)
288
288
  {
289
- return color1.red >= 0 && color1.green >= 0 && color1.blue >= 0 && color1.alpha >= 0;
289
+ return !not_a_color(color1);
290
290
  }
291
291
 
292
292
  bool
@@ -321,6 +321,8 @@ special_cmp_color(rgba color1, rgba color2)
321
321
  return color2.alpha == 0;
322
322
  else if (is_transparent_color(color2))
323
323
  return color1.alpha == 0;
324
+ else
325
+ return false;
324
326
  }
325
327
 
326
328
  static bool
@@ -330,6 +332,8 @@ special_cmp_color_with_tolerance(rgba color1, rgba color2, float tolerance)
330
332
  return (color1.alpha) <= tolerance;
331
333
  else if (is_transparent_color(color2))
332
334
  return color2.alpha <= tolerance;
335
+ else
336
+ return false;
333
337
  }
334
338
 
335
339
 
@@ -1,3 +1,3 @@
1
1
  module TexPlay
2
- VERSION = "0.2.965"
2
+ VERSION = "0.2.970"
3
3
  end
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: 1949
4
+ hash: 1923
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 965
10
- version: 0.2.965
9
+ - 970
10
+ version: 0.2.970
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Mair (banisterfiend)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-16 00:00:00 +12:00
18
+ date: 2010-08-14 00:00:00 +12:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -97,6 +97,8 @@ files:
97
97
  - examples/example_splice.rb
98
98
  - examples/example_sync.rb
99
99
  - examples/example_trace.rb
100
+ - examples/example_transparent.rb
101
+ - examples/example_transparent2.rb
100
102
  - examples/example_turtle.rb
101
103
  - examples/example_weird.rb
102
104
  - examples/media/bird.png