texplay 0.2.983pre2-i386-mswin32 → 0.3.0-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/Rakefile +41 -49
  2. data/examples/common.rb +13 -2
  3. data/examples/example_alpha_blend.rb +1 -3
  4. data/examples/example_bezier.rb +1 -2
  5. data/examples/example_blank.rb +1 -3
  6. data/examples/example_cache.rb +1 -3
  7. data/examples/example_color_transform.rb +1 -3
  8. data/examples/example_color_transform_circle.rb +1 -3
  9. data/examples/example_darken.rb +1 -4
  10. data/examples/example_dup.rb +1 -4
  11. data/examples/example_each.rb +1 -4
  12. data/examples/example_effect.rb +1 -2
  13. data/examples/example_fill.rb +1 -2
  14. data/examples/example_fill_old.rb +1 -2
  15. data/examples/example_fluent.rb +1 -3
  16. data/examples/example_font.rb +1 -3
  17. data/examples/example_gen_eval.rb +1 -2
  18. data/examples/example_hash_arguments.rb +1 -2
  19. data/examples/example_ippa.rb +1 -3
  20. data/examples/example_light.rb +1 -3
  21. data/examples/example_light_multiply.rb +1 -3
  22. data/examples/example_lsystem.rb +1 -1
  23. data/examples/example_melt.rb +1 -3
  24. data/examples/example_meyet.rb +1 -3
  25. data/examples/example_polyline.rb +1 -2
  26. data/examples/example_scale.rb +1 -3
  27. data/examples/example_select.rb +1 -3
  28. data/examples/example_select2.rb +1 -4
  29. data/examples/example_simple.rb +1 -3
  30. data/examples/example_splice.rb +2 -4
  31. data/examples/example_sync.rb +1 -2
  32. data/examples/example_tiles.rb +1 -3
  33. data/examples/example_trace.rb +1 -2
  34. data/examples/example_transparent.rb +1 -3
  35. data/examples/example_transparent2.rb +1 -3
  36. data/examples/example_transparent3.rb +1 -3
  37. data/examples/example_turtle.rb +1 -2
  38. data/examples/example_weird.rb +1 -2
  39. data/examples/example_window_render_to_image.rb +41 -0
  40. data/examples/example_window_to_blob.rb +2 -5
  41. data/ext/texplay/actions.c +1006 -0
  42. data/ext/texplay/actions.h +60 -0
  43. data/ext/texplay/bindings.c +1186 -0
  44. data/ext/texplay/bindings.h +46 -0
  45. data/ext/texplay/cache.c +118 -0
  46. data/ext/texplay/cache.h +24 -0
  47. data/ext/texplay/compat.h +27 -0
  48. data/ext/texplay/extconf.rb +28 -0
  49. data/ext/texplay/gen_eval.c +211 -0
  50. data/ext/texplay/gen_eval.h +20 -0
  51. data/ext/texplay/graphics_utils.c +1244 -0
  52. data/ext/texplay/graphics_utils.h +22 -0
  53. data/ext/texplay/object2module.c +171 -0
  54. data/ext/texplay/object2module.h +11 -0
  55. data/ext/texplay/texplay.c +216 -0
  56. data/ext/texplay/texplay.h +148 -0
  57. data/ext/texplay/utils.c +887 -0
  58. data/ext/texplay/utils.h +153 -0
  59. data/lib/1.8/texplay.so +0 -0
  60. data/lib/1.9/texplay.so +0 -0
  61. data/lib/texplay.rb +271 -165
  62. data/lib/texplay/c_function_docs.rb +189 -0
  63. data/lib/texplay/version.rb +1 -1
  64. metadata +33 -21
  65. data/examples/example_window_to_texture.rb +0 -55
  66. data/lib/texplay/patches.rb +0 -4
