texplay 0.2.910 → 0.2.920

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,7 @@
1
+ 8/6/10
2
+ version 0.2.920
3
+ * :trace now supports :color_mode => :gosu
4
+
1
5
  7/6/10
2
6
  version 0.2.910
3
7
  * 1.8.7 incompatibility fixed
data/README.markdown CHANGED
@@ -5,7 +5,7 @@
5
5
  INSTRUCTIONS
6
6
  ============
7
7
 
8
- **TexPlay version 0.2.910**
8
+ **TexPlay version 0.2.920**
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
 
@@ -0,0 +1,22 @@
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, :color => Gosu::Color::BLUE)
11
+ end
12
+
13
+ def draw
14
+ @img.draw 100, 50,1
15
+ end
16
+
17
+ end
18
+
19
+
20
+ w = W.new
21
+ w.show
22
+
@@ -5,10 +5,10 @@ require 'texplay'
5
5
 
6
6
  class W < Gosu::Window
7
7
  def initialize
8
- super(1024, 768, false, 20)
8
+ super(500, 500, false, 20)
9
9
  @img = TexPlay.create_image(self, 500, 500).fill(3,3, :color => :alpha)
10
10
  @img.rect 100, 100, 300 , 300, :color => :blue, :fill => true
11
- puts (@img.line 400, 200, 100, 200, :trace => { :until_color => :blue }).inspect
11
+ puts (@img.line 400, 200, 100, 200, :trace => { :until_color => :blue }, :color_mode => :gosu)
12
12
  end
13
13
 
14
14
  def draw
@@ -520,13 +520,17 @@ m_flood_fill(int argc, VALUE * argv, VALUE self)
520
520
  }
521
521
 
522
522
  static inline VALUE
523
- convert_trace_match_to_ruby_array(trace_match match)
523
+ convert_trace_match_to_ruby_array(trace_match match, bool gosu_color_mode)
524
524
  {
525
525
  VALUE ary = rb_ary_new();
526
526
 
527
527
  rb_ary_store(ary, 0, INT2FIX(match.x));
528
528
  rb_ary_store(ary, 1, INT2FIX(match.y));
529
- rb_ary_store(ary, 2, convert_rgba_to_rb_color(&match.color));
529
+
530
+ if (gosu_color_mode)
531
+ rb_ary_store(ary, 2, convert_rgba_to_gosu_color(&match.color));
532
+ else
533
+ rb_ary_store(ary, 2, convert_rgba_to_rb_color(&match.color));
530
534
 
531
535
  return ary;
532
536
  }
@@ -537,6 +541,7 @@ m_line(int argc, VALUE * argv, VALUE self)
537
541
  {
538
542
  int x1, y1, x2, y2;
539
543
  int last = argc - 1;
544
+ bool gosu_color_mode = false;
540
545
  VALUE options;
541
546
  texture_info tex;
542
547
  trace_match match;
@@ -549,6 +554,9 @@ m_line(int argc, VALUE * argv, VALUE self)
549
554
 
550
555
  options = argv[last];
551
556
 
557
+ if (hash_value_is(options, "color_mode", string2sym("gosu")))
558
+ gosu_color_mode = true;
559
+
552
560
  get_texture_info(self, &tex);
553
561
 
554
562
  match = line_do_action(x1, y1, x2, y2, &tex, options, sync_mode, true, NULL);
@@ -557,7 +565,7 @@ m_line(int argc, VALUE * argv, VALUE self)
557
565
  if (match.x == -1)
558
566
  return Qnil;
559
567
  else
560
- return convert_trace_match_to_ruby_array(match);
568
+ return convert_trace_match_to_ruby_array(match, gosu_color_mode);
561
569
  }
562
570
 
563
571
  return self;
@@ -1,3 +1,3 @@
1
1
  module TexPlay
2
- VERSION = "0.2.910"
2
+ VERSION = "0.2.920"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 910
9
- version: 0.2.910
8
+ - 920
9
+ version: 0.2.920
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-07 00:00:00 +02:00
17
+ date: 2010-06-08 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ files:
67
67
  - examples/common.rb
68
68
  - examples/example_alpha_blend.rb
69
69
  - examples/example_bezier.rb
70
+ - examples/example_blank.rb
70
71
  - examples/example_color_control.rb
71
72
  - examples/example_color_transform.rb
72
73
  - examples/example_color_transform_circle.rb