gdkpixbuf 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +412 -0
- data/README +29 -0
- data/Rakefile +67 -0
- data/extconf.rb +44 -0
- data/lib/gdk_pixbuf2.rb +32 -0
- data/rbgdk-pixbuf-format.c +182 -0
- data/rbgdk-pixbuf-loader.c +164 -0
- data/rbgdk-pixbuf.c +794 -0
- data/rbgdk-pixbuf.h +34 -0
- data/rbgdk-pixbufanimation.c +144 -0
- data/rbgdk-pixbufsimpleanim.c +43 -0
- data/rbgdk-pixdata.c +221 -0
- data/sample/anim.rb +38 -0
- data/sample/composite.rb +45 -0
- data/sample/flip.rb +47 -0
- data/sample/floppybuddy.gif +0 -0
- data/sample/format.rb +39 -0
- data/sample/gnome-foot.png +0 -0
- data/sample/inline.rb +37 -0
- data/sample/loader.rb +20 -0
- data/sample/pixdata.rb +39 -0
- data/sample/rotate.rb +45 -0
- data/sample/save.rb +25 -0
- data/sample/scale.rb +45 -0
- data/sample/simpleanim.rb +34 -0
- data/sample/utils.rb +44 -0
- data/sample/xpm.rb +40 -0
- metadata +116 -0
data/rbgdk-pixbuf.h
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdk-pixbuf.h -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2005/09/23 22:02:07 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2004 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
|
13
|
+
#define GDK_PIXBUF_ENABLE_BACKEND
|
14
|
+
#include <gdk-pixbuf/gdk-pixbuf.h>
|
15
|
+
#include <gdk-pixbuf/gdk-pixdata.h>
|
16
|
+
#include "rbgobject.h"
|
17
|
+
|
18
|
+
extern void Init_gdk_pixbuf_animation(VALUE mGLib);
|
19
|
+
extern void Init_gdk_pixdata(VALUE mGLib);
|
20
|
+
extern void Init_gdk_pixbuf_loader(VALUE mGLib);
|
21
|
+
extern void Init_gdk_pixbuf_format(VALUE mGLib);
|
22
|
+
extern GType gdk_pixbuf_format_get_type(void);
|
23
|
+
|
24
|
+
#define RBGDK_PIXBUF_CHECK_VERSION(major,minor,micro) \
|
25
|
+
(GDK_PIXBUF_MAJOR > (major) || \
|
26
|
+
(GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR > (minor)) || \
|
27
|
+
(GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR == (minor) && \
|
28
|
+
GDK_PIXBUF_MICRO >= (micro)))
|
29
|
+
|
30
|
+
#if RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
|
31
|
+
extern void Init_gdk_pixbuf_simpleanim(VALUE mGLib);
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#define GDK_TYPE_PIXBUF_FORMAT (gdk_pixbuf_format_get_type())
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdk-pixbufanimation.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2004/11/30 16:23:13 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
#include "rbgdk-pixbuf.h"
|
12
|
+
|
13
|
+
#define _SELF(s) (GDK_PIXBUF_ANIMATION(RVAL2GOBJ(s)))
|
14
|
+
#define RVAL2ITR(i) (GDK_PIXBUF_ANIMATION_ITER(RVAL2GOBJ(i)))
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
animation_initialize(self, filename)
|
18
|
+
VALUE self, filename;
|
19
|
+
{
|
20
|
+
GdkPixbufAnimation* ret;
|
21
|
+
GError* error = NULL;
|
22
|
+
|
23
|
+
ret = gdk_pixbuf_animation_new_from_file(RVAL2CSTR(filename), &error);
|
24
|
+
if (ret == NULL)
|
25
|
+
RAISE_GERROR(error);
|
26
|
+
|
27
|
+
G_INITIALIZE(self, ret);
|
28
|
+
return Qnil;
|
29
|
+
}
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
animation_get_width(self)
|
33
|
+
VALUE self;
|
34
|
+
{
|
35
|
+
return INT2NUM(gdk_pixbuf_animation_get_width(_SELF(self)));
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
animation_get_height(self)
|
40
|
+
VALUE self;
|
41
|
+
{
|
42
|
+
return INT2NUM(gdk_pixbuf_animation_get_height(_SELF(self)));
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE
|
46
|
+
animation_get_iter(argc, argv, self)
|
47
|
+
int argc;
|
48
|
+
VALUE *argv;
|
49
|
+
VALUE self;
|
50
|
+
{
|
51
|
+
VALUE start_time_sec, start_time_usec;
|
52
|
+
GTimeVal* time = NULL;
|
53
|
+
|
54
|
+
rb_scan_args(argc, argv, "02", &start_time_sec, &start_time_usec);
|
55
|
+
|
56
|
+
if (! NIL_P(start_time_sec)){
|
57
|
+
time = g_new(GTimeVal, 1);
|
58
|
+
time->tv_sec = NUM2LONG(start_time_sec);
|
59
|
+
if (NIL_P(start_time_usec)){
|
60
|
+
time->tv_usec = 0;
|
61
|
+
} else {
|
62
|
+
time->tv_usec = NUM2LONG(start_time_usec);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return GOBJ2RVAL(gdk_pixbuf_animation_get_iter(_SELF(self), time));
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
animation_is_static_image(self)
|
70
|
+
VALUE self;
|
71
|
+
{
|
72
|
+
return CBOOL2RVAL(gdk_pixbuf_animation_is_static_image(_SELF(self)));
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
animation_get_static_image(self)
|
77
|
+
VALUE self;
|
78
|
+
{
|
79
|
+
return GOBJ2RVAL(gdk_pixbuf_animation_get_static_image(_SELF(self)));
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
animation_iter_advance(argc, argv, self)
|
84
|
+
int argc;
|
85
|
+
VALUE *argv;
|
86
|
+
VALUE self;
|
87
|
+
{
|
88
|
+
VALUE current_time_sec, current_time_usec;
|
89
|
+
GTimeVal* time = NULL;
|
90
|
+
|
91
|
+
rb_scan_args(argc, argv, "02", ¤t_time_sec, ¤t_time_usec);
|
92
|
+
|
93
|
+
if (! NIL_P(current_time_sec)){
|
94
|
+
time = g_new(GTimeVal, 1);
|
95
|
+
time->tv_sec = NUM2LONG(current_time_sec);
|
96
|
+
if (NIL_P(current_time_usec)){
|
97
|
+
time->tv_usec = 0;
|
98
|
+
} else {
|
99
|
+
time->tv_usec = NUM2LONG(current_time_usec);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
return CBOOL2RVAL(gdk_pixbuf_animation_iter_advance(RVAL2ITR(self), time));
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE
|
107
|
+
animation_iter_get_delay_time(self)
|
108
|
+
VALUE self;
|
109
|
+
{
|
110
|
+
return INT2NUM(gdk_pixbuf_animation_iter_get_delay_time(RVAL2ITR(self)));
|
111
|
+
}
|
112
|
+
|
113
|
+
static VALUE
|
114
|
+
animation_iter_on_currently_loading_frame(self)
|
115
|
+
VALUE self;
|
116
|
+
{
|
117
|
+
return CBOOL2RVAL(gdk_pixbuf_animation_iter_on_currently_loading_frame(RVAL2ITR(self)));
|
118
|
+
}
|
119
|
+
|
120
|
+
static VALUE
|
121
|
+
animation_iter_get_pixbuf(self)
|
122
|
+
VALUE self;
|
123
|
+
{
|
124
|
+
return GOBJ2RVAL(gdk_pixbuf_animation_iter_get_pixbuf(RVAL2ITR(self)));
|
125
|
+
}
|
126
|
+
|
127
|
+
void
|
128
|
+
Init_gdk_pixbuf_animation(VALUE mGdk)
|
129
|
+
{
|
130
|
+
VALUE anim = G_DEF_CLASS(GDK_TYPE_PIXBUF_ANIMATION, "PixbufAnimation", mGdk);
|
131
|
+
VALUE animiter = G_DEF_CLASS(GDK_TYPE_PIXBUF_ANIMATION_ITER, "PixbufAnimationIter", mGdk);
|
132
|
+
|
133
|
+
rb_define_method(anim, "initialize", animation_initialize, 1);
|
134
|
+
rb_define_method(anim, "width", animation_get_width, 0);
|
135
|
+
rb_define_method(anim, "height", animation_get_height, 0);
|
136
|
+
rb_define_method(anim, "get_iter", animation_get_iter, -1);
|
137
|
+
rb_define_method(anim, "static_image?", animation_is_static_image, 0);
|
138
|
+
rb_define_method(anim, "static_image", animation_get_static_image, 0);
|
139
|
+
rb_define_method(animiter, "advance", animation_iter_advance, -1);
|
140
|
+
rb_define_method(animiter, "delay_time", animation_iter_get_delay_time, 0);
|
141
|
+
rb_define_method(animiter, "on_currently_loading_frame?", animation_iter_on_currently_loading_frame, 0);
|
142
|
+
rb_define_method(animiter, "pixbuf", animation_iter_get_pixbuf, 0);
|
143
|
+
|
144
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdk-pixbufanimation.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2005/09/23 22:02:07 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 the ruby-gnome2 project
|
10
|
+
************************************************/
|
11
|
+
#include "rbgdk-pixbuf.h"
|
12
|
+
|
13
|
+
#if RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
|
14
|
+
#define _SELF(s) (GDK_PIXBUF_SIMPLE_ANIM(RVAL2GOBJ(s)))
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
simpleanim_initialize(self, width, height, rate)
|
18
|
+
VALUE self, width, height, rate;
|
19
|
+
{
|
20
|
+
GdkPixbufSimpleAnim* ret = gdk_pixbuf_simple_anim_new(NUM2INT(width), NUM2INT(height), NUM2DBL(rate));
|
21
|
+
G_INITIALIZE(self, ret);
|
22
|
+
return Qnil;
|
23
|
+
}
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
simpleanim_add_frame(self, pixbuf)
|
27
|
+
VALUE self, pixbuf;
|
28
|
+
{
|
29
|
+
gdk_pixbuf_simple_anim_add_frame(_SELF(self), RVAL2GOBJ(pixbuf));
|
30
|
+
return self;
|
31
|
+
}
|
32
|
+
#endif
|
33
|
+
|
34
|
+
void
|
35
|
+
Init_gdk_pixbuf_simpleanim(VALUE mGdk)
|
36
|
+
{
|
37
|
+
#if RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
|
38
|
+
VALUE anim = G_DEF_CLASS(GDK_TYPE_PIXBUF_SIMPLE_ANIM, "PixbufSimpleAnim", mGdk);
|
39
|
+
|
40
|
+
rb_define_method(anim, "initialize", simpleanim_initialize, 3);
|
41
|
+
rb_define_method(anim, "add_frame", simpleanim_add_frame, 1);
|
42
|
+
#endif
|
43
|
+
}
|
data/rbgdk-pixdata.c
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdk-pixdata.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:28 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
#include "rbgdk-pixbuf.h"
|
12
|
+
|
13
|
+
#define GDK_TYPE_PIXDATA (gdk_pixdata_get_type())
|
14
|
+
#define _SELF(s) ((GdkPixdata*)(RVAL2BOXED(s, GDK_TYPE_PIXDATA)))
|
15
|
+
#define PIXDATA2RVAL(pix) (BOXED2RVAL(pix, GDK_TYPE_PIXDATA))
|
16
|
+
|
17
|
+
static ID id_pixdata;
|
18
|
+
|
19
|
+
/*****************************************/
|
20
|
+
GdkPixdata*
|
21
|
+
gdk_pixdata_copy(const GdkPixdata* src)
|
22
|
+
{
|
23
|
+
GdkPixdata* data;
|
24
|
+
g_return_val_if_fail (src != NULL, NULL);
|
25
|
+
data = g_new(GdkPixdata, 1);
|
26
|
+
*data = *src;
|
27
|
+
return data;
|
28
|
+
}
|
29
|
+
|
30
|
+
GType
|
31
|
+
gdk_pixdata_get_type (void)
|
32
|
+
{
|
33
|
+
static GType our_type = 0;
|
34
|
+
if (our_type == 0)
|
35
|
+
our_type = g_boxed_type_register_static ("GdkPixdata",
|
36
|
+
(GBoxedCopyFunc)gdk_pixdata_copy,
|
37
|
+
(GBoxedFreeFunc)g_free);
|
38
|
+
return our_type;
|
39
|
+
}
|
40
|
+
/*****************************************/
|
41
|
+
static VALUE
|
42
|
+
pixdata_s_from_pixbuf(self, pixbuf, use_rle)
|
43
|
+
VALUE self, pixbuf, use_rle;
|
44
|
+
{
|
45
|
+
GdkPixdata pixdata;
|
46
|
+
gpointer rle_data = gdk_pixdata_from_pixbuf(&pixdata, RVAL2GOBJ(pixbuf), RVAL2CBOOL(use_rle));
|
47
|
+
VALUE ret = PIXDATA2RVAL(&pixdata);
|
48
|
+
if (use_rle){
|
49
|
+
/* need to manage the returned value */
|
50
|
+
rb_ivar_set(ret, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, rle_data));
|
51
|
+
}
|
52
|
+
return ret;
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
pixdata_to_pixbuf(self, copy_pixels)
|
57
|
+
VALUE self, copy_pixels;
|
58
|
+
{
|
59
|
+
GError* error = NULL;
|
60
|
+
GdkPixbuf* ret = gdk_pixbuf_from_pixdata(_SELF(self), RVAL2CBOOL(copy_pixels), &error);
|
61
|
+
if (error)
|
62
|
+
RAISE_GERROR(error);
|
63
|
+
return GOBJ2RVAL(ret);
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE
|
67
|
+
pixdata_serialize(self)
|
68
|
+
VALUE self;
|
69
|
+
{
|
70
|
+
guint stream_length;
|
71
|
+
gint i;
|
72
|
+
guint8* ret = gdk_pixdata_serialize(_SELF(self), &stream_length);
|
73
|
+
VALUE ary = rb_ary_new2(stream_length);
|
74
|
+
for (i = 0; i < stream_length; i++) {
|
75
|
+
rb_ary_push(ary, UINT2NUM(ret[i]));
|
76
|
+
}
|
77
|
+
return ary;
|
78
|
+
}
|
79
|
+
|
80
|
+
static VALUE
|
81
|
+
pixdata_s_deserialize(self, stream)
|
82
|
+
VALUE self, stream;
|
83
|
+
{
|
84
|
+
GdkPixdata pixdata;
|
85
|
+
gboolean ret;
|
86
|
+
guint8 *gstream;
|
87
|
+
GError* error = NULL;
|
88
|
+
gint i, len;
|
89
|
+
|
90
|
+
len = RARRAY_LEN(stream);
|
91
|
+
gstream = g_new(guint8, len);
|
92
|
+
// gstream = ALLOCA_N(guint8, len);
|
93
|
+
for (i = 0; i < len; i++){
|
94
|
+
gstream[i] = (guint8)NUM2UINT(RARRAY_PTR(stream)[i]);
|
95
|
+
}
|
96
|
+
ret = gdk_pixdata_deserialize(&pixdata, len, gstream, &error);
|
97
|
+
|
98
|
+
/* need to manage the returned value */
|
99
|
+
rb_ivar_set(ret, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, gstream));
|
100
|
+
|
101
|
+
if (ret != TRUE) RAISE_GERROR(error);
|
102
|
+
|
103
|
+
return PIXDATA2RVAL(&pixdata);
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE
|
107
|
+
pixdata_to_csource(self, name, dump_type)
|
108
|
+
VALUE self, name, dump_type;
|
109
|
+
{
|
110
|
+
GString* str = gdk_pixdata_to_csource(_SELF(self), RVAL2CSTR(name), FIX2INT(dump_type));
|
111
|
+
VALUE ret = CSTR2RVAL(str->str);
|
112
|
+
g_string_free(str, TRUE);
|
113
|
+
return ret;
|
114
|
+
}
|
115
|
+
|
116
|
+
/* GdkPixdata */
|
117
|
+
static VALUE
|
118
|
+
pixdata_magic(self)
|
119
|
+
VALUE self;
|
120
|
+
{
|
121
|
+
return UINT2NUM(_SELF(self)->magic);
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
pixdata_length(self)
|
126
|
+
VALUE self;
|
127
|
+
{
|
128
|
+
gint32 length = _SELF(self)->length;
|
129
|
+
|
130
|
+
if(length > 0)
|
131
|
+
length -= GDK_PIXDATA_HEADER_LENGTH;
|
132
|
+
return INT2NUM(length);
|
133
|
+
}
|
134
|
+
|
135
|
+
static VALUE
|
136
|
+
pixdata_pixdata_type(self)
|
137
|
+
VALUE self;
|
138
|
+
{
|
139
|
+
return UINT2NUM(_SELF(self)->pixdata_type);
|
140
|
+
}
|
141
|
+
|
142
|
+
static VALUE
|
143
|
+
pixdata_rowstride(self)
|
144
|
+
VALUE self;
|
145
|
+
{
|
146
|
+
return INT2NUM(_SELF(self)->rowstride);
|
147
|
+
}
|
148
|
+
|
149
|
+
static VALUE
|
150
|
+
pixdata_width(self)
|
151
|
+
VALUE self;
|
152
|
+
{
|
153
|
+
return INT2NUM(_SELF(self)->width);
|
154
|
+
}
|
155
|
+
|
156
|
+
static VALUE
|
157
|
+
pixdata_height(self)
|
158
|
+
VALUE self;
|
159
|
+
{
|
160
|
+
return INT2NUM(_SELF(self)->height);
|
161
|
+
}
|
162
|
+
|
163
|
+
static VALUE
|
164
|
+
pixdata_pixel_data(self)
|
165
|
+
VALUE self;
|
166
|
+
{
|
167
|
+
gint i;
|
168
|
+
guint8* ret = _SELF(self)->pixel_data;
|
169
|
+
gint32 length = _SELF(self)->length - GDK_PIXDATA_HEADER_LENGTH;
|
170
|
+
|
171
|
+
VALUE ary = rb_ary_new2(length);
|
172
|
+
for (i = 0; i < length; i++) {
|
173
|
+
rb_ary_push(ary, UINT2NUM(ret[i]));
|
174
|
+
}
|
175
|
+
return ary;
|
176
|
+
}
|
177
|
+
|
178
|
+
|
179
|
+
void
|
180
|
+
Init_gdk_pixdata(VALUE mGdk)
|
181
|
+
{
|
182
|
+
VALUE pixdata = G_DEF_CLASS(GDK_TYPE_PIXDATA, "Pixdata", mGdk);
|
183
|
+
|
184
|
+
id_pixdata = rb_intern("pixdata");
|
185
|
+
|
186
|
+
rb_define_singleton_method(pixdata, "from_pixbuf", pixdata_s_from_pixbuf, 2);
|
187
|
+
rb_define_singleton_method(pixdata, "deserialize", pixdata_s_deserialize, 1);
|
188
|
+
rb_define_method(pixdata, "to_pixbuf", pixdata_to_pixbuf, 1);
|
189
|
+
rb_define_method(pixdata, "serialize", pixdata_serialize, 0);
|
190
|
+
rb_define_method(pixdata, "to_csource", pixdata_to_csource, 2);
|
191
|
+
rb_define_method(pixdata, "magic", pixdata_magic, 0);
|
192
|
+
rb_define_method(pixdata, "length", pixdata_length, 0);
|
193
|
+
rb_define_method(pixdata, "pixdata_type", pixdata_pixdata_type, 0);
|
194
|
+
rb_define_method(pixdata, "rowstride", pixdata_rowstride, 0);
|
195
|
+
rb_define_method(pixdata, "width", pixdata_width, 0);
|
196
|
+
rb_define_method(pixdata, "height", pixdata_height, 0);
|
197
|
+
rb_define_method(pixdata, "pixel_data", pixdata_pixel_data, 0);
|
198
|
+
|
199
|
+
rb_define_const(pixdata, "PIXBUF_MAGIC_NUMBER", INT2NUM(GDK_PIXBUF_MAGIC_NUMBER));
|
200
|
+
rb_define_const(pixdata, "HEADER_LENGTH", INT2NUM(GDK_PIXDATA_HEADER_LENGTH));
|
201
|
+
|
202
|
+
/* GdkPixdataType */
|
203
|
+
rb_define_const(pixdata, "COLOR_TYPE_RGB", INT2FIX(GDK_PIXDATA_COLOR_TYPE_RGB));
|
204
|
+
rb_define_const(pixdata, "COLOR_TYPE_RGBA", INT2FIX(GDK_PIXDATA_COLOR_TYPE_RGBA));
|
205
|
+
rb_define_const(pixdata, "COLOR_TYPE_MASK", INT2FIX(GDK_PIXDATA_COLOR_TYPE_MASK));
|
206
|
+
rb_define_const(pixdata, "SAMPLE_WIDTH_8", INT2FIX(GDK_PIXDATA_SAMPLE_WIDTH_8));
|
207
|
+
rb_define_const(pixdata, "SAMPLE_WIDTH_MASK", INT2FIX(GDK_PIXDATA_SAMPLE_WIDTH_MASK));
|
208
|
+
rb_define_const(pixdata, "ENCODING_RAW", INT2FIX(GDK_PIXDATA_ENCODING_RAW));
|
209
|
+
rb_define_const(pixdata, "ENCODING_RLE", INT2FIX(GDK_PIXDATA_ENCODING_RLE));
|
210
|
+
rb_define_const(pixdata, "ENCODING_MASK", INT2FIX(GDK_PIXDATA_ENCODING_MASK));
|
211
|
+
|
212
|
+
/* GdkPixdataDumpType */
|
213
|
+
rb_define_const(pixdata, "DUMP_PIXDATA_STREAM", INT2FIX(GDK_PIXDATA_DUMP_PIXDATA_STREAM));
|
214
|
+
rb_define_const(pixdata, "DUMP_PIXDATA_STRUCT", INT2FIX(GDK_PIXDATA_DUMP_PIXDATA_STRUCT));
|
215
|
+
rb_define_const(pixdata, "DUMP_MACROS", INT2FIX(GDK_PIXDATA_DUMP_MACROS));
|
216
|
+
rb_define_const(pixdata, "DUMP_GTYPES", INT2FIX(GDK_PIXDATA_DUMP_GTYPES));
|
217
|
+
rb_define_const(pixdata, "DUMP_CTYPES", INT2FIX(GDK_PIXDATA_DUMP_CTYPES));
|
218
|
+
rb_define_const(pixdata, "DUMP_STATIC", INT2FIX(GDK_PIXDATA_DUMP_STATIC));
|
219
|
+
rb_define_const(pixdata, "DUMP_CONST", INT2FIX(GDK_PIXDATA_DUMP_CONST));
|
220
|
+
rb_define_const(pixdata, "DUMP_RLE_DECODER", INT2FIX(GDK_PIXDATA_DUMP_RLE_DECODER));
|
221
|
+
}
|
data/sample/anim.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
=begin
|
3
|
+
anim.rb - Ruby/GdkPixbuf sample script.
|
4
|
+
|
5
|
+
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME2.
|
7
|
+
|
8
|
+
$Id: anim.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'gtk2'
|
12
|
+
|
13
|
+
w = Gtk::Window.new
|
14
|
+
w.signal_connect('delete-event') do
|
15
|
+
Gtk.main_quit
|
16
|
+
end
|
17
|
+
|
18
|
+
box = Gtk::VBox.new
|
19
|
+
src = Gdk::PixbufAnimation.new("floppybuddy.gif")
|
20
|
+
box.pack_start(Gtk::Image.new(src))
|
21
|
+
p src.width
|
22
|
+
p src.height
|
23
|
+
p src.static_image?
|
24
|
+
|
25
|
+
static_image = src.static_image
|
26
|
+
box.pack_start(Gtk::Image.new(static_image))
|
27
|
+
|
28
|
+
iter = src.get_iter
|
29
|
+
p iter.advance
|
30
|
+
p iter.delay_time
|
31
|
+
p iter.on_currently_loading_frame?
|
32
|
+
|
33
|
+
box.pack_start(Gtk::Image.new(iter.pixbuf))
|
34
|
+
|
35
|
+
w.add(box)
|
36
|
+
w.show_all
|
37
|
+
|
38
|
+
Gtk.main
|