texplay 0.2.940 → 0.2.950
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_font.rb +33 -0
- data/examples/example_simple.rb +2 -2
- data/ext/texplay/graphics_utils.c +3 -4
- data/ext/texplay/utils.c +18 -10
- data/ext/texplay/utils.h +1 -0
- data/lib/texplay/version.rb +1 -1
- metadata +4 -3
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
10/6/10
|
|
2
|
+
version 0.2.950
|
|
3
|
+
* fixed bug in apply_drawing_mode, wasn't using blended_pixel as source_pixel
|
|
4
|
+
* hex literal colors now accepted, e.g 0xffff0000 (red)
|
|
5
|
+
|
|
1
6
|
9/6/10
|
|
2
7
|
version 0.2.940
|
|
3
8
|
* hopefully fixed :trace behaviour. Should now return nil for color when
|
data/README.markdown
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'common'
|
|
3
|
+
require 'gosu'
|
|
4
|
+
require 'texplay'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TEST_CASE 1 shows 2 pieces of text, but the background is black, even with :chroma_key. TEST_CASE 2 shows nothing.
|
|
9
|
+
# However, if you remove the :chroma_key's, you see a black background (and no text) in TEST_CASE 2, so there, :chroma_key appears to work.
|
|
10
|
+
|
|
11
|
+
class Wnd < Gosu::Window
|
|
12
|
+
def initialize
|
|
13
|
+
super(500, 200, false)
|
|
14
|
+
self.caption = "Splice Issues"
|
|
15
|
+
|
|
16
|
+
@chrome = TexPlay::create_blank_image(self, 200, 200)
|
|
17
|
+
@sunset = Gosu::Image.new(self, "#{Common::MEDIA}/sand1.png")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@long_text = Gosu::Image.from_text(self, "This is a long piece of text..", Gosu::default_font_name, 60)
|
|
21
|
+
@chrome.splice @long_text, 0, 0
|
|
22
|
+
|
|
23
|
+
@chrome.rect 0,0, @chrome.width, @chrome.height, :texture => @sunset, :fill => true, :mode => :multiply
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def draw
|
|
28
|
+
@chrome.draw(0,0,1)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Wnd.new.show
|
|
33
|
+
|
data/examples/example_simple.rb
CHANGED
|
@@ -11,9 +11,9 @@ class W < Gosu::Window
|
|
|
11
11
|
@gosu = Gosu::Image.new(self, "#{Common::MEDIA}/gosu.png")
|
|
12
12
|
|
|
13
13
|
# put a border on the image
|
|
14
|
-
@img.rect 0,0, @img.width - 1, @img.height - 1, :color =>
|
|
14
|
+
@img.rect 0,0, @img.width - 1, @img.height - 1, :color => 0xffff00ff, :fill => true
|
|
15
15
|
|
|
16
|
-
# perform some
|
|
16
|
+
# perform some e drawing actions
|
|
17
17
|
@img.line 0,0, @img.width - 1, @img.height - 1, :color => Gosu::Color::AQUA
|
|
18
18
|
@img.circle 400, 100, 40, :fill => true, :color => [rand, rand, rand, 1]
|
|
19
19
|
@img.rect 200, 300, 300, 400, :fill => true, :color => :red, :source_ignore => [:green],
|
|
@@ -19,7 +19,7 @@ static void prepare_color_control(action_struct * cur);
|
|
|
19
19
|
static void prepare_color_select(action_struct * cur);
|
|
20
20
|
static rgba apply_lerp(action_struct * payload, texture_info * tex, int x, int y);
|
|
21
21
|
static rgba apply_alpha_blend(action_struct * payload, texture_info * tex, int x, int y, rgba blended_pixel);
|
|
22
|
-
static rgba apply_drawing_mode(action_struct * payload, texture_info * tex, int x, int y);
|
|
22
|
+
static rgba apply_drawing_mode(action_struct * payload, texture_info * tex, int x, int y, rgba blended_pixel);
|
|
23
23
|
|
|
24
24
|
static rgba apply_color_control_transform(action_struct * payload, texture_info * tex, int x, int y);
|
|
25
25
|
static rgba exec_color_control_proc(action_struct * cur, texture_info * tex, int x, int y, rgba blended_pixel);
|
|
@@ -230,7 +230,7 @@ set_pixel_color_with_style(action_struct * payload, texture_info * tex, int x, i
|
|
|
230
230
|
|
|
231
231
|
/* drawing modes */
|
|
232
232
|
if(payload->pen.has_drawing_mode) {
|
|
233
|
-
blended_pixel = apply_drawing_mode(payload, tex, x, y);
|
|
233
|
+
blended_pixel = apply_drawing_mode(payload, tex, x, y, blended_pixel);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/* TO DO: refactor into its own helper function
|
|
@@ -817,11 +817,10 @@ mode_colorburn_channel(float b, float s)
|
|
|
817
817
|
}
|
|
818
818
|
|
|
819
819
|
static rgba
|
|
820
|
-
apply_drawing_mode(action_struct * payload, texture_info * tex, int x, int y)
|
|
820
|
+
apply_drawing_mode(action_struct * payload, texture_info * tex, int x, int y, rgba source_pixel)
|
|
821
821
|
{
|
|
822
822
|
rgba finished_pixel;
|
|
823
823
|
|
|
824
|
-
rgba source_pixel = payload->color;
|
|
825
824
|
rgba dest_pixel = get_pixel_color(tex, x, y);
|
|
826
825
|
|
|
827
826
|
rgba_char dest_pixel_char = color_float_to_int_format(dest_pixel);
|
data/ext/texplay/utils.c
CHANGED
|
@@ -276,8 +276,6 @@ save_rgba_to_image_local_color(VALUE image, rgba color)
|
|
|
276
276
|
return ilc;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
281
279
|
bool
|
|
282
280
|
not_a_color(rgba color1)
|
|
283
281
|
{
|
|
@@ -427,14 +425,7 @@ convert_rgba_to_gosu_color(rgba * pix)
|
|
|
427
425
|
{
|
|
428
426
|
if (not_a_color(*pix)) return Qnil;
|
|
429
427
|
|
|
430
|
-
VALUE
|
|
431
|
-
|
|
432
|
-
if (gosu_color_class == 0) {
|
|
433
|
-
VALUE gosu_class = rb_const_get(rb_cObject, rb_intern("Gosu"));
|
|
434
|
-
gosu_color_class = rb_const_get(gosu_class, rb_intern("Color"));
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
VALUE gosu_color = rb_funcall(gosu_color_class, rb_intern("new"), 0);
|
|
428
|
+
VALUE gosu_color = rb_funcall(gosu_color_class(), rb_intern("new"), 0);
|
|
438
429
|
|
|
439
430
|
rb_funcall(gosu_color, rb_intern("red="), 1, INT2FIX(pix->red * 255));
|
|
440
431
|
rb_funcall(gosu_color, rb_intern("green="), 1, INT2FIX(pix->green * 255));
|
|
@@ -444,7 +435,18 @@ convert_rgba_to_gosu_color(rgba * pix)
|
|
|
444
435
|
return gosu_color;
|
|
445
436
|
}
|
|
446
437
|
|
|
438
|
+
VALUE
|
|
439
|
+
gosu_color_class()
|
|
440
|
+
{
|
|
441
|
+
VALUE gcolor_class = 0;
|
|
447
442
|
|
|
443
|
+
if (gcolor_class == 0) {
|
|
444
|
+
VALUE gosu_class = rb_const_get(rb_cObject, rb_intern("Gosu"));
|
|
445
|
+
gcolor_class = rb_const_get(gosu_class, rb_intern("Color"));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return gcolor_class;
|
|
449
|
+
}
|
|
448
450
|
|
|
449
451
|
/* convert Ruby color to C color */
|
|
450
452
|
rgba
|
|
@@ -474,6 +476,12 @@ convert_rb_color_to_rgba(VALUE cval)
|
|
|
474
476
|
my_color.alpha = 1;
|
|
475
477
|
|
|
476
478
|
break;
|
|
479
|
+
case T_FIXNUM:
|
|
480
|
+
case T_BIGNUM:
|
|
481
|
+
return convert_gosu_to_rgba_color(rb_funcall(gosu_color_class(),
|
|
482
|
+
rb_intern("new"), 1, cval));
|
|
483
|
+
break;
|
|
484
|
+
|
|
477
485
|
default:
|
|
478
486
|
rb_raise(rb_eArgError, "unsupported argument type for color. Got type 0x%x\n", TYPE(cval) );
|
|
479
487
|
}
|
data/ext/texplay/utils.h
CHANGED
|
@@ -23,6 +23,7 @@ bool not_a_color(rgba color1);
|
|
|
23
23
|
bool is_a_color(rgba color1);
|
|
24
24
|
VALUE convert_rgba_to_rb_color(rgba * pix);
|
|
25
25
|
rgba convert_rb_color_to_rgba(VALUE cval);
|
|
26
|
+
VALUE gosu_color_class();
|
|
26
27
|
bool is_gosu_color(VALUE try_color);
|
|
27
28
|
bool is_rb_raw_color(VALUE cval);
|
|
28
29
|
bool not_rb_raw_color(VALUE cval);
|
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
|
+
- 950
|
|
9
|
+
version: 0.2.950
|
|
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-10 00:00:00 +02:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- examples/example_fill.rb
|
|
79
79
|
- examples/example_fill_old.rb
|
|
80
80
|
- examples/example_fluent.rb
|
|
81
|
+
- examples/example_font.rb
|
|
81
82
|
- examples/example_gen_eval.rb
|
|
82
83
|
- examples/example_hash_arguments.rb
|
|
83
84
|
- examples/example_ippa.rb
|