ruby-gd 0.7.4 → 0.8.0

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.
Files changed (6) hide show
  1. data/Changes +6 -0
  2. data/GD.c +92 -1
  3. data/doc/manual.rd +20 -0
  4. data/readme.en +6 -2
  5. data/readme.ja +8 -1
  6. metadata +45 -38
data/Changes CHANGED
@@ -1,3 +1,9 @@
1
+ = Changes from 0.7.4
2
+
3
+ * GD.c: added
4
+ GD::Image.newFromGif, GD::Image.new_from_gif, GD::Image#gif, GD::Image#gifStr.
5
+ * doc/manual.rd: documentation update.
6
+
1
7
  = Changes from 0.7.3
2
8
 
3
9
  * doc/gd-intro_ja.html, doc/imgs/* : removed.
data/GD.c CHANGED
@@ -99,6 +99,49 @@ img_from_png(klass, f)
99
99
  return Data_Wrap_Struct(klass,0,free_img,iptr);
100
100
  }
101
101
 
102
+ #ifdef ENABLE_GD_2_0
103
+ static VALUE
104
+ img_from_giffname(klass, fname)
105
+ VALUE klass, fname;
106
+ {
107
+ VALUE f;
108
+ OpenFile *fptr;
109
+ gdImagePtr iptr;
110
+
111
+ Check_Type(fname, T_STRING);
112
+
113
+ f = rb_file_open(STR2CSTR(fname), "r");
114
+ rb_io_binmode(f);
115
+ GetOpenFile(f, fptr);
116
+ rb_io_check_readable(fptr);
117
+
118
+ iptr = gdImageCreateFromGif(fptr->f);
119
+ if (!iptr)
120
+ rb_raise(rb_eArgError, "%s is not a valid GIF File", fptr->path);
121
+
122
+ return Data_Wrap_Struct(klass,0,free_img,iptr);
123
+ }
124
+
125
+ static VALUE
126
+ img_from_gif(klass, f)
127
+ VALUE klass, f;
128
+ {
129
+ OpenFile *fptr;
130
+ gdImagePtr iptr;
131
+
132
+ Check_Type(f, T_FILE);
133
+ rb_io_binmode(f);
134
+ GetOpenFile(f, fptr);
135
+ rb_io_check_readable(fptr);
136
+
137
+ iptr = gdImageCreateFromGif(fptr->f);
138
+ if (!iptr)
139
+ rb_raise(rb_eArgError, "%s is not a valid GIF File", fptr->path);
140
+
141
+ return Data_Wrap_Struct(klass,0,free_img,iptr);
142
+ }
143
+ #endif /* ENABLE_GD_2_0 */
144
+
102
145
  static VALUE
103
146
  img_from_gdfname(klass, fname)
104
147
  VALUE klass, fname;
@@ -1492,6 +1535,47 @@ img_png_str(img)
1492
1535
  return imageString;
1493
1536
  }
1494
1537
 
1538
+
1539
+ #ifdef ENABLE_GD_2_0
1540
+ static VALUE
1541
+ img_gif(img, out)
1542
+ VALUE img, out;
1543
+ {
1544
+ gdImagePtr im;
1545
+ OpenFile *fptr;
1546
+ FILE *f;
1547
+
1548
+ Data_Get_Struct(img, gdImage, im);
1549
+ Check_Type(out, T_FILE);
1550
+ rb_io_binmode(out);
1551
+ GetOpenFile(out, fptr);
1552
+ rb_io_check_writable(fptr);
1553
+ f = (fptr->f2) ? fptr->f2 : fptr->f;
1554
+
1555
+ gdImageGif(im, f);
1556
+
1557
+ return img;
1558
+ }
1559
+
1560
+ static VALUE
1561
+ img_gif_str(img)
1562
+ VALUE img;
1563
+ {
1564
+ int size;
1565
+ void *ptr;
1566
+ gdImagePtr im;
1567
+ VALUE imageString;
1568
+
1569
+ Data_Get_Struct(img, gdImage, im);
1570
+ ptr = gdImageGifPtr(im, &size);
1571
+ imageString = rb_str_new(ptr, size);
1572
+ gdFree(ptr);
1573
+
1574
+ return imageString;
1575
+ }
1576
+ #endif /* ENABLE_GD_2_0 */
1577
+
1578
+
1495
1579
  static VALUE