@@ -0,0 +1,22 @@
1
+ #ifndef GUARD_GRAPHICS_UTILS_H
2
+ #define GUARD_GRAPHICS_UTILS_H
3
+
4
+ void update_lazy_bounds(action_struct * cur, texture_info * tex);
5
+ void update_bounds(action_struct * cur, int xmin, int ymin, int xmax, int ymax);
6
+ void set_local_bounds(action_struct * cur, int xmin, int ymin, int xmax, int ymax, texture_info * tex);
7
+
8
+ void draw_prologue(action_struct * cur, texture_info * tex, int xmin, int ymin, int xmax, int ymax, VALUE * hash_arg,
9
+ sync sync_mode, bool primary, action_struct ** payload_ptr);
10
+ void draw_epilogue(action_struct * cur, texture_info * tex, bool primary);
11
+
12
+ void set_pixel_color_with_style(action_struct * payload, texture_info * tex, int x, int y);
13
+ void set_pixel_color(rgba * pixel_color, texture_info * tex, int x, int y);
14
+
15
+ rgba get_pixel_color_from_chunk(float * chunk, int width, int height, int x, int y);
16
+ rgba get_pixel_color(texture_info * tex, int x, int y);
17
+ float* get_pixel_data(texture_info * tex, int x, int y);
18
+
19
+ /* create a blank gosu image of width and height */
20
+ VALUE create_image(VALUE window, int width, int height);
21
+
22
+ #endif
@@ -0,0 +1,171 @@
1
+ /* object2module.c */
2
+ /* (C) John Mair 2009
3
+ * This program is distributed under the terms of the MIT License
4
+ * */
5
+
6
+ #include <ruby.h>
7
+ #include "compat.h"
8
+
9
+ #ifdef RUBY_19
10
+ # include <ruby/st.h>
11
+ #else
12
+ # include <st.h>
13
+ #endif
14
+
15
+ /* class creation. from class.c in 1.9.1 */
16
+ #ifdef RUBY_19
17
+ static VALUE
18
+ class_alloc(VALUE flags, VALUE klass)
19
+ {
20
+ rb_classext_t *ext = ALLOC(rb_classext_t);
21
+ NEWOBJ(obj, struct RClass);
22
+ OBJSETUP(obj, klass, flags);
23
+ obj->ptr = ext;
24
+ RCLASS_IV_TBL(obj) = 0;
25
+ RCLASS_M_TBL(obj) = 0;
26
+ RCLASS_SUPER(obj) = 0;
27
+ RCLASS_IV_INDEX_TBL(obj) = 0;
28
+ return (VALUE)obj;
29
+ }
30
+ #endif
31
+
32
+ /* a modified version of include_class_new from class.c */
33
+ static VALUE
34
+ j_class_new(VALUE module, VALUE sup)
35
+ {
36
+
37
+ #ifdef RUBY_19
38
+ VALUE klass = class_alloc(T_ICLASS, rb_cClass);
39
+ #else
40
+ NEWOBJ(klass, struct RClass);
41
+ OBJSETUP(klass, rb_cClass, T_ICLASS);
42
+ #endif
43
+
44
+ if (BUILTIN_TYPE(module) == T_ICLASS) {
45
+ module = KLASS_OF(module);
46
+ }
47
+
48
+ if (!RCLASS_IV_TBL(module)) {
49
+
50
+ RCLASS_IV_TBL(module) = (struct st_table *)st_init_numtable();
51
+ }
52
+
53
+ /* assign iv_tbl, m_tbl and super */
54
+ RCLASS_IV_TBL(klass) = RCLASS_IV_TBL(module);
55
+ RCLASS_SUPER(klass) = sup;
56
+ if(TYPE(module) != T_OBJECT) {
57
+
58
+ RCLASS_M_TBL(klass) = RCLASS_M_TBL(module);
59
+ }
60
+ else {
61
+ RCLASS_M_TBL(klass) = RCLASS_M_TBL(CLASS_OF(module));
62
+ }
63
+
64
+ /* */
65
+
66
+ if (TYPE(module) == T_ICLASS) {
67
+ KLASS_OF(klass) = KLASS_OF(module);
68
+ }
69
+ else {
70
+ KLASS_OF(klass) = module;
71
+ }
72
+
73
+ if(TYPE(module) != T_OBJECT) {
74
+ OBJ_INFECT(klass, module);
75
+ OBJ_INFECT(klass, sup);
76
+ }
77
+ return (VALUE)klass;
78
+ }
79
+
80
+ VALUE
81
+ rb_to_module(VALUE self)
82
+ {
83
+ VALUE rclass, chain_start, jcur, klass;
84
+
85
+ switch(BUILTIN_TYPE(self)) {
86
+ case T_MODULE:
87
+ return self;
88
+ case T_CLASS:
89
+ klass = self;
90
+ break;
91
+ case T_OBJECT:
92
+ default:
93
+ klass = rb_singleton_class(self);
94
+ }
95
+
96
+ chain_start = j_class_new(klass, rb_cObject);
97
+
98
+ KLASS_OF(chain_start) = rb_cModule;
99
+ RBASIC(chain_start)->flags = T_MODULE;
100
+
101
+ jcur = chain_start;
102
+ for(rclass = RCLASS_SUPER(klass); rclass != rb_cObject;
103
+ rclass = RCLASS_SUPER(rclass)) {
104
+
105
+ RCLASS_SUPER(jcur) = j_class_new(rclass, rb_cObject);
106
+ jcur = RCLASS_SUPER(jcur);
107
+ }
108
+
109
+ RCLASS_SUPER(jcur) = (VALUE)NULL;
110
+
111
+ return chain_start;
112
+ }
113
+
114
+ VALUE
115
+ rb_reset_tbls(VALUE self)
116
+ {
117
+ RCLASS_IV_TBL(self) = (struct st_table *) 0;
118
+ RCLASS_M_TBL(self) = (struct st_table *) st_init_numtable();
119
+ return Qnil;
120
+ }
121
+
122
+ /* cannot simply forward to gen_include as need to invoke 'extended' hook */
123
+ VALUE
124
+ rb_gen_extend(int argc, VALUE * argv, VALUE self)
125
+ {
126
+ int i;
127
+
128
+ if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
129
+
130
+ rb_singleton_class(self);
131
+
132
+ for(i = 0; i < argc; i++) {
133
+ VALUE mod = rb_to_module(argv[i]);
134
+ rb_funcall(mod, rb_intern("extend_object"), 1, self);
135
+ rb_funcall(mod, rb_intern("extended"), 1, self);
136
+
137
+ /* only redirect if argv[i] is not a module */
138
+ if(argv[i] != mod) rb_reset_tbls(mod);
139
+ }
140
+
141
+ return self;
142
+ }
143
+
144
+ VALUE
145
+ rb_gen_include(int argc, VALUE * argv, VALUE self)
146
+ {
147
+ int i;
148
+
149
+ if (argc == 0) rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
150
+
151
+ for(i = 0; i < argc; i++) {
152
+ VALUE mod = rb_to_module(argv[i]);
153
+ rb_funcall(mod, rb_intern("append_features"), 1, self);
154
+ rb_funcall(mod, rb_intern("included"), 1, self);
155
+
156
+ if(argv[i] != mod) rb_reset_tbls(mod);
157
+ }
158
+
159
+ return self;
160
+ }
161
+
162
+
163
+ void Init_object2module()
164
+ {
165
+
166
+ rb_define_method(rb_cObject, "to_module", rb_to_module , 0);
167
+ rb_define_method(rb_cObject, "gen_extend", rb_gen_extend, -1);
168
+ rb_define_method(rb_cModule, "gen_include", rb_gen_include, -1);
169
+ rb_define_method(rb_cModule, "reset_tbls", rb_reset_tbls, 0);
170
+ }
171
+
@@ -0,0 +1,11 @@
1
+ /* object2module.h */
2
+
3
+ #ifndef GUARD_OBJECT2MODULE_H
4
+ #define GUARD_OBJECT2MODULE_H
5
+
6
+ VALUE rb_gen_include(int argc, VALUE * argv, VALUE self);
7
+ VALUE rb_gen_extend(int argc, VALUE * argv, VALUE self);
8
+ VALUE rb_to_module(VALUE self);
9
+ VALUE rb_reset_tbls(VALUE self);
10
+
11
+ #endif
@@ -0,0 +1,216 @@
1
+ /* texplay.c, light-weight alternative to rmagick for ruby */
2
+ /* (C) John Mair 2009
3
+ * This program is distributed under the terms of the MIT License
4
+ * */
5
+
6
+ #include <ruby.h>
7
+ #include <stdio.h>
8
+ #include <time.h>
9
+ #include "texplay.h"
10
+ #include "actions.h"
11
+ #include "utils.h"
12
+ #include "bindings.h"
13
+ #include "object2module.h"
14
+ #include "gen_eval.h"
15
+ #ifdef __APPLE__
16
+ # include <glut.h>
17
+ #else
18
+ # include <GL/glut.h>
19
+ #endif
20
+
21
+
22
+ /* setup ruby bindings */
23
+
24
+ /** constructor for TPPoint class **/
25
+ static VALUE m_init_TPPoint(int argc, VALUE * argv, VALUE self);
26
+ static void monkey_patch_gosu(void);
27
+ static VALUE gosu_window(void);
28
+
29
+ void
30
+ Init_texplay() {
31
+
32
+ VALUE jm_Module = rb_define_module("TexPlay");
33
+ VALUE TPPoint = rb_define_class_under(jm_Module, "TPPoint", rb_cObject);
34
+
35
+ /** define basic point class TPPoint **/
36
+ rb_attr(TPPoint, rb_intern("x"), 1, 1, Qtrue);
37
+ rb_attr(TPPoint, rb_intern("y"), 1, 1, Qtrue);
38
+ rb_define_method(TPPoint, "initialize", m_init_TPPoint, -1);
39
+ /** end of TPPoint definition **/
40
+
41
+ /* TexPlay methods */
42
+ rb_define_method(jm_Module, "paint", m_paint, -1);
43
+ rb_define_method(jm_Module, "get_pixel", m_getpixel, -1);
44
+ rb_define_method(jm_Module, "circle", m_circle, -1);
45
+ rb_define_method(jm_Module, "line", m_line, -1);
46
+ rb_define_method(jm_Module, "rect", m_rect, -1);
47
+ rb_define_method(jm_Module, "pixel", m_pixel, -1);
48
+ rb_define_method(jm_Module, "fill", m_flood_fill, -1);
49
+ rb_define_method(jm_Module, "bezier", m_bezier, -1);
50
+ rb_define_method(jm_Module, "polyline", m_polyline, -1);
51
+ rb_define_method(jm_Module, "ngon", m_ngon, -1);
52
+
53
+ rb_define_method(jm_Module, "splice", m_splice, -1);
54
+
55
+ rb_define_method(jm_Module, "color", m_color, -1);
56
+ rb_define_method(jm_Module, "offset", m_offset, -1);
57
+ rb_define_method(jm_Module, "method_missing", m_missing, -1);
58
+ rb_define_method(jm_Module, "quad_cached?", m_quad_cached, 0);
59
+
60
+ rb_define_method(jm_Module, "each", m_each, -1);
61
+
62
+ /* needs to be updated, not yet done **/
63
+ /* rb_define_method(jm_Module, "bitmask", m_bitmask, -1); */
64
+ /* rb_define_method(jm_Module, "leftshift", m_lshift, -1); */
65
+ /* rb_define_method(jm_Module, "rightshift", m_rshift, -1); */
66
+ /* rb_define_method(jm_Module, "[]=", m_special_pixel, -1); */
67
+
68
+ rb_define_method(jm_Module, "dup", m_dup_image, 0);
69
+ rb_define_method(jm_Module, "clone", m_clone_image, 0);
70
+ rb_define_method(jm_Module, "to_blob", m_to_blob, 0);
71
+ rb_define_method(jm_Module, "force_sync", m_force_sync, 1);
72
+ rb_define_method(jm_Module, "set_options", m_user_set_options, 1);
73
+ rb_define_method(jm_Module, "get_options", m_get_options, 0);
74
+ rb_define_method(jm_Module, "delete_options", m_user_delete_options, 0);
75
+
76
+ rb_define_method(jm_Module, "refresh_cache", m_cache_refresh, 0);
77
+
78
+ /* a constant containing the sidelength of largest allowable quad */
79
+ rb_define_const(jm_Module, "TP_MAX_QUAD_SIZE", INT2FIX(max_quad_size() - 2));
80
+
81
+ /* singleton method for creating & removing macros */
82
+ rb_define_singleton_method(jm_Module, "create_macro", M_create_macro, 1);
83
+ rb_define_singleton_method(jm_Module, "remove_macro", M_remove_macro, 1);
84
+ rb_define_singleton_method(jm_Module, "refresh_cache_all", M_refresh_cache_all, 0);
85
+ /* rb_define_singleton_method(jm_Module, "create_blank_image", M_create_blank, 3); */
86
+
87
+ /** aliases; must be made on singleton class because we're using class methods **/
88
+ rb_define_method(jm_Module, "box", m_rect, -1);
89
+ rb_define_method(jm_Module, "colour", m_color, -1);
90
+ rb_define_method(jm_Module, "composite", m_splice, -1);
91
+ rb_define_method(jm_Module, "set_pixel", m_pixel, -1);
92
+ rb_define_method(jm_Module, "[]", m_getpixel, -1);
93
+ rb_define_method(jm_Module, "cache", m_cache_refresh, 0);
94
+ /** end of aliases **/
95
+
96
+ /** associated with gen_eval **/
97
+ rb_define_method(rb_cObject, "gen_eval", rb_gen_eval, -1);
98
+ rb_define_method(rb_cObject, "capture", rb_capture, 0);
99
+
100
+ rb_define_method(rb_cObject, "to_module", rb_to_module , 0);
101
+ rb_define_method(rb_cObject, "reset_tbls", rb_reset_tbls , 0);
102
+ rb_define_method(rb_cObject, "gen_extend", rb_gen_extend, -1);
103
+ rb_define_method(rb_cModule, "gen_include", rb_gen_include, -1);
104
+
105
+ rb_define_alias(rb_cObject, "gen_eval_with", "gen_eval");
106
+ /** end of gen_eval defs **/
107
+
108
+
109
+ /** basic setup **/
110
+
111
+ /* seed the random number generator */
112
+ srand(time(NULL));
113
+
114
+ monkey_patch_gosu();
115
+ /** end basic setup **/
116
+ }
117
+
118
+ /** constructor for TPPoint class **/
119
+ static VALUE
120
+ m_init_TPPoint(int argc, VALUE * argv, VALUE self)
121
+ {
122
+ if(argc == 0) {
123
+ rb_iv_set(self, "@x", INT2FIX(0));
124
+ rb_iv_set(self, "@y", INT2FIX(0));
125
+ }
126
+ else if(argc == 2){
127
+ if(is_a_num(argv[0]) && is_a_num(argv[1])) {
128
+ rb_iv_set(self, "@x", argv[0]);
129
+ rb_iv_set(self, "@y", argv[1]);
130
+ }
131
+ else
132
+ rb_raise(rb_eArgError, "must provide two numbers");
133
+ }
134
+ else
135
+ rb_raise(rb_eArgError, "please provide x and y args only");
136
+
137
+ return Qnil;
138
+
139
+ }
140
+ /** end constructor for TPPoint **/
141
+
142
+
143
+ static VALUE
144
+ gosu_window_to_blob(VALUE self, VALUE rb_x, VALUE rb_y, VALUE rb_width, VALUE rb_height)
145
+ {
146
+ int x = FIX2INT(rb_x);
147
+ int y = FIX2INT(rb_y);
148
+ int width = FIX2INT(rb_width);
149
+ int height = FIX2INT(rb_height);
150
+ int window_height = FIX2INT(rb_funcall(self, rb_intern("height"), 0));
151
+
152
+ VALUE blob = rb_str_new(NULL, 4 * width * height);
153
+
154
+ rb_funcall(self, rb_intern("flush"), 0);
155
+ glFinish();
156
+
157
+ glReadPixels(x, y, width, window_height - y, GL_RGBA,
158
+ GL_UNSIGNED_BYTE, RSTRING_PTR(blob));
159
+
160
+ return blob;
161
+ }
162
+
163
+ static VALUE
164
+ gosu_window_to_texture(VALUE self, VALUE rb_tex_name, VALUE rb_xoffset, VALUE rb_yoffset,
165
+ VALUE rb_x, VALUE rb_y, VALUE rb_width, VALUE rb_height)
166
+ {
167
+
168
+ int tex_name = FIX2INT(rb_tex_name);
169
+ int xoffset = FIX2INT(rb_xoffset);
170
+ int yoffset = FIX2INT(rb_yoffset);
171
+ int x = FIX2INT(rb_x);
172
+ int y = FIX2INT(rb_y);
173
+ int width = FIX2INT(rb_width);
174
+ int height = FIX2INT(rb_height);
175
+
176
+ rb_funcall(self, rb_intern("flush"), 0);
177
+ glFinish();
178
+
179
+ glEnable(GL_TEXTURE_2D);
180
+ glBindTexture(GL_TEXTURE_2D, tex_name);
181
+
182
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, x, y, width, height);
183
+ glDisable(GL_TEXTURE_2D);
184
+
185
+ return Qnil;
186
+ }
187
+
188
+
189
+ static void
190
+ monkey_patch_gosu(void)
191
+ {
192
+ rb_define_method(gosu_window(), "to_blob", gosu_window_to_blob, 4);
193
+ rb_define_method(gosu_window(), "to_texture", gosu_window_to_texture, 7);
194
+ }
195
+
196
+ static VALUE
197
+ gosu_window(void)
198
+ {
199
+ static VALUE GosuWindow = 0;
200
+
201
+ if (!GosuWindow) {
202
+ VALUE Gosu = rb_const_get(rb_cObject, rb_intern("Gosu"));
203
+ GosuWindow = rb_const_get(Gosu, rb_intern("Window"));
204
+ }
205
+
206
+ return GosuWindow;
207
+ }
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
@@ -0,0 +1,148 @@
1
+ /* texplay.h (C) John Mair 2008
2
+ * This program is distributed under the terms of the MIT License
3
+ *
4
+ *
5
+ * */
6
+
7
+ #ifndef GUARD_TEXPLAY_H
8
+ #define GUARD_TEXPLAY_H
9
+
10
+ #include <ruby.h>
11
+
12
+ /* #defines */
13
+ #define OOB_VAL 9999
14
+ #define XMAX_OOB OOB_VAL
15
+ #define YMAX_OOB OOB_VAL
16
+ #define XMIN_OOB -OOB_VAL
17
+ #define YMIN_OOB -OOB_VAL
18
+ #define RGBA_LIST_SIZE 100
19
+ #define PI 3.14159265358979
20
+
21
+ /* macros */
22
+ #define SWAP(X, Y) {(X) ^= (Y); (Y) ^= (X); (X) ^= (Y);}
23
+ #define ROUND(X) (int)((X) + 0.5)
24
+ #define ARY_SIZE(X) sizeof(X) / sizeof(*X)
25
+ #define SGN(X) ((X) >= 0 ? 1 : -1)
26
+ #define MAX(X, Y) ((X) > (Y)) ? (X) :(Y)
27
+ #define MIN(X, Y) ((X) < (Y)) ? (X) : (Y)
28
+ #define ABS(X) ((X) >= 0 ? (X) : -(X))
29
+
30
+ /* enums */
31
+ typedef enum e_bool {
32
+ false, true
33
+ } bool;
34
+
35
+ typedef enum e_color {
36
+ red, green, blue, alpha
37
+ } color_t;
38
+
39
+ typedef enum e_sync_mode {
40
+ lazy_sync, eager_sync, no_sync
41
+ } sync;
42
+
43
+
44
+ typedef enum {
45
+ clear, copy, noop,
46
+ set, copy_inverted,
47
+ invert, and_reverse, and,
48
+ or, nand, nor, xor,
49
+ equiv, and_inverted,
50
+ or_inverted, additive,
51
+ multiply, screen, overlay,
52
+ darken, lighten, color_dodge,
53
+ color_burn, hard_light, soft_light,
54
+ difference, exclusion
55
+ } draw_mode;
56
+
57
+ /* structs */
58
+ typedef struct s_rgba {
59
+ float red, green, blue, alpha;
60
+ } rgba;
61
+
62
+ typedef struct {
63
+ rgba colors[RGBA_LIST_SIZE];
64
+ int size;
65
+ } rgba_list;
66
+
67
+
68
+ /* stores image data */
69
+ typedef struct {
70
+ int width, height;
71
+ float top, left;
72
+ int tname;
73
+ float * td_array;
74
+ int yincr, firstpixel;
75
+ int x_offset, y_offset;
76
+ VALUE image;
77
+ } texture_info;
78
+
79
+
80
+ /* convenience macro */
81
+ #define IMAGE_BOUNDS(X) ((image_bounds *) (X))
82
+ typedef struct {
83
+ int xmin;
84
+ int ymin;
85
+ int xmax;
86
+ int ymax;
87
+ } image_bounds;
88
+
89
+
90
+ typedef struct action_struct {
91
+ int xmin, ymin, xmax, ymax;
92
+ sync sync_mode;
93
+
94
+ /* pointer to associated texture */
95
+ /* a bit of a kludge having this here
96
+ since it's only being used by convert_image_local_color_to_rgba */
97
+ texture_info * tex;
98
+
99
+ VALUE hash_arg;
100
+
101
+ /* action color */
102
+ rgba color;
103
+
104
+ /* pen data */
105
+ struct {
106
+
107
+ /* color control, dynamic */
108
+ bool has_color_control_proc;
109
+ VALUE color_control_proc;
110
+ int color_control_arity;
111
+
112
+ /* color control, static */
113
+ bool has_color_control_transform;
114
+ rgba color_mult;
115
+ rgba color_add;
116
+
117
+ /* texture fill */
118
+ bool has_source_texture;
119
+ texture_info source_tex;
120
+
121
+ /* lerp */
122
+ bool has_lerp;
123
+ float lerp;
124
+
125
+ /* alpha blend */
126
+ bool alpha_blend;
127
+
128
+ /* drawing mode */
129
+ bool has_drawing_mode;
130
+ draw_mode drawing_mode;
131
+
132
+ /* tolerance */
133
+ bool has_tolerance;
134
+ float tolerance;
135
+
136
+ /* color selection */
137
+ bool has_color_select;
138
+ rgba_list source_select;
139
+ rgba_list source_ignore;
140
+ rgba_list dest_select;
141
+ rgba_list dest_ignore;
142
+
143
+ } pen;
144
+
145
+ } action_struct;
146
+
147
+
148
+ #endif