texplay 0.2.935 → 0.2.940
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 +5 -0
- data/README.markdown +1 -1
- data/examples/example_color_transform.rb +8 -8
- data/examples/example_ippa.rb +25 -0
- data/examples/example_trace.rb +1 -1
- data/ext/texplay/actions.c +1 -1
- data/ext/texplay/bindings.c +2 -2
- data/ext/texplay/utils.c +4 -0
- data/lib/texplay/version.rb +1 -1
- metadata +3 -2
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
|
@@ -17,24 +17,24 @@ class W < Gosu::Window
|
|
|
17
17
|
@s = true
|
|
18
18
|
|
|
19
19
|
@copy = TexPlay.create_image(self, @rad * 2 + 1, @rad * 2 + 1)
|
|
20
|
-
|
|
20
|
+
@copy2 = TexPlay.create_image(self, @rad * 2 + 1, @rad * 2 + 1)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def draw
|
|
24
|
+
@pause = true
|
|
24
25
|
|
|
26
|
+
@x += 1
|
|
27
|
+
@y += 1
|
|
25
28
|
|
|
26
|
-
@
|
|
27
|
-
@
|
|
28
|
-
|
|
29
|
-
@x2 -= 3
|
|
30
|
-
@y2 += 3
|
|
29
|
+
@x2 -= 1
|
|
30
|
+
@y2 += 1
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
@copy2.splice @img, 0, 0, :crop => [@x2 - @rad, @y2 - @rad, @x2 + @rad, @y2 + @rad], :sync_mode => :no_sync
|
|
34
34
|
@copy.splice @img, 0, 0, :crop => [@x - @rad, @y - @rad, @x + @rad, @y + @rad], :sync_mode => :no_sync
|
|
35
|
-
@img.rect @x - @rad, @y - @rad, @x + @rad, @y + @rad, :fill => true, :mode => :overlay, :color => :
|
|
35
|
+
@img.rect @x - @rad, @y - @rad, @x + @rad, @y + @rad, :fill => true, :mode => :overlay, :color => :tyrian
|
|
36
36
|
|
|
37
|
-
@img.rect @x2 - @rad, @y2 - @rad, @x2 + @rad, @y2 + @rad, :fill => true, :mode => :
|
|
37
|
+
@img.rect @x2 - @rad, @y2 - @rad, @x2 + @rad, @y2 + @rad, :fill => true, :mode => :invert, :color => :blue
|
|
38
38
|
|
|
39
39
|
# @img.force_sync [0,0, @img.width, @img.height]
|
|
40
40
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'common'
|
|
3
|
+
require 'gosu'
|
|
4
|
+
require 'texplay'
|
|
5
|
+
|
|
6
|
+
class Window < Gosu::Window
|
|
7
|
+
def initialize
|
|
8
|
+
super(500, 500, false, 20)
|
|
9
|
+
|
|
10
|
+
@image = TexPlay.create_image(self, 50, 50)
|
|
11
|
+
|
|
12
|
+
from_x = 50
|
|
13
|
+
from_y = 50
|
|
14
|
+
to_x = 51
|
|
15
|
+
to_y = 51
|
|
16
|
+
|
|
17
|
+
x2, y2, color = @image.line from_x, from_y, to_x, to_y, :trace => { :while_color => :red }
|
|
18
|
+
|
|
19
|
+
p x2
|
|
20
|
+
p y2
|
|
21
|
+
p color
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Window.new.show
|
data/examples/example_trace.rb
CHANGED
|
@@ -8,7 +8,7 @@ class W < Gosu::Window
|
|
|
8
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
|
|
11
|
+
puts (@img.line 498, 200, 600, 200, :trace => { :while_color => :blue })
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def draw
|
data/ext/texplay/actions.c
CHANGED
|
@@ -162,7 +162,7 @@ line_do_action(int x1, int y1, int x2, int y2, texture_info * tex, VALUE hash_ar
|
|
|
162
162
|
}
|
|
163
163
|
draw_epilogue(&cur, tex, primary);
|
|
164
164
|
|
|
165
|
-
return (trace_match) { .x = -
|
|
165
|
+
return (trace_match) { .x = -9999, .y = -9999, .color = not_a_color_v };
|
|
166
166
|
}
|
|
167
167
|
/** end line **/
|
|
168
168
|
|
data/ext/texplay/bindings.c
CHANGED
|
@@ -562,12 +562,12 @@ m_line(int argc, VALUE * argv, VALUE self)
|
|
|
562
562
|
match = line_do_action(x1, y1, x2, y2, &tex, options, sync_mode, true, NULL);
|
|
563
563
|
|
|
564
564
|
if (has_optional_hash_arg(options, "trace")) {
|
|
565
|
-
if (match.x == -
|
|
565
|
+
if (match.x == -9999)
|
|
566
566
|
return Qnil;
|
|
567
567
|
else
|
|
568
568
|
return convert_trace_match_to_ruby_array(match, gosu_color_mode);
|
|
569
569
|
}
|
|
570
|
-
|
|
570
|
+
|
|
571
571
|
return self;
|
|
572
572
|
}
|
|
573
573
|
|
data/ext/texplay/utils.c
CHANGED
|
@@ -407,6 +407,8 @@ convert_gosu_to_rgba_color(VALUE gcolor)
|
|
|
407
407
|
VALUE
|
|
408
408
|
convert_rgba_to_rb_color(rgba * pix)
|
|
409
409
|
{
|
|
410
|
+
if (not_a_color(*pix)) return Qnil;
|
|
411
|
+
|
|
410
412
|
/* create a new ruby array to store the pixel data */
|
|
411
413
|
VALUE pix_array = rb_ary_new2(4);
|
|
412
414
|
|
|
@@ -423,6 +425,8 @@ convert_rgba_to_rb_color(rgba * pix)
|
|
|
423
425
|
VALUE
|
|
424
426
|
convert_rgba_to_gosu_color(rgba * pix)
|
|
425
427
|
{
|
|
428
|
+
if (not_a_color(*pix)) return Qnil;
|
|
429
|
+
|
|
426
430
|
VALUE gosu_color_class = 0;
|
|
427
431
|
|
|
428
432
|
if (gosu_color_class == 0) {
|
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
|
+
- 940
|
|
9
|
+
version: 0.2.940
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- John Mair (banisterfiend)
|
|
@@ -80,6 +80,7 @@ files:
|
|
|
80
80
|
- examples/example_fluent.rb
|
|
81
81
|
- examples/example_gen_eval.rb
|
|
82
82
|
- examples/example_hash_arguments.rb
|
|
83
|
+
- examples/example_ippa.rb
|
|
83
84
|
- examples/example_light.rb
|
|
84
85
|
- examples/example_light_multiply.rb
|
|
85
86
|
- examples/example_lsystem.rb
|