1496
1580
  img_gd(img, out)
1497
1581
  VALUE img, out;
@@ -2426,7 +2510,10 @@ Init_GD()
2426
2510
  rb_define_singleton_method(cImage, "newPalette", img_s_new, 2);
2427
2511
  rb_define_singleton_method(cImage, "newFromPng", img_from_png, 1);
2428
2512
  rb_define_singleton_method(cImage, "new_from_png", img_from_pngfname, 1);
2429
-
2513
+ #ifdef ENABLE_GD_2_0
2514
+ rb_define_singleton_method(cImage, "newFromGif", img_from_gif, 1);
2515
+ rb_define_singleton_method(cImage, "new_from_gif", img_from_giffname, 1);
2516
+ #endif /* ENABLE_GD_2_0 */
2430
2517
  rb_define_singleton_method(cImage, "newFromXbm", img_from_xbm, 1);
2431
2518
  rb_define_singleton_method(cImage, "new_from_xbm", img_from_xbmfname, 1);
2432
2519
 
@@ -2526,6 +2613,10 @@ Init_GD()
2526
2613
 
2527
2614
  rb_define_method(cImage, "png", img_png, 1);
2528
2615
  rb_define_method(cImage, "pngStr", img_png_str, 0);
2616
+ #ifdef ENABLE_GD_2_0
2617
+ rb_define_method(cImage, "gif", img_gif, 1);
2618
+ rb_define_method(cImage, "gifStr", img_gif_str, 0);
2619
+ #endif /* ENABLE_GD_2_0 */
2529
2620
  rb_define_method(cImage, "gd2", img_gd2, 3);
2530
2621
  rb_define_method(cImage, "gd", img_gd, 1);
2531
2622
 
@@ -165,6 +165,16 @@ object.
165
165
  creates a new PNG image instance from ((|filename|)). ((|filename|))
166
166
  is a String object which specifies the location of the image file.
167
167
 
168
+ --- GD::Image.newFromGif(file)
169
+
170
+ creates a new image instance from GIF file. ((|file|)) is a File
171
+ object.
172
+
173
+ --- GD::Image.new_from_gif(filename)
174
+
175
+ creates a new GIF image instance from ((|filename|)). ((|filename|))
176
+ is a String object which specifies the location of the image file.
177
+
168
178
  --- GD::Image.newFromXbm(file)
169
179
 
170
180
  creates a new image instance from Xbm file. ((|file|)) is a File
@@ -619,6 +629,16 @@ Outputs the image in PNG format as String object. This method will be
619
629
  especially useful when you want to transmit an image ((*directly*)) to
620
630
  an user(i.e, without first writing it to a file).
621
631
 
632
+ --- GD::Image#gif(file)
633
+
634
+ Outputs the image to the specified ((|file|)) in GIF format.
635
+
636
+ --- GD::Image#gifStr(file)
637
+
638
+ Outputs the image in GIF format as String object. This method will be
639
+ especially useful when you want to transmit an image ((*directly*)) to
640
+ an user(i.e, without first writing it to a file).
641
+
622
642
  --- GD::Image#wbmp(fg_color, file)
623
643
  (gd-1.8 or later)
624
644
 
data/readme.en CHANGED
@@ -1,7 +1,7 @@
1
1
  = Ruby/GD 0.7.4
2
2
 
3
3
  An extension library to use Thomas Boutell's gd graphics library from
4
- Ruby. You can create PNG or JPEG images with your Ruby script.
4
+ Ruby. You can create PNG, GIF or JPEG images with your Ruby script.
5
5
 
6
6
  Ruby/GD requires gd library with PNG support(i.e. the version 1.6 or
7
7
  later). See 'doc/INSTALL.en' for detail.
@@ -13,6 +13,10 @@ Ruby/GD is formerly known as "GD", originally written and maintained
13
13
  by Yukihiro "matz" Matsumoto (matz@ruby-lang.org). From this release
14
14
  of 0.7.0, Ruby/GD is maintained by Ryuichi Tamura (tam@kais.kyoto-u.ac.jp).
15
15
 
16
+ == Changes from the version 0.7.4
17
+
18
+ * restored GIF I/O, provided by the gd-2.0.28 or later.
19
+
16
20
  == Changes from the version 0.6.2
