texplay 0.2.1-x86-mswin32-60 → 0.2.2-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/README.markdown +35 -0
- data/README1st +1 -1
- data/Rakefile +87 -85
- data/examples/example_alpha_blend.rb +1 -1
- data/examples/example_bezier.rb +4 -13
- data/examples/example_color_control.rb +3 -2
- data/examples/example_color_transform.rb +3 -3
- data/examples/example_dup.rb +1 -1
- data/examples/example_each.rb +1 -1
- data/examples/example_effect.rb +1 -1
- data/examples/example_fill.rb +4 -9
- data/examples/example_fill_old.rb +1 -1
- data/examples/example_fluent.rb +1 -1
- data/examples/example_gen_eval.rb +1 -1
- data/examples/example_hash_arguments.rb +1 -1
- data/examples/example_melt.rb +1 -1
- data/examples/example_polyline.rb +1 -1
- data/examples/example_simple.rb +4 -1
- data/examples/example_splice.rb +33 -0
- data/examples/example_sync.rb +1 -1
- data/examples/example_turtle.rb +2 -2
- data/lib/ctexplay.18.so +0 -0
- data/lib/ctexplay.19.so +0 -0
- data/lib/texplay-contrib.rb +8 -8
- data/lib/texplay.rb +7 -7
- data/src/Makefile +93 -62
- data/src/actions.c +80 -55
- data/src/actions.obj +0 -0
- data/src/bindings.c +2 -2
- data/src/bindings.obj +0 -0
- data/src/cache.obj +0 -0
- data/src/ctexplay-i386-mswin32.exp +0 -0
- data/src/ctexplay-i386-mswin32.lib +0 -0
- data/src/ctexplay-i386-mswin32.pdb +0 -0
- data/src/ctexplay.so +0 -0
- data/src/gen_eval.obj +0 -0
- data/src/mkmf.log +33 -18
- data/src/object2module.obj +0 -0
- data/src/texplay.c +1 -1
- data/src/texplay.obj +0 -0
- data/src/utils.c +6 -5
- data/src/utils.obj +0 -0
- data/src/vc60.pdb +0 -0
- metadata +4 -9
- data/README +0 -21
- data/examples/basic.rb +0 -48
- data/examples/basic2.rb +0 -37
- data/examples/benchmark.rb +0 -299
- data/examples/specs.rb +0 -240
- data/examples/test.rb +0 -70
- data/examples/test2.rb +0 -72
data/src/Makefile
CHANGED
@@ -4,56 +4,76 @@ SHELL = /bin/sh
|
|
4
4
|
#### Start of system configuration section. ####
|
5
5
|
|
6
6
|
srcdir = .
|
7
|
-
topdir = c:/
|
8
|
-
hdrdir =
|
9
|
-
|
7
|
+
topdir = c:/ruby191/include/ruby-1.9.1
|
8
|
+
hdrdir = c:/ruby191/include/ruby-1.9.1
|
9
|
+
arch_hdrdir = c:/ruby191/include/ruby-1.9.1/$(arch)
|
10
|
+
VPATH = $(srcdir);$(arch_hdrdir)/ruby;$(hdrdir)/ruby
|
10
11
|
|
11
12
|
DESTDIR = c:
|
12
|
-
prefix = $(DESTDIR)/
|
13
|
+
prefix = $(DESTDIR)/ruby191
|
13
14
|
exec_prefix = $(prefix)
|
14
|
-
|
15
|
-
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
16
|
-
archdir = $(rubylibdir)/$(arch)
|
15
|
+
bindir = $(exec_prefix)/bin
|
17
16
|
sbindir = $(exec_prefix)/sbin
|
17
|
+
libexecdir = $(exec_prefix)/libexec
|
18
18
|
datadir = $(prefix)/share
|
19
|
-
includedir = $(prefix)/include
|
20
|
-
infodir = $(prefix)/info
|
21
19
|
sysconfdir = $(prefix)/etc
|
22
|
-
mandir = $(prefix)/man
|
23
|
-
libdir = $(exec_prefix)/lib
|
24
20
|
sharedstatedir = $(DESTDIR)/etc
|
25
|
-
oldincludedir = $(DESTDIR)/usr/include
|
26
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
27
21
|
localstatedir = $(DESTDIR)/var
|
28
|
-
|
22
|
+
libdir = $(exec_prefix)/lib
|
23
|
+
includedir = $(prefix)/include
|
24
|
+
oldincludedir = $(DESTDIR)/usr/include
|
25
|
+
infodir = $(prefix)/info
|
26
|
+
mandir = $(prefix)/man
|
27
|
+
sitedir = $(prefix)/lib/$(RUBY_INSTALL_NAME)/site_ruby
|
28
|
+
vendordir = $(prefix)/lib/$(RUBY_INSTALL_NAME)/vendor_ruby
|
29
|
+
rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
|
30
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
31
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
32
|
+
rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
|
33
|
+
archdir = $(rubylibdir)/$(arch)
|
29
34
|
sitelibdir = $(sitedir)/$(ruby_version)
|
30
|
-
|
35
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
37
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
31
38
|
|
32
39
|
CC = cl -nologo
|
40
|
+
CXX = $(CC)
|
33
41
|
LIBRUBY = $(RUBY_SO_NAME).lib
|
34
42
|
LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
|
35
43
|
LIBRUBYARG_SHARED = $(LIBRUBY)
|
36
44
|
LIBRUBYARG_STATIC = $(LIBRUBY_A)
|
45
|
+
OUTFLAG = -Fe
|
46
|
+
COUTFLAG = -Fo
|
37
47
|
|
38
48
|
RUBY_EXTCONF_H =
|
39
|
-
|
40
|
-
|
49
|
+
cflags =
|
50
|
+
optflags =
|
51
|
+
debugflags =
|
52
|
+
warnflags =
|
53
|
+
CFLAGS = -MD -Zi -O2b2xg- -G6 -Zm600
|
54
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
41
55
|
DEFS =
|
42
|
-
CPPFLAGS =
|
43
|
-
CXXFLAGS = $(CFLAGS)
|
44
|
-
|
56
|
+
CPPFLAGS =
|
57
|
+
CXXFLAGS = $(CFLAGS) -MD -Zi -O2b2xg- -G6 -Zm600
|
58
|
+
ldflags = -incremental:no -debug -opt:ref -opt:icf
|
59
|
+
dldflags = -incremental:no -debug -opt:ref -opt:icf -dll $(LIBPATH)
|
60
|
+
archflag =
|
61
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
45
62
|
LDSHARED = cl -nologo -LD
|
63
|
+
LDSHAREDXX = $(LDSHARED)
|
46
64
|
AR = lib -nologo
|
47
65
|
EXEEXT = .exe
|
48
66
|
|
49
67
|
RUBY_INSTALL_NAME = ruby
|
50
|
-
RUBY_SO_NAME = msvcrt-
|
68
|
+
RUBY_SO_NAME = msvcrt-ruby191
|
51
69
|
arch = i386-mswin32
|
52
70
|
sitearch = i386-msvcrt
|
53
|
-
ruby_version = 1.
|
54
|
-
ruby = c:/
|
71
|
+
ruby_version = 1.9.1
|
72
|
+
ruby = c:/ruby191/bin/ruby
|
55
73
|
RUBY = $(ruby:/=\)
|
56
74
|
RM = $(RUBY) -run -e rm -- -f
|
75
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
76
|
+
RMDIRS = $(RUBY) -run -e rmdir -- -p
|
57
77
|
MAKEDIRS = @$(RUBY) -run -e mkdir -- -p
|
58
78
|
INSTALL = @$(RUBY) -run -e install -- -vp
|
59
79
|
INSTALL_PROG = $(INSTALL) -m 0755
|
@@ -70,6 +90,7 @@ DEFFILE = $(TARGET)-$(arch).def
|
|
70
90
|
|
71
91
|
CLEANFILES = mkmf.log
|
72
92
|
DISTCLEANFILES = vc*.pdb $(DEFFILE)
|
93
|
+
DISTCLEANDIRS =
|
73
94
|
|
74
95
|
extout =
|
75
96
|
extout_prefix =
|
@@ -83,25 +104,35 @@ DLLIB = $(TARGET).so
|
|
83
104
|
EXTSTATIC =
|
84
105
|
STATIC_LIB =
|
85
106
|
|
107
|
+
BINDIR = $(bindir)
|
86
108
|
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
87
109
|
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
88
110
|
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
111
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
112
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
89
113
|
|
90
114
|
TARGET_SO = $(DLLIB)
|
91
|
-
CLEANLIBS = $(TARGET).so
|
92
|
-
CLEANOBJS = *.obj
|
115
|
+
CLEANLIBS = $(TARGET).so
|
116
|
+
CLEANOBJS = *.obj $(TARGET).exp $(TARGET).lib $(TARGET).pdb *.bak
|
93
117
|
|
94
|
-
all:
|
95
|
-
static:
|
118
|
+
all: $(DLLIB)
|
119
|
+
static: $(STATIC_LIB)
|
96
120
|
|
97
|
-
clean
|
121
|
+
clean-rb-default::
|
122
|
+
clean-rb::
|
123
|
+
clean-so::
|
124
|
+
clean: clean-so clean-rb-default clean-rb
|
98
125
|
@-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
|
99
126
|
|
100
|
-
distclean
|
127
|
+
distclean-rb-default::
|
128
|
+
distclean-rb::
|
129
|
+
distclean-so::
|
130
|
+
distclean: clean distclean-so distclean-rb-default distclean-rb
|
101
131
|
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
102
132
|
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
|
133
|
+
@-$(RMDIRS) $(DISTCLEANDIRS:/=\)
|
103
134
|
|
104
|
-
realclean:
|
135
|
+
realclean: distclean
|
105
136
|
install: install-so install-rb
|
106
137
|
|
107
138
|
install-so: $(RUBYARCHDIR)
|
@@ -121,61 +152,61 @@ site-install-rb: install-rb
|
|
121
152
|
|
122
153
|
.SUFFIXES: .c .m .cc .cxx .cpp .obj
|
123
154
|
|
124
|
-
{$(
|
125
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
155
|
+
{$(hdrdir)}.cc.obj:
|
156
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
126
157
|
|
127
|
-
{$(topdir)}.cc
|
128
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
158
|
+
{$(topdir)}.cc.obj:
|
159
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
129
160
|
|
130
|
-
{$(
|
131
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
161
|
+
{$(srcdir)}.cc.obj:
|
162
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
132
163
|
|
133
164
|
.cc.obj:
|
134
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
165
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
135
166
|
|
136
|
-
{$(
|
137
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
167
|
+
{$(hdrdir)}.cxx.obj:
|
168
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
138
169
|
|
139
|
-
{$(topdir)}.cxx
|
140
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
170
|
+
{$(topdir)}.cxx.obj:
|
171
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
141
172
|
|
142
|
-
{$(
|
143
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
173
|
+
{$(srcdir)}.cxx.obj:
|
174
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
144
175
|
|
145
176
|
.cxx.obj:
|
146
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
177
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
147
178
|
|
148
|
-
{$(
|
149
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
179
|
+
{$(hdrdir)}.cpp.obj:
|
180
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
150
181
|
|
151
|
-
{$(topdir)}.cpp
|
152
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
182
|
+
{$(topdir)}.cpp.obj:
|
183
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
153
184
|
|
154
|
-
{$(
|
155
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
185
|
+
{$(srcdir)}.cpp.obj:
|
186
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
156
187
|
|
157
188
|
.cpp.obj:
|
158
|
-
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
|
189
|
+
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
|
159
190
|
|
160
|
-
{$(
|
161
|
-
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
|
191
|
+
{$(hdrdir)}.c.obj:
|
192
|
+
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
|
162
193
|
|
163
|
-
{$(topdir)}.c
|
164
|
-
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
|
194
|
+
{$(topdir)}.c.obj:
|
195
|
+
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
|
165
196
|
|
166
|
-
{$(
|
167
|
-
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
|
197
|
+
{$(srcdir)}.c.obj:
|
198
|
+
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
|
168
199
|
|
169
200
|
.c.obj:
|
170
|
-
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
|
201
|
+
$(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
|
171
202
|
|
172
|
-
$(DLLIB): $(DEFFILE) $(OBJS)
|
173
|
-
@-$(RM)
|
174
|
-
$(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) $(DLDFLAGS)
|
203
|
+
$(DLLIB): $(DEFFILE) $(OBJS) Makefile
|
204
|
+
@-$(RM) $(@:/=\)
|
205
|
+
$(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) -link $(DLDFLAGS) -implib:$(*F:.so=)-$(arch).lib -pdb:$(*F:.so=)-$(arch).pdb -def:$(DEFFILE)
|
175
206
|
|
176
207
|
|
177
208
|
|
178
209
|
$(DEFFILE):
|
179
210
|
$(RUBY) -e "puts 'EXPORTS', 'Init_$(TARGET)'" > $@
|
180
211
|
|
181
|
-
$(OBJS): {.;$(
|
212
|
+
$(OBJS): {.;$(VPATH)}$(hdrdir)/ruby.h {.;$(VPATH)}$(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|
data/src/actions.c
CHANGED
@@ -23,7 +23,6 @@ static void draw_epilogue(action_struct * cur, texture_info * tex, bool primary)
|
|
23
23
|
|
24
24
|
static void prepare_fill_texture(action_struct * cur);
|
25
25
|
static void prepare_color_control(action_struct * cur);
|
26
|
-
static rgba exec_color_control_proc(action_struct * cur, texture_info * tex, int x, int y);
|
27
26
|
static void set_pixel_color_with_style(action_struct * payload, texture_info * tex,
|
28
27
|
int x, int y);
|
29
28
|
/* end helpers */
|
@@ -225,12 +224,13 @@ ngon_do_action(int x, int y, int r, int num_sides, texture_info * tex, VALUE has
|
|
225
224
|
int x1, y1, x2, y2, x0, y0;
|
226
225
|
int n;
|
227
226
|
int thickness;
|
227
|
+
float angle = 0;
|
228
228
|
|
229
229
|
draw_prologue(&cur, tex, x - r, y - r,
|
230
230
|
x + r, y + r, &hash_arg, sync_mode, primary, &payload);
|
231
231
|
|
232
232
|
|
233
|
-
if(is_a_hash(hash_arg))
|
233
|
+
if(is_a_hash(hash_arg)) {
|
234
234
|
if(RTEST(get_from_hash(hash_arg, "thickness"))) {
|
235
235
|
thickness = NUM2INT(get_from_hash(hash_arg, "thickness"));
|
236
236
|
|
@@ -241,13 +241,18 @@ ngon_do_action(int x, int y, int r, int num_sides, texture_info * tex, VALUE has
|
|
241
241
|
cur.ymax = y + r + thickness / 2;
|
242
242
|
}
|
243
243
|
|
244
|
+
if(RTEST(get_from_hash(hash_arg, "start_angle"))) {
|
245
|
+
angle = NUM2INT(get_from_hash(hash_arg, "start_angle")) / 360.0 * 2 * PI;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
244
249
|
/* calculate first point */
|
245
|
-
x0 = x1 = x + r;
|
246
|
-
y0 = y1 = y;
|
250
|
+
x0 = x1 = x + r * cos(angle);
|
251
|
+
y0 = y1 = y + r * sin(angle);
|
247
252
|
|
248
253
|
for(n = 0; n < num_sides; n++) {
|
249
|
-
x2 = x + r * cos((2 * PI / num_sides) * n);
|
250
|
-
y2 = y + r * sin((2 * PI / num_sides) * n);
|
254
|
+
x2 = x + r * cos((2 * PI / num_sides) * n + angle);
|
255
|
+
y2 = y + r * sin((2 * PI / num_sides) * n + angle);
|
251
256
|
|
252
257
|
line_do_action(x1, y1, x2, y2, tex, hash_arg, no_sync, false, payload);
|
253
258
|
|
@@ -919,10 +924,11 @@ splice_do_action(int x0, int y0, int cx1, int cy1, int cx2, int cy2, texture_inf
|
|
919
924
|
payload->color = get_pixel_color_from_chunk(image_buf, xbound, ybound, x, y);
|
920
925
|
|
921
926
|
if(has_chroma) {
|
922
|
-
bool
|
923
|
-
|
924
|
-
|
925
|
-
|
927
|
+
bool chroma_match = cmp_color(payload->color, chromakey);
|
928
|
+
|
929
|
+
/* look at released 0.2.0 code to see how USED to do this.
|
930
|
+
this is now a simplified boolean expression */
|
931
|
+
if(chroma_match == inverse_chroma)
|
926
932
|
set_pixel_color_with_style(payload, tex, x0 + x, y0 + y);
|
927
933
|
}
|
928
934
|
else
|
@@ -1175,18 +1181,23 @@ prepare_color_control(action_struct * cur)
|
|
1175
1181
|
}
|
1176
1182
|
|
1177
1183
|
static rgba
|
1178
|
-
exec_color_control_proc(action_struct * cur, texture_info * tex, int x, int y)
|
1184
|
+
exec_color_control_proc(action_struct * cur, texture_info * tex, int x, int y, rgba blended_pixel)
|
1179
1185
|
{
|
1180
1186
|
int arity = cur->pen.color_control_arity;
|
1181
1187
|
VALUE proc = cur->pen.color_control_proc;
|
1182
1188
|
rgba old_color = get_pixel_color(tex, x, y);
|
1183
|
-
rgba current_color =
|
1189
|
+
rgba current_color = blended_pixel;
|
1184
1190
|
rgba new_color;
|
1185
1191
|
|
1186
1192
|
if(!cur->pen.has_color_control_proc)
|
1187
1193
|
rb_raise(rb_eRuntimeError, "needs a proc");
|
1188
1194
|
|
1189
1195
|
switch(arity) {
|
1196
|
+
case -1:
|
1197
|
+
case 0:
|
1198
|
+
new_color = convert_rb_color_to_rgba(rb_funcall(proc, rb_intern("call"), 0));
|
1199
|
+
break;
|
1200
|
+
|
1190
1201
|
case 1:
|
1191
1202
|
new_color = convert_rb_color_to_rgba(rb_funcall(proc, rb_intern("call"), arity,
|
1192
1203
|
convert_rgba_to_rb_color(&old_color)));
|
@@ -1231,20 +1242,57 @@ prepare_fill_texture(action_struct * payload)
|
|
1231
1242
|
}
|
1232
1243
|
}
|
1233
1244
|
|
1234
|
-
|
1245
|
+
|
1246
|
+
/* TODO: reimplement using SSE2 */
|
1247
|
+
static rgba
|
1235
1248
|
apply_color_control_transform(action_struct * payload, texture_info * tex, int x, int y)
|
1249
|
+
|
1236
1250
|
{
|
1237
|
-
|
1251
|
+
rgba transformed_color;
|
1252
|
+
|
1253
|
+
transformed_color = get_pixel_color(tex, x, y);
|
1238
1254
|
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1255
|
+
transformed_color.red += payload->pen.color_add.red;
|
1256
|
+
transformed_color.green += payload->pen.color_add.green;
|
1257
|
+
transformed_color.blue += payload->pen.color_add.blue;
|
1258
|
+
transformed_color.alpha += payload->pen.color_add.alpha;
|
1259
|
+
|
1260
|
+
transformed_color.red *= payload->pen.color_mult.red;
|
1261
|
+
transformed_color.green *= payload->pen.color_mult.green;
|
1262
|
+
transformed_color.blue *= payload->pen.color_mult.blue;
|
1263
|
+
transformed_color.alpha *= payload->pen.color_mult.alpha;
|
1264
|
+
|
1265
|
+
return transformed_color;
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
static rgba
|
1269
|
+
apply_alpha_blend(action_struct * payload, texture_info * tex, int x, int y, rgba blended_pixel)
|
1270
|
+
{
|
1271
|
+
rgba dest_pixel = get_pixel_color(tex, x, y);
|
1272
|
+
rgba finished_pixel;
|
1273
|
+
|
1274
|
+
|
1275
|
+
if(not_a_color(blended_pixel))
|
1276
|
+
return blended_pixel;
|
1277
|
+
|
1278
|
+
/* alpha blending is nothing more than a weighted average of src and dest pixels
|
1279
|
+
based on source alpha value */
|
1280
|
+
/* NB: destination alpha value is ignored */
|
1281
|
+
|
1282
|
+
/** TO DO: rewrite this using sse2 instructions **/
|
1283
|
+
finished_pixel.red = blended_pixel.alpha * blended_pixel.red + (1 - blended_pixel.alpha)
|
1284
|
+
* dest_pixel.red;
|
1285
|
+
|
1286
|
+
finished_pixel.green = blended_pixel.alpha * blended_pixel.green + (1 - blended_pixel.alpha)
|
1287
|
+
* dest_pixel.green;
|
1288
|
+
|
1289
|
+
finished_pixel.blue = blended_pixel.alpha * blended_pixel.blue + (1 - blended_pixel.alpha)
|
1290
|
+
* dest_pixel.blue;
|
1291
|
+
|
1292
|
+
finished_pixel.alpha = blended_pixel.alpha;
|
1293
|
+
|
1294
|
+
|
1295
|
+
return finished_pixel;
|
1248
1296
|
}
|
1249
1297
|
|
1250
1298
|
static void
|
@@ -1253,53 +1301,30 @@ set_pixel_color_with_style(action_struct * payload, texture_info * tex, int x, i
|
|
1253
1301
|
|
1254
1302
|
rgba blended_pixel;
|
1255
1303
|
|
1304
|
+
blended_pixel = payload->color;
|
1305
|
+
|
1256
1306
|
/* for color_control transform */
|
1257
1307
|
if(payload->pen.has_color_control_transform)
|
1258
|
-
apply_color_control_transform(payload, tex, x, y);
|
1308
|
+
blended_pixel = apply_color_control_transform(payload, tex, x, y);
|
1259
1309
|
|
1260
1310
|
/* for texture fill */
|
1261
1311
|
if(payload->pen.has_source_texture)
|
1262
|
-
|
1312
|
+
blended_pixel = get_pixel_color(&payload->pen.source_tex,
|
1263
1313
|
x % payload->pen.source_tex.width,
|
1264
1314
|
y % payload->pen.source_tex.height);
|
1265
1315
|
|
1266
1316
|
/* for color_control block */
|
1267
1317
|
if(payload->pen.has_color_control_proc)
|
1268
|
-
|
1318
|
+
blended_pixel = exec_color_control_proc(payload, tex, x, y, blended_pixel);
|
1269
1319
|
|
1270
1320
|
|
1271
1321
|
/* TO DO: do bitwise pixel combinations here */
|
1272
1322
|
|
1273
|
-
/*
|
1274
|
-
code below i get an interesting blurring effect in images (with alpha_blend => true)
|
1275
|
-
*/
|
1276
|
-
blended_pixel = payload->color;
|
1277
|
-
|
1278
|
-
|
1279
|
-
/* alpha blending
|
1280
|
-
TO DO: refactor into its own helper function
|
1323
|
+
/* TO DO: refactor into its own helper function
|
1281
1324
|
& rewrite using sse2 */
|
1282
|
-
if(payload->pen.alpha_blend)
|
1283
|
-
|
1284
|
-
|
1285
|
-
/* alpha blending is nothing more than a weighted average of src and dest pixels
|
1286
|
-
based on source alpha value */
|
1287
|
-
/* NB: destination alpha value is ignored */
|
1288
|
-
if(is_a_color(payload->color) && is_a_color(dest_pixel)) {
|
1289
|
-
|
1290
|
-
/** TO DO: rewrite this using sse2 instructions **/
|
1291
|
-
blended_pixel.red = payload->color.alpha * payload->color.red + (1 - payload->color.alpha)
|
1292
|
-
* dest_pixel.red;
|
1293
|
-
|
1294
|
-
blended_pixel.green = payload->color.alpha * payload->color.green + (1 - payload->color.alpha)
|
1295
|
-
* dest_pixel.green;
|
1296
|
-
|
1297
|
-
blended_pixel.blue = payload->color.alpha * payload->color.blue + (1 - payload->color.alpha)
|
1298
|
-
* dest_pixel.blue;
|
1299
|
-
|
1300
|
-
blended_pixel.alpha = payload->color.alpha;
|
1301
|
-
}
|
1302
|
-
}
|
1325
|
+
if(payload->pen.alpha_blend)
|
1326
|
+
blended_pixel = apply_alpha_blend(payload, tex, x, y, blended_pixel);
|
1327
|
+
|
1303
1328
|
|
1304
1329
|
set_pixel_color(&blended_pixel, tex, x, y);
|
1305
1330
|
}
|
data/src/actions.obj
CHANGED
Binary file
|
data/src/bindings.c
CHANGED
@@ -369,7 +369,7 @@ m_circle(int argc, VALUE * argv, VALUE self)
|
|
369
369
|
|
370
370
|
ADJUST_SELF(self);
|
371
371
|
|
372
|
-
if(argc <
|
372
|
+
if(argc < 2) rb_raise(rb_eArgError, "circle action needs at least 2 parameter");
|
373
373
|
|
374
374
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
375
375
|
|
@@ -398,7 +398,7 @@ m_ngon(int argc, VALUE * argv, VALUE self)
|
|
398
398
|
|
399
399
|
ADJUST_SELF(self);
|
400
400
|
|
401
|
-
if(argc <
|
401
|
+
if(argc < 3) rb_raise(rb_eArgError, "ngon requires at least 3 parameters (x, y, radius, num_sides)");
|
402
402
|
|
403
403
|
process_x_y_pairs(self, 1, argv, &x1, &y1);
|
404
404
|
|
data/src/bindings.obj
CHANGED
Binary file
|
data/src/cache.obj
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/src/ctexplay.so
CHANGED
Binary file
|
data/src/gen_eval.obj
CHANGED
Binary file
|
data/src/mkmf.log
CHANGED
@@ -1,18 +1,33 @@
|
|
1
|
-
have_library: checking for main() in glut32.lib... -------------------- yes
|
2
|
-
|
3
|
-
"cl -nologo -Feconftest -
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
have_library: checking for main() in glut32.lib... -------------------- yes
|
2
|
+
|
3
|
+
"cl -nologo -Feconftest -Ic:/ruby191/include/ruby-1.9.1/i386-mswin32 -Ic:/ruby191/include/ruby-1.9.1/ruby/backward -Ic:/ruby191/include/ruby-1.9.1 -I. -Ic:/ruby191/include/ruby-1.9.1 -MD -Zi -O2b2xg- -G6 -Zm600 conftest.c msvcrt-ruby191-static.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -libpath:"." -libpath:"c:/ruby191/lib" "
|
4
|
+
checked program was:
|
5
|
+
/* begin */
|
6
|
+
1: #include "ruby.h"
|
7
|
+
2:
|
8
|
+
3: #define WIN32_LEAN_AND_MEAN
|
9
|
+
4: #define WIN32
|
10
|
+
5: #include <winsock2.h>
|
11
|
+
6: #include <ws2tcpip.h>
|
12
|
+
7: #include <windows.h>
|
13
|
+
8: int main() {return 0;}
|
14
|
+
/* end */
|
15
|
+
|
16
|
+
"cl -nologo -Feconftest -Ic:/ruby191/include/ruby-1.9.1/i386-mswin32 -Ic:/ruby191/include/ruby-1.9.1/ruby/backward -Ic:/ruby191/include/ruby-1.9.1 -I. -Ic:/ruby191/include/ruby-1.9.1 -MD -Zi -O2b2xg- -G6 -Zm600 conftest.c msvcrt-ruby191-static.lib glut32.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -libpath:"." -libpath:"c:/ruby191/lib" "
|
17
|
+
checked program was:
|
18
|
+
/* begin */
|
19
|
+
1: #include "ruby.h"
|
20
|
+
2:
|
21
|
+
3: #define WIN32_LEAN_AND_MEAN
|
22
|
+
4: #define WIN32
|
23
|
+
5: #include <winsock2.h>
|
24
|
+
6: #include <ws2tcpip.h>
|
25
|
+
7: #include <windows.h>
|
26
|
+
8:
|
27
|
+
9: /*top*/
|
28
|
+
10: int main() {return 0;}
|
29
|
+
11: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
|
30
|
+
/* end */
|
31
|
+
|
32
|
+
--------------------
|
33
|
+
|
data/src/object2module.obj
CHANGED
Binary file
|
data/src/texplay.c
CHANGED
@@ -68,7 +68,7 @@ Init_ctexplay() {
|
|
68
68
|
rb_define_method(jm_Module, "refresh_cache", m_cache_refresh, 0);
|
69
69
|
|
70
70
|
/* a constant containing the sidelength of largest allowable quad */
|
71
|
-
rb_define_const(jm_Module, "TP_MAX_QUAD_SIZE", INT2FIX(max_quad_size()));
|
71
|
+
rb_define_const(jm_Module, "TP_MAX_QUAD_SIZE", INT2FIX(max_quad_size() - 2));
|
72
72
|
|
73
73
|
/* singleton method for creating & removing macros */
|
74
74
|
rb_define_singleton_method(jm_Module, "create_macro", M_create_macro, 1);
|
data/src/texplay.obj
CHANGED
Binary file
|
data/src/utils.c
CHANGED
@@ -585,9 +585,9 @@ ComputeOutCode (int x, int y, int xmin, int ymin, int xmax, int ymax)
|
|
585
585
|
return code;
|
586
586
|
}
|
587
587
|
|
588
|
-
|
589
|
-
|
590
|
-
|
588
|
+
/** Cohen-Sutherland clipping algorithm clips a line from
|
589
|
+
P0 = (x0, y0) to P1 = (x1, y1) against a rectangle with
|
590
|
+
diagonal from (xmin, ymin) to (xmax, ymax). **/
|
591
591
|
void
|
592
592
|
cohen_sutherland_clip (int * x0, int * y0,int * x1, int * y1, int xmin, int ymin,
|
593
593
|
int xmax, int ymax)
|
@@ -762,7 +762,7 @@ check_for_texture_info(VALUE image)
|
|
762
762
|
rb_raise(rb_eException, "Error: gl_tex_info returns nil for %s (%i x %i). Could be caused by "
|
763
763
|
"very large image or Gosu bug. Try updating Gosu or use a smaller image. Note: TexPlay should"
|
764
764
|
" be able to work with %i x %i images.",
|
765
|
-
StringValuePtr(image_name), width, height, max_quad_size(), max_quad_size());
|
765
|
+
StringValuePtr(image_name), width, height, max_quad_size() - 2, max_quad_size() - 2);
|
766
766
|
}
|
767
767
|
|
768
768
|
return info;
|
@@ -897,7 +897,8 @@ bool
|
|
897
897
|
is_a_point(VALUE try_point)
|
898
898
|
{
|
899
899
|
/* if it responds to 'x' it's near enough (technically must respond to x AND y) */
|
900
|
-
|
900
|
+
/* added the is_a_num() check due to WEIRD bug where FIXNUMS were responding to the 'x' method (wtf?) but returning nil when invoked */
|
901
|
+
if(rb_respond_to(try_point, rb_intern("x")) && !is_a_num(try_point))
|
901
902
|
return true;
|
902
903
|
|
903
904
|
return false;
|
data/src/utils.obj
CHANGED
Binary file
|
data/src/vc60.pdb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- John Mair (banisterfiend)
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-09 00:00:00 +12:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ extra_rdoc_files: []
|
|
32
32
|
|
33
33
|
files:
|
34
34
|
- Rakefile
|
35
|
-
- README
|
35
|
+
- README.markdown
|
36
36
|
- CHANGELOG
|
37
37
|
- README1st
|
38
38
|
- lib/texplay.rb
|
@@ -69,9 +69,6 @@ files:
|
|
69
69
|
- src/utils.h
|
70
70
|
- src/utils.obj
|
71
71
|
- src/vc60.pdb
|
72
|
-
- examples/basic.rb
|
73
|
-
- examples/basic2.rb
|
74
|
-
- examples/benchmark.rb
|
75
72
|
- examples/common.rb
|
76
73
|
- examples/example_alpha_blend.rb
|
77
74
|
- examples/example_bezier.rb
|
@@ -88,11 +85,9 @@ files:
|
|
88
85
|
- examples/example_melt.rb
|
89
86
|
- examples/example_polyline.rb
|
90
87
|
- examples/example_simple.rb
|
88
|
+
- examples/example_splice.rb
|
91
89
|
- examples/example_sync.rb
|
92
90
|
- examples/example_turtle.rb
|
93
|
-
- examples/specs.rb
|
94
|
-
- examples/test.rb
|
95
|
-
- examples/test2.rb
|
96
91
|
- examples/media/empty2.png
|
97
92
|
- examples/media/gosu.png
|
98
93
|
- examples/media/maria.png
|