17
21
 
18
22
  * GIF I/O are no longer supported. You can use PNG I/O instead.
@@ -45,7 +49,7 @@ see 'doc/manual.html'
45
49
 
46
50
  == Licence
47
51
 
48
- Ruby Libraru Licence
52
+ Ruby Library Licence
49
53
 
50
54
  == Maintainer
51
55
 
data/readme.ja CHANGED
@@ -1,7 +1,7 @@
1
1
  = Ruby/GD 0.7.4
2
2
 
3
3
  Thomas Boutell��ˤ��gd�饤�֥���Ruby�������Ѥ��뤿��γ�ĥ�饤�֥�
4
- ��Ǥ���PNG��JPEG�ե����ޥåȤΥ��᡼�����ڤ˺������뤳�Ȥ��Ǥ��ޤ���
4
+ ��Ǥ���PNG��GIF��JPEG�ե����ޥåȤΥ��᡼�����ڤ˺������뤳�Ȥ��Ǥ��ޤ���
5
5
 
6
6
  Ruby/GD�Ϥ�Ȥ��"GD"��̾�Τ� �ޤĤ�� �椭�Ҥ���(matz@ruby-lang.org)
7
7
  �ˤ�äƳ�ȯ����ӥ��ƥʥ󥹤��Ԥ��Ƥ��ޤ��������θ塤�ܲ�gd�ε�ǽ
@@ -14,6 +14,13 @@ Version 0.7.0
14
14
  �ǿ��Ǥ� http://kirara.prec.kyoto-u.ac.jp/~tam/GD/ ������ꤹ�뤳�Ȥ�
15
15
  �Ǥ��ޤ���
16
16
 
17
+ == 0.7.4����μ���ѹ���
18
+
19
+ * GIF���ݡ��ȤκƳ�
20
+
21
+ gd�饤�֥���2.0.28�ʹߡ�GIF���᡼���������Ϥ�������ѤǤ���褦��
22
+ �ʤ�ޤ���������˽��äơ�Ruby/GD��GIF�˴ؤ��륵�ݡ��Ȥ�Ƴ������ޤ�����
23
+
17
24
  == ��С������(��Ρ�GD-0.6.2.tar.gz)����μ���ѹ���
18
25
 
19
26
  * GIF���ݡ��Ȥ��Ǥ��ڤ�
metadata CHANGED
@@ -1,59 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.1
3
- specification_version: 1
4
2
  name: ruby-gd
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.7.4
7
- date: 2007-01-31 00:00:00 +09:00
8
- summary: An interface to Boutell GD library
9
- require_paths:
10
- - lib
11
- email: tam at kais dot kyoto-u dot ac dot jp
12
- homepage: http://tam.0xfa.com/ruby-gd
13
- rubyforge_project:
14
- description:
15
- autorequire: GD
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.8.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Ryuichi Tamura
8
+ autorequire: GD
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-08 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: tam at kais dot kyoto-u dot ac dot jp
18
+ executables: []
19
+
20
+ extensions:
21
+ - extconf.rb
22
+ extra_rdoc_files:
23
+ - readme.en
31
24
  files:
32
25
  - Changes
33
26
  - extconf.rb
34
27
  - GD.c
35
- - readme.en
36
28
  - readme.ja
37
- - doc/INSTALL.en
29
+ - readme.en
38
30
  - doc/INSTALL.ja
39
31
  - doc/manual.html
40
32
  - doc/manual.rd
33
+ - doc/INSTALL.en
41
34
  - doc/manual_index.html
42
- - sample/example.rb
43
- - sample/gdtestttf.png
44
- - sample/gdtestttf.rb
45
35
  - sample/webpng.rb
46
- test_files: []
47
-
36
+ - sample/gdtestttf.rb
37
+ - sample/gdtestttf.png
38
+ - sample/example.rb
39
+ has_rdoc: true
40
+ homepage: http://tam.0xfa.com/ruby-gd
41
+ post_install_message:
48
42
  rdoc_options: []
49
43
 
50
- extra_rdoc_files:
51
- - readme.en
52
- executables: []
53
-
54
- extensions:
55
- - extconf.rb
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
56
58
  requirements: []
57
59
 
58
- dependencies: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.0.1
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: An interface to Boutell GD library
65
+ test_files: []
59
66