gdk_pixbuf2 2.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/README +29 -0
  3. data/Rakefile +34 -0
  4. data/ext/gdk_pixbuf2/depend +11 -0
  5. data/ext/gdk_pixbuf2/extconf.rb +66 -0
  6. data/ext/gdk_pixbuf2/gdk_pixbuf2.def +2 -0
  7. data/ext/gdk_pixbuf2/rbgdk-pixbuf-format.c +179 -0
  8. data/ext/gdk_pixbuf2/rbgdk-pixbuf-loader.c +164 -0
  9. data/ext/gdk_pixbuf2/rbgdk-pixbuf.c +737 -0
  10. data/ext/gdk_pixbuf2/rbgdk-pixbuf.h +41 -0
  11. data/ext/gdk_pixbuf2/rbgdk-pixbuf2conversions.h +42 -0
  12. data/ext/gdk_pixbuf2/rbgdk-pixbuf2private.h +35 -0
  13. data/ext/gdk_pixbuf2/rbgdk-pixbufanimation.c +93 -0
  14. data/ext/gdk_pixbuf2/rbgdk-pixbufanimationiter.c +71 -0
  15. data/ext/gdk_pixbuf2/rbgdk-pixbufsimpleanim.c +53 -0
  16. data/ext/gdk_pixbuf2/rbgdk-pixdata.c +213 -0
  17. data/extconf.rb +49 -0
  18. data/lib/2.0/gdk_pixbuf2.so +0 -0
  19. data/lib/2.1/gdk_pixbuf2.so +0 -0
  20. data/lib/2.2/gdk_pixbuf2.so +0 -0
  21. data/lib/gdk_pixbuf2.rb +57 -0
  22. data/sample/anim.rb +38 -0
  23. data/sample/composite.rb +45 -0
  24. data/sample/flip.rb +47 -0
  25. data/sample/floppybuddy.gif +0 -0
  26. data/sample/format.rb +39 -0
  27. data/sample/gnome-foot.png +0 -0
  28. data/sample/inline.rb +37 -0
  29. data/sample/loader.rb +20 -0
  30. data/sample/pixdata.rb +39 -0
  31. data/sample/rotate.rb +45 -0
  32. data/sample/save.rb +25 -0
  33. data/sample/scale.rb +45 -0
  34. data/sample/simpleanim.rb +34 -0
  35. data/sample/utils.rb +44 -0
  36. data/sample/xpm.rb +40 -0
  37. data/vendor/local/bin/gdk-pixbuf-csource.exe +0 -0
  38. data/vendor/local/bin/gdk-pixbuf-pixdata.exe +0 -0
  39. data/vendor/local/bin/gdk-pixbuf-query-loaders.exe +0 -0
  40. data/vendor/local/bin/libgdk_pixbuf-2.0-0.dll +0 -0
  41. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-animation.h +204 -0
  42. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-core.h +464 -0
  43. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h +33 -0
  44. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-features.h +120 -0
  45. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-io.h +343 -0
  46. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-loader.h +108 -0
  47. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-marshal.h +36 -0
  48. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-simple-anim.h +64 -0
  49. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-transform.h +158 -0
  50. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf.h +43 -0
  51. data/vendor/local/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixdata.h +168 -0
  52. data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache +139 -0
  53. data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.a +0 -0
  54. data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll +0 -0
  55. data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll.a +0 -0
  56. data/vendor/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.la +41 -0
  57. data/vendor/local/lib/gdk_pixbuf-2.0.def +128 -0
  58. data/vendor/local/lib/girepository-1.0/GdkPixbuf-2.0.typelib +0 -0
  59. data/vendor/local/lib/libgdk_pixbuf-2.0.dll.a +0 -0
  60. data/vendor/local/lib/libgdk_pixbuf-2.0.la +41 -0
  61. data/vendor/local/lib/pkgconfig/gdk-pixbuf-2.0.pc +19 -0
  62. data/vendor/local/share/gir-1.0/GdkPixbuf-2.0.gir +3443 -0
  63. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/GdkPixbufLoader.html +827 -0
  64. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/annotation-glossary.html +65 -0
  65. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-12.html +35 -0
  66. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-14.html +46 -0
  67. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-2.html +108 -0
  68. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-26.html +50 -0
  69. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-28.html +47 -0
  70. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-30.html +35 -0
  71. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-4.html +72 -0
  72. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-6.html +65 -0
  73. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-2-8.html +39 -0
  74. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-deprecated.html +53 -0
  75. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/api-index-full.html +787 -0
  76. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/composite.png +0 -0
  77. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Animations.html +1068 -0
  78. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-File-Loading.html +794 -0
  79. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-File-saving.html +864 -0
  80. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Image-Data-in-Memory.html +491 -0
  81. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Inline-data.html +639 -0
  82. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Module-Interface.html +1298 -0
  83. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html +208 -0
  84. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Scaling.html +914 -0
  85. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html +898 -0
  86. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Utilities.html +381 -0
  87. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Versioning.html +184 -0
  88. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-X-Drawables-to-Pixbufs.html +197 -0
  89. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-Xlib-Rendering.html +438 -0
  90. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-XlibRGB.html +1115 -0
  91. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-csource.html +167 -0
  92. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf-Xlib-initialization.html +159 -0
  93. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf-from-drawables.html +45 -0
  94. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf-rendering.html +44 -0
  95. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-query-loaders.html +85 -0
  96. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf.devhelp2 +226 -0
  97. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/home.png +0 -0
  98. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/index.html +150 -0
  99. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/index.sgml +322 -0
  100. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/left-insensitive.png +0 -0
  101. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/left.png +0 -0
  102. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/license.html +59 -0
  103. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/right-insensitive.png +0 -0
  104. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/right.png +0 -0
  105. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/rn01.html +101 -0
  106. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/rn02.html +50 -0
  107. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/style.css +476 -0
  108. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/up-insensitive.png +0 -0
  109. data/vendor/local/share/gtk-doc/html/gdk-pixbuf/up.png +0 -0
  110. data/vendor/local/share/license/gdk-pixbuf/AUTHORS +65 -0
  111. data/vendor/local/share/license/gdk-pixbuf/COPYING +482 -0
  112. data/vendor/local/share/locale/af/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  113. data/vendor/local/share/locale/ang/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  114. data/vendor/local/share/locale/ar/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  115. data/vendor/local/share/locale/as/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  116. data/vendor/local/share/locale/ast/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  117. data/vendor/local/share/locale/az/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  118. data/vendor/local/share/locale/be/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  119. data/vendor/local/share/locale/be@latin/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  120. data/vendor/local/share/locale/bg/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  121. data/vendor/local/share/locale/bn/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  122. data/vendor/local/share/locale/bn_IN/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  123. data/vendor/local/share/locale/br/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  124. data/vendor/local/share/locale/bs/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  125. data/vendor/local/share/locale/ca/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  126. data/vendor/local/share/locale/ca@valencia/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  127. data/vendor/local/share/locale/crh/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  128. data/vendor/local/share/locale/cs/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  129. data/vendor/local/share/locale/csb/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  130. data/vendor/local/share/locale/cy/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  131. data/vendor/local/share/locale/da/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  132. data/vendor/local/share/locale/de/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  133. data/vendor/local/share/locale/dz/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  134. data/vendor/local/share/locale/el/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  135. data/vendor/local/share/locale/en@shaw/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  136. data/vendor/local/share/locale/en_CA/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  137. data/vendor/local/share/locale/en_GB/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  138. data/vendor/local/share/locale/eo/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  139. data/vendor/local/share/locale/es/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  140. data/vendor/local/share/locale/et/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  141. data/vendor/local/share/locale/eu/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  142. data/vendor/local/share/locale/fa/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  143. data/vendor/local/share/locale/fi/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  144. data/vendor/local/share/locale/fr/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  145. data/vendor/local/share/locale/ga/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  146. data/vendor/local/share/locale/gl/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  147. data/vendor/local/share/locale/gu/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  148. data/vendor/local/share/locale/he/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  149. data/vendor/local/share/locale/hi/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  150. data/vendor/local/share/locale/hr/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  151. data/vendor/local/share/locale/hu/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  152. data/vendor/local/share/locale/hy/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  153. data/vendor/local/share/locale/ia/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  154. data/vendor/local/share/locale/id/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  155. data/vendor/local/share/locale/io/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  156. data/vendor/local/share/locale/is/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  157. data/vendor/local/share/locale/it/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  158. data/vendor/local/share/locale/ja/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  159. data/vendor/local/share/locale/ka/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  160. data/vendor/local/share/locale/km/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  161. data/vendor/local/share/locale/kn/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  162. data/vendor/local/share/locale/ko/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  163. data/vendor/local/share/locale/ku/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  164. data/vendor/local/share/locale/li/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  165. data/vendor/local/share/locale/lt/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  166. data/vendor/local/share/locale/lv/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  167. data/vendor/local/share/locale/mai/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  168. data/vendor/local/share/locale/mi/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  169. data/vendor/local/share/locale/mk/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  170. data/vendor/local/share/locale/ml/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  171. data/vendor/local/share/locale/mn/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  172. data/vendor/local/share/locale/mr/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  173. data/vendor/local/share/locale/ms/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  174. data/vendor/local/share/locale/my/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  175. data/vendor/local/share/locale/nb/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  176. data/vendor/local/share/locale/nds/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  177. data/vendor/local/share/locale/ne/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  178. data/vendor/local/share/locale/nl/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  179. data/vendor/local/share/locale/nn/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  180. data/vendor/local/share/locale/nso/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  181. data/vendor/local/share/locale/oc/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  182. data/vendor/local/share/locale/or/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  183. data/vendor/local/share/locale/pa/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  184. data/vendor/local/share/locale/pl/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  185. data/vendor/local/share/locale/ps/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  186. data/vendor/local/share/locale/pt/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  187. data/vendor/local/share/locale/pt_BR/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  188. data/vendor/local/share/locale/ro/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  189. data/vendor/local/share/locale/ru/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  190. data/vendor/local/share/locale/si/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  191. data/vendor/local/share/locale/sk/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  192. data/vendor/local/share/locale/sl/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  193. data/vendor/local/share/locale/sq/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  194. data/vendor/local/share/locale/sr/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  195. data/vendor/local/share/locale/sr@ije/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  196. data/vendor/local/share/locale/sr@latin/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  197. data/vendor/local/share/locale/sv/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  198. data/vendor/local/share/locale/ta/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  199. data/vendor/local/share/locale/te/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  200. data/vendor/local/share/locale/tg/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  201. data/vendor/local/share/locale/th/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  202. data/vendor/local/share/locale/tk/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  203. data/vendor/local/share/locale/tr/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  204. data/vendor/local/share/locale/tt/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  205. data/vendor/local/share/locale/ug/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  206. data/vendor/local/share/locale/uk/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  207. data/vendor/local/share/locale/uz/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  208. data/vendor/local/share/locale/uz@cyrillic/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  209. data/vendor/local/share/locale/vi/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  210. data/vendor/local/share/locale/wa/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  211. data/vendor/local/share/locale/xh/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  212. data/vendor/local/share/locale/yi/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  213. data/vendor/local/share/locale/zh_CN/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  214. data/vendor/local/share/locale/zh_HK/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  215. data/vendor/local/share/locale/zh_TW/LC_MESSAGES/gdk-pixbuf.mo +0 -0
  216. data/vendor/local/share/man/man1/gdk-pixbuf-csource.1 +135 -0
  217. data/vendor/local/share/man/man1/gdk-pixbuf-query-loaders.1 +73 -0
  218. metadata +273 -0
@@ -0,0 +1,737 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2004 Masao Mutoh
5
+ * Copyright (C) 2000 Yasushi Shoji
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
22
+
23
+ #include "rbgdk-pixbuf2private.h"
24
+ #include <string.h>
25
+
26
+ #define RG_TARGET_NAMESPACE cPixbuf
27
+ #define _SELF(s) RVAL2GDKPIXBUF(s)
28
+
29
+ #define NOMEM_ERROR(error) g_set_error(error,\
30
+ GDK_PIXBUF_ERROR,\
31
+ GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,\
32
+ "Insufficient memory to load image file");
33
+
34
+ static ID id_pixdata;
35
+
36
+ /****************************************************/
37
+ /* The GdkPixbuf Structure */
38
+ static int
39
+ pixels_size(GdkPixbuf *pixbuf)
40
+ {
41
+ int height, width, rowstride, n_channels, bits_per_sample;
42
+
43
+ height = gdk_pixbuf_get_height(pixbuf);
44
+ width = gdk_pixbuf_get_width(pixbuf);
45
+ rowstride = gdk_pixbuf_get_rowstride(pixbuf);
46
+ n_channels = gdk_pixbuf_get_n_channels(pixbuf);
47
+ bits_per_sample = gdk_pixbuf_get_bits_per_sample(pixbuf);
48
+
49
+ return ((height - 1) * rowstride +
50
+ width * ((n_channels * bits_per_sample + 7) / 8));
51
+ }
52
+
53
+ static VALUE
54
+ get_pixels(VALUE self)
55
+ {
56
+ GdkPixbuf *pixbuf = _SELF(self);
57
+ int size;
58
+
59
+ size = pixels_size(pixbuf);
60
+ return rb_str_new((const char *)gdk_pixbuf_get_pixels(pixbuf), size);
61
+ }
62
+
63
+ static VALUE
64
+ rg_operator_set_pixels(VALUE self, VALUE pixels)
65
+ {
66
+ GdkPixbuf *pixbuf = _SELF(self);
67
+ int size;
68
+ int arg_size;
69
+
70
+ size = pixels_size(pixbuf);
71
+
72
+ StringValue(pixels);
73
+ arg_size = RSTRING_LEN(pixels);
74
+ if (arg_size != size)
75
+ rb_raise(rb_eRangeError,
76
+ "Pixels are %i bytes, %i bytes supplied.",
77
+ size, arg_size);
78
+
79
+ /* The user currently cannot get a pointer to the actual
80
+ * pixels, the data is copied to a String. */
81
+ memcpy(gdk_pixbuf_get_pixels(pixbuf),
82
+ RSTRING_PTR(pixels), MIN(RSTRING_LEN(pixels), size));
83
+
84
+ return pixels;
85
+ }
86
+
87
+ static VALUE
88
+ rg_get_option(VALUE self, VALUE key)
89
+ {
90
+ const gchar* ret = gdk_pixbuf_get_option(_SELF(self), RVAL2CSTR(key));
91
+ return ret ? CSTR2RVAL(ret) : Qnil;
92
+ }
93
+
94
+ /****************************************************/
95
+ /* File opening */
96
+ /* Image Data in Memory */
97
+ static GdkPixbuf *
98
+ pixbuf_initialize_by_hash(VALUE self, VALUE arg, GError **error)
99
+ {
100
+ GdkPixbuf *buf = NULL;
101
+
102
+ VALUE rb_colorspace, rb_has_alpha, rb_bits_per_sample, rb_width, rb_height,
103
+ rb_data, rb_rowstride, rb_xpm, rb_inline, rb_copy_pixels,
104
+ rb_src_pixbuf, rb_src_x, rb_src_y,
105
+ rb_file, rb_scale_width, rb_scale_height, rb_preserve_aspect_ratio;
106
+ rbg_scan_options(arg,
107
+ "colorspace", &rb_colorspace,
108
+ "has_alpha", &rb_has_alpha,
109
+ "bits_per_sample", &rb_bits_per_sample,
110
+ "width", &rb_width,
111
+ "height", &rb_height,
112
+ "data", &rb_data,
113
+ "rowstride", &rb_rowstride,
114
+ "xpm", &rb_xpm,
115
+ "inline", &rb_inline,
116
+ "copy_pixels", &rb_copy_pixels,
117
+ "src_pixbuf", &rb_src_pixbuf,
118
+ "src_x", &rb_src_x,
119
+ "src_y", &rb_src_y,
120
+ "file", &rb_file,
121
+ "scale_width", &rb_scale_width,
122
+ "scale_height", &rb_scale_height,
123
+ "preserve_aspect_ratio", &rb_preserve_aspect_ratio,
124
+ NULL);
125
+
126
+ if (!NIL_P(rb_data)) {
127
+ buf = gdk_pixbuf_new_from_data((const guchar*)RVAL2CSTR(rb_data),
128
+ NIL_P(rb_colorspace) ? GDK_COLORSPACE_RGB : RVAL2GDKCOLORSPACE(rb_colorspace),
129
+ RVAL2CBOOL(rb_has_alpha),
130
+ NIL_P(rb_bits_per_sample) ? 8 : NUM2INT(rb_bits_per_sample),
131
+ NUM2INT(rb_width),
132
+ NUM2INT(rb_height),
133
+ NUM2INT(rb_rowstride),
134
+ NULL, NULL);
135
+ if (buf == NULL)
136
+ NOMEM_ERROR(error);
137
+ // Save a reference to the string because the pixbuf doesn't copy it.
138
+ G_RELATIVE(self, rb_data);
139
+ } else if (!NIL_P(rb_xpm)) {
140
+ const gchar **data = RVAL2STRV(rb_xpm);
141
+ buf = gdk_pixbuf_new_from_xpm_data(data);
142
+ g_free(data);
143
+ if (buf == NULL)
144
+ NOMEM_ERROR(error);
145
+ } else if (!NIL_P(rb_inline)) {
146
+ /* TODO: Is this really up to the caller to decide? */
147
+ long n;
148
+ guint8 *data = RVAL2GUINT8S(rb_inline, n);
149
+ buf = gdk_pixbuf_new_from_inline(n, data, RVAL2CBOOL(rb_copy_pixels), error);
150
+ /* need to manage the returned value */
151
+ rb_ivar_set(self, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, data));
152
+ } else if (!NIL_P(rb_src_pixbuf)) {
153
+ buf = gdk_pixbuf_new_subpixbuf(_SELF(rb_src_pixbuf),
154
+ NUM2INT(rb_src_x),
155
+ NUM2INT(rb_src_y),
156
+ NUM2INT(rb_width),
157
+ NUM2INT(rb_height));
158
+ if (buf == NULL)
159
+ NOMEM_ERROR(error);
160
+ } else if (!NIL_P(rb_file)) {
161
+ if (!NIL_P(rb_width)) {
162
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
163
+ buf = gdk_pixbuf_new_from_file_at_size(RVAL2CSTR(rb_file),
164
+ NUM2INT(rb_width),
165
+ NUM2INT(rb_height),
166
+ error);
167
+ #else
168
+ rb_warning("Sizing on load not supported in GTK+ < 2.4.0");
169
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error);
170
+ #endif
171
+ } else if (!NIL_P(rb_scale_width)) {
172
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0)
173
+ int width = NUM2INT(rb_scale_width);
174
+ int height = NUM2INT(rb_scale_height);
175
+ #if !RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
176
+ if (width < 0 || height < 0)
177
+ rb_warning("For scaling on load, a negative value for width or height are not supported in GTK+ < 2.8.0");
178
+ #endif
179
+ buf = gdk_pixbuf_new_from_file_at_scale(RVAL2CSTR(rb_file),
180
+ width, height,
181
+ NIL_P(rb_preserve_aspect_ratio) ? TRUE : RVAL2CBOOL(rb_preserve_aspect_ratio),
182
+ error);
183
+ #else
184
+ rb_warning("Scaling on load not supported in GTK+ < 2.6.0");
185
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error);
186
+ #endif
187
+ } else {
188
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error);
189
+ }
190
+ } else {
191
+ buf = gdk_pixbuf_new(NIL_P(rb_colorspace) ? GDK_COLORSPACE_RGB : RVAL2GDKCOLORSPACE(rb_colorspace),
192
+ RVAL2CBOOL(rb_has_alpha),
193
+ NIL_P(rb_bits_per_sample) ? 8 : NUM2INT(rb_bits_per_sample),
194
+ NUM2INT(rb_width),
195
+ NUM2INT(rb_height));
196
+ if (buf == NULL)
197
+ NOMEM_ERROR(error);
198
+ }
199
+
200
+ return buf;
201
+ }
202
+
203
+ /* TODO: make deprecated */
204
+ static GdkPixbuf *
205
+ pixbuf_initialize(VALUE self, int argc, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7, GError **error)
206
+ {
207
+ GdkPixbuf* buf;
208
+
209
+ if (argc == 7){
210
+ buf = gdk_pixbuf_new_from_data((const guchar*)RVAL2CSTR(arg1),
211
+ RVAL2GDKCOLORSPACE(arg2),
212
+ RVAL2CBOOL(arg3), NUM2INT(arg4),
213
+ NUM2INT(arg5), NUM2INT(arg6),
214
+ NUM2INT(arg7), NULL, NULL);
215
+ if (buf == NULL) NOMEM_ERROR(error);
216
+ // Save a reference to the string because the pixbuf doesn't copy it.
217
+ G_RELATIVE(self, arg1);
218
+ } else if (argc == 5){
219
+ if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
220
+ buf = gdk_pixbuf_new_subpixbuf(_SELF(arg1),
221
+ NUM2INT(arg2), NUM2INT(arg3),
222
+ NUM2INT(arg4), NUM2INT(arg5));
223
+ if (buf == NULL) NOMEM_ERROR(error);
224
+ } else if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GDK_TYPE_COLORSPACE))){
225
+ buf = gdk_pixbuf_new(RVAL2GDKCOLORSPACE(arg1),
226
+ RVAL2CBOOL(arg2), NUM2INT(arg3),
227
+ NUM2INT(arg4), NUM2INT(arg5));
228
+ if (buf == NULL) NOMEM_ERROR(error);
229
+ } else {
230
+ rb_raise(rb_eArgError, "Wrong type of 1st argument or wrong number of arguments");
231
+ }
232
+ } else if (argc == 4) {
233
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0)
234
+ int width = NUM2INT(arg2);
235
+ int height = NUM2INT(arg3);
236
+ #if ! RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
237
+ if (width < 0 || height < 0)
238
+ rb_warning("For scaling on load, a negative value for width or height are not supported in GTK+ < 2.8.0");
239
+ #endif
240
+ buf = gdk_pixbuf_new_from_file_at_scale(RVAL2CSTR(arg1),
241
+ width, height,
242
+ RVAL2CBOOL(arg4), error);
243
+ #else
244
+ rb_warning("Scaling on load not supported in GTK+ < 2.6.0");
245
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error);
246
+ #endif
247
+ } else if (argc == 3) {
248
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
249
+ buf = gdk_pixbuf_new_from_file_at_size(RVAL2CSTR(arg1),
250
+ NUM2INT(arg2), NUM2INT(arg3), error);
251
+ #else
252
+ rb_warning("Sizing on load not supported in GTK+ < 2.4.0");
253
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error);
254
+ #endif
255
+ } else if (argc == 2) {
256
+ /* TODO: Is this really up to the caller to decide? */
257
+ gboolean copy_pixels = RVAL2CBOOL(arg2);
258
+ long n;
259
+ guint8 *data = RVAL2GUINT8S(arg1, n);
260
+ buf = gdk_pixbuf_new_from_inline(n, data, copy_pixels, error);
261
+ /* need to manage the returned value */
262
+ rb_ivar_set(self, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, data));
263
+ } else if (argc == 1){
264
+ if (TYPE(arg1) == T_STRING) {
265
+ buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error);
266
+ } else if (TYPE(arg1) == T_ARRAY) {
267
+ const gchar **data = RVAL2STRV(arg1);
268
+ buf = gdk_pixbuf_new_from_xpm_data(data);
269
+ g_free(data);
270
+ if (buf == NULL)
271
+ NOMEM_ERROR(error);
272
+ } else if (TYPE(arg1) == T_HASH) {
273
+ buf = pixbuf_initialize_by_hash(self, arg1, error);
274
+ } else {
275
+ rb_raise(rb_eArgError, "Wrong type of 1st argument or wrong number of arguments");
276
+ }
277
+ } else {
278
+ rb_raise(rb_eArgError, "Wrong number of arguments");
279
+ }
280
+
281
+ return buf;
282
+ }
283
+
284
+ static VALUE
285
+ rg_initialize(int argc, VALUE *argv, VALUE self)
286
+ {
287
+ VALUE arg1, arg2, arg3, arg4, arg5, arg6, arg7;
288
+ GdkPixbuf *buf;
289
+ GError *error = NULL;
290
+
291
+ rb_scan_args(argc, argv, "16", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7);
292
+ buf = pixbuf_initialize(self, argc, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &error);
293
+ if (buf == NULL) {
294
+ rb_gc();
295
+ g_error_free(error);
296
+ error = NULL;
297
+ buf = pixbuf_initialize(self, argc, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &error);
298
+ }
299
+ if (error || !buf)
300
+ RAISE_GERROR(error);
301
+
302
+ G_INITIALIZE(self, buf);
303
+ return Qnil;
304
+ }
305
+
306
+ static VALUE
307
+ rg_dup(VALUE self)
308
+ {
309
+ VALUE ret;
310
+ GdkPixbuf* dest = gdk_pixbuf_copy(_SELF(self));
311
+ if (dest == NULL)
312
+ return Qnil;
313
+ ret = GOBJ2RVAL(dest);
314
+ g_object_unref(dest);
315
+ return ret;
316
+ }
317
+
318
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
319
+ static VALUE
320
+ rg_s_get_file_info(G_GNUC_UNUSED VALUE self, VALUE filename)
321
+ {
322
+ gint width, height;
323
+
324
+ GdkPixbufFormat* format = gdk_pixbuf_get_file_info(RVAL2CSTR(filename),
325
+ &width, &height);
326
+ return format ? rb_ary_new3(3, GDKPIXBUFFORMAT2RVAL(format), INT2NUM(width), INT2NUM(height)) : Qnil;
327
+ }
328
+
329
+ #endif
330
+
331
+ static VALUE
332
+ save_to(VALUE self, const gchar *filename, const gchar *type, VALUE options)
333
+ {
334
+ VALUE result = self;
335
+ GError *error = NULL;
336
+ gchar **keys = NULL;
337
+ gchar **values = NULL;
338
+
339
+ if (!NIL_P(options)) {
340
+ VALUE ary, key, value;
341
+ ID to_s;
342
+ gint len, i;
343
+
344
+ Check_Type(options, T_HASH);
345
+ to_s = rb_intern("to_s");
346
+
347
+ ary = rb_funcall(options, rb_intern("to_a"), 0);
348
+ len = RARRAY_LEN(ary);
349
+ keys = ALLOCA_N(gchar *, len + 1);
350
+ values = ALLOCA_N(gchar *, len + 1);
351
+ for (i = 0; i < len; i++) {
352
+ key = RARRAY_PTR(RARRAY_PTR(ary)[i])[0];
353
+ if (SYMBOL_P(key)) {
354
+ const char *const_key;
355
+ const_key = rb_id2name(SYM2ID(key));
356
+ keys[i] = (gchar *)const_key;
357
+ } else {
358
+ keys[i] = (gchar *)RVAL2CSTR(key);
359
+ }
360
+ value = rb_funcall(RARRAY_PTR(RARRAY_PTR(ary)[i])[1], to_s, 0);
361
+ values[i] = (gchar *)RVAL2CSTR(value);
362
+ }
363
+ keys[len] = NULL;
364
+ values[len] = NULL;
365
+ }
366
+
367
+ if (filename) {
368
+ gdk_pixbuf_savev(_SELF(self), filename, type, keys, values, &error);
369
+ }
370
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
371
+ else {
372
+ gchar *buffer;
373
+ gsize buffer_size;
374
+ if (gdk_pixbuf_save_to_bufferv(_SELF(self), &buffer, &buffer_size,
375
+ type, keys, values, &error))
376
+ result = rb_str_new(buffer, buffer_size);
377
+ }
378
+ #endif
379
+
380
+ if (error)
381
+ RAISE_GERROR(error);
382
+
383
+ return result;
384
+ }
385
+
386
+ /****************************************************/
387
+ /* File saving */
388
+ static VALUE
389
+ rg_save(int argc, VALUE *argv, VALUE self)
390
+ {
391
+ VALUE filename, type, options;
392
+
393
+ rb_scan_args(argc, argv, "21", &filename, &type, &options);
394
+
395
+ return save_to(self, RVAL2CSTR(filename), RVAL2CSTR(type), options);
396
+ }
397
+
398
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
399
+ /* XXX
400
+ gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
401
+ GdkPixbufSaveFunc save_func,
402
+ gpointer user_data,
403
+ const char *type,
404
+ char **option_keys,
405
+ char **option_values,
406
+ GError **error);
407
+ */
408
+
409
+ static VALUE
410
+ rg_save_to_buffer(int argc, VALUE *argv, VALUE self)
411
+ {
412
+ VALUE type, options;
413
+
414
+ rb_scan_args(argc, argv, "11", &type, &options);
415
+
416
+ return save_to(self, NULL, RVAL2CSTR(type), options);
417
+ }
418
+ #endif
419
+
420
+ /****************************************************/
421
+ /* Scaling */
422
+ static VALUE
423
+ rg_scale(int argc, VALUE *argv, VALUE self)
424
+ {
425
+ GdkPixbuf* dest;
426
+ VALUE dest_width, dest_height, interp_type, ret;
427
+ GdkInterpType type = GDK_INTERP_BILINEAR;
428
+
429
+ rb_scan_args(argc, argv, "21", &dest_width, &dest_height,
430
+ &interp_type);
431
+
432
+ if (!NIL_P(interp_type))
433
+ type = RVAL2GDKINTERPTYPE(interp_type);
434
+
435
+ dest = gdk_pixbuf_scale_simple(_SELF(self),
436
+ NUM2INT(dest_width),
437
+ NUM2INT(dest_height),
438
+ type);
439
+ if (dest == NULL)
440
+ return Qnil;
441
+
442
+ ret = GOBJ2RVAL(dest);
443
+ g_object_unref(dest);
444
+ return ret;
445
+ }
446
+
447
+ static VALUE
448
+ rg_scale_bang(int argc, VALUE *argv, VALUE self)
449
+ {
450
+ GdkInterpType type = GDK_INTERP_BILINEAR;
451
+
452
+ VALUE src, src_x, src_y, src_width, src_height;
453
+ VALUE offset_x, offset_y, scale_x, scale_y, interp_type;
454
+
455
+ rb_scan_args(argc, argv, "91", &src, &src_x, &src_y,
456
+ &src_width, &src_height, &offset_x, &offset_y,
457
+ &scale_x, &scale_y, &interp_type);
458
+
459
+ if (!NIL_P(interp_type))
460
+ type = RVAL2GDKINTERPTYPE(interp_type);
461
+
462
+ gdk_pixbuf_scale(_SELF(src), _SELF(self),
463
+ NUM2INT(src_x), NUM2INT(src_y),
464
+ NUM2INT(src_width), NUM2INT(src_height),
465
+ NUM2DBL(offset_x), NUM2DBL(offset_y),
466
+ NUM2DBL(scale_x), NUM2DBL(scale_y), type);
467
+ return self;
468
+ }
469
+
470
+ static VALUE
471
+ rg_composite(VALUE self, VALUE dest_width, VALUE dest_height, VALUE interp_type, VALUE overall_alpha, VALUE check_size, VALUE color1, VALUE color2)
472
+ {
473
+ GdkPixbuf* dest;
474
+ VALUE ret;
475
+ GdkInterpType type = GDK_INTERP_BILINEAR;
476
+
477
+ if (!NIL_P(interp_type))
478
+ type = RVAL2GDKINTERPTYPE(interp_type);
479
+
480
+ dest = gdk_pixbuf_composite_color_simple(
481
+ _SELF(self), NUM2INT(dest_width), NUM2INT(dest_height),
482
+ type, NUM2INT(overall_alpha), NUM2INT(check_size),
483
+ NUM2UINT(color1), NUM2UINT(color2));
484
+
485
+ if (dest == NULL)
486
+ return Qnil;
487
+
488
+ ret = GOBJ2RVAL(dest);
489
+ g_object_unref(dest);
490
+ return ret;
491
+ }
492
+
493
+ static VALUE
494
+ rg_composite_bang(int argc, VALUE *argv, VALUE self)
495
+ {
496
+ VALUE ret;
497
+ VALUE args[16];
498
+ GdkInterpType interp_type = GDK_INTERP_BILINEAR;
499
+
500
+ rb_scan_args(argc, argv, "97",
501
+ &args[0], &args[1], &args[2], &args[3], &args[4],
502
+ &args[5], &args[6], &args[7], &args[8], &args[9],
503
+ &args[10], &args[11], &args[12], &args[13], &args[14],
504
+ &args[15]);
505
+
506
+ switch (argc) {
507
+ case 11:
508
+ if (!NIL_P(args[9]))
509
+ interp_type = RVAL2GDKINTERPTYPE(args[9]);
510
+
511
+ gdk_pixbuf_composite(_SELF(args[0]), _SELF(self),
512
+ NUM2INT(args[1]), NUM2INT(args[2]),
513
+ NUM2INT(args[3]), NUM2INT(args[4]),
514
+ NUM2DBL(args[5]), NUM2DBL(args[6]),
515
+ NUM2DBL(args[7]), NUM2DBL(args[8]),
516
+ interp_type, NUM2INT(args[10]));
517
+ ret = self;
518
+ break;
519
+ case 16:
520
+ if (!NIL_P(args[9]))
521
+ interp_type = RVAL2GDKINTERPTYPE(args[9]);
522
+
523
+ gdk_pixbuf_composite_color(_SELF(args[0]), _SELF(self),
524
+ NUM2INT(args[1]), NUM2INT(args[2]),
525
+ NUM2INT(args[3]), NUM2INT(args[4]),
526
+ NUM2DBL(args[5]), NUM2DBL(args[6]),
527
+ NUM2DBL(args[7]), NUM2DBL(args[8]),
528
+ interp_type, NUM2INT(args[10]),
529
+ NUM2INT(args[11]), NUM2INT(args[12]),
530
+ NUM2INT(args[13]), NUM2UINT(args[14]),
531
+ NUM2UINT(args[15]));
532
+ ret = self;
533
+ break;
534
+ default:
535
+ rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
536
+ break;
537
+ }
538
+ return ret;
539
+ }
540
+
541
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0)
542
+ static VALUE
543
+ rg_rotate(VALUE self, VALUE angle)
544
+ {
545
+ VALUE ret;
546
+ GdkPixbuf* dest = gdk_pixbuf_rotate_simple(_SELF(self), RVAL2GDKPIXBUFROTATION(angle));
547
+ if (dest == NULL)
548
+ return Qnil;
549
+ ret = GOBJ2RVAL(dest);
550
+ g_object_unref(dest);
551
+ return ret;
552
+ }
553
+
554
+ static VALUE
555
+ rg_flip(VALUE self, VALUE horizontal)
556
+ {
557
+ VALUE ret;
558
+ GdkPixbuf* dest = gdk_pixbuf_flip(_SELF(self), RVAL2CBOOL(horizontal));
559
+ if (dest == NULL)
560
+ return Qnil;
561
+ ret = GOBJ2RVAL(dest);
562
+ g_object_unref(dest);
563
+ return ret;
564
+ }
565
+ #endif
566
+
567
+ static VALUE
568
+ rg_add_alpha(VALUE self, VALUE substitute_color, VALUE r, VALUE g, VALUE b)
569
+ {
570
+ VALUE ret;
571
+ GdkPixbuf* dest = gdk_pixbuf_add_alpha(_SELF(self),
572
+ RVAL2CBOOL(substitute_color),
573
+ FIX2INT(r), FIX2INT(g), FIX2INT(b));
574
+ if (dest == NULL)
575
+ return Qnil;
576
+ ret = GOBJ2RVAL(dest);
577
+ g_object_unref(dest);
578
+ return ret;
579
+ }
580
+
581
+ static VALUE
582
+ rg_copy_area(VALUE self, VALUE src_x, VALUE src_y, VALUE width, VALUE height, VALUE dest, VALUE dest_x, VALUE dest_y)
583
+ {
584
+ gdk_pixbuf_copy_area(_SELF(self), NUM2INT(src_x), NUM2INT(src_y),
585
+ NUM2INT(width), NUM2INT(height),
586
+ _SELF(dest), NUM2INT(dest_x), NUM2INT(dest_y));
587
+ return dest;
588
+ }
589
+
590
+ static VALUE
591
+ rg_saturate_and_pixelate(VALUE self, VALUE staturation, VALUE pixelate)
592
+ {
593
+ GdkPixbuf* dest = gdk_pixbuf_copy(_SELF(self));
594
+ gdk_pixbuf_saturate_and_pixelate(_SELF(self), dest,
595
+ NUM2DBL(staturation), RVAL2CBOOL(pixelate));
596
+ return GOBJ2RVAL(dest);
597
+ }
598
+
599
+ static VALUE
600
+ rg_fill_bang(VALUE self, VALUE pixel)
601
+ {
602
+ gdk_pixbuf_fill(_SELF(self), NUM2UINT(pixel));
603
+ return self;
604
+ }
605
+
606
+ /* From Module Interface */
607
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0)
608
+ static VALUE
609
+ rg_s_formats(G_GNUC_UNUSED VALUE self)
610
+ {
611
+ return GSLIST2ARY2(gdk_pixbuf_get_formats(), GDK_TYPE_PIXBUF_FORMAT);
612
+ }
613
+
614
+ #ifdef HAVE_GDK_PIXBUF_SET_OPTION
615
+ static VALUE
616
+ rg_set_option(VALUE self, VALUE key, VALUE value)
617
+ {
618
+ return CBOOL2RVAL(gdk_pixbuf_set_option(_SELF(self),
619
+ RVAL2CSTR(key), RVAL2CSTR(value)));
620
+ }
621
+ #else
622
+ static VALUE
623
+ rg_set_option(G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE key, G_GNUC_UNUSED VALUE value)
624
+ {
625
+ rb_warning("not supported in this version of GTK+");
626
+ return Qfalse;
627
+ }
628
+ #endif
629
+ #endif
630
+
631
+ extern void Init_gdk_pixbuf2(void);
632
+
633
+ void
634
+ Init_gdk_pixbuf2(void)
635
+ {
636
+ VALUE mGdk = rb_define_module("Gdk");
637
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF, "Pixbuf", mGdk);
638
+
639
+ id_pixdata = rb_intern("pixdata");
640
+
641
+ /*
642
+ gdk_rgb_init();*/ /* initialize it anyway */
643
+
644
+ /*
645
+ * Initialization and Versions
646
+ */
647
+ /* Removed. This crashes Ruby/GTK on Windows + GTK+-2.4.x.
648
+ Pointed out by Laurent.
649
+ #ifdef HAVE_GDK_PIXBUF_VERSION
650
+ rb_define_const(RG_TARGET_NAMESPACE, "VERSION", CSTR2RVAL(gdk_pixbuf_version));
651
+ #endif
652
+ */
653
+ rb_define_const(RG_TARGET_NAMESPACE, "MAJOR", INT2FIX(GDK_PIXBUF_MAJOR));
654
+ rb_define_const(RG_TARGET_NAMESPACE, "MINOR", INT2FIX(GDK_PIXBUF_MINOR));
655
+ rb_define_const(RG_TARGET_NAMESPACE, "MICRO", INT2FIX(GDK_PIXBUF_MICRO));
656
+
657
+ /*
658
+ * The GdkPixbuf Structure
659
+ */
660
+ G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "pixels", get_pixels, 0);
661
+ RG_DEF_METHOD_OPERATOR("pixels=", set_pixels, 1);
662
+ RG_DEF_METHOD(get_option, 1);
663
+
664
+ /* GdkPixbufError */
665
+ G_DEF_ERROR(GDK_PIXBUF_ERROR, "PixbufError", mGdk, rb_eRuntimeError, GDK_TYPE_PIXBUF_ERROR);
666
+
667
+ /* GdkColorspace */
668
+ G_DEF_CLASS(GDK_TYPE_COLORSPACE, "ColorSpace", RG_TARGET_NAMESPACE);
669
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_COLORSPACE, "GDK_");
670
+
671
+ /* GdkPixbufAlphaMode */
672
+ G_DEF_CLASS(GDK_TYPE_PIXBUF_ALPHA_MODE, "AlphaMode", RG_TARGET_NAMESPACE);
673
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_PIXBUF_ALPHA_MODE, "GDK_PIXBUF_");
674
+
675
+ /*
676
+ * File Loading, Image Data in Memory
677
+ */
678
+ RG_DEF_METHOD(initialize, -1);
679
+ RG_DEF_METHOD(dup, 0);
680
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
681
+ RG_DEF_SMETHOD(get_file_info, 1);
682
+ #endif
683
+
684
+ /*
685
+ * File saving
686
+ */
687
+ RG_DEF_METHOD(save, -1);
688
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
689
+ RG_DEF_METHOD(save_to_buffer, -1);
690
+ #endif
691
+
692
+ /*
693
+ * Scaling
694
+ */
695
+ RG_DEF_METHOD(scale, -1);
696
+ RG_DEF_METHOD_BANG(scale, -1);
697
+ RG_DEF_METHOD(composite, 7);
698
+ RG_DEF_METHOD_BANG(composite, -1);
699
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0)
700
+ RG_DEF_METHOD(rotate, 1);
701
+ RG_DEF_METHOD(flip, 1);
702
+ #endif
703
+
704
+ /* GdkInterpType */
705
+ G_DEF_CLASS(GDK_TYPE_INTERP_TYPE, "InterpType", RG_TARGET_NAMESPACE);
706
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INTERP_TYPE, "GDK_");
707
+
708
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0)
709
+ /* GdkPixbufRotation */
710
+ G_DEF_CLASS(GDK_TYPE_PIXBUF_ROTATION, "GdkPixbufRotation", RG_TARGET_NAMESPACE);
711
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_PIXBUF_ROTATION, "GDK_PIXBUF_");
712
+ #endif
713
+ /*
714
+ * Utilities
715
+ */
716
+ RG_DEF_METHOD(add_alpha, 4);
717
+ RG_DEF_METHOD(copy_area, 7);
718
+ RG_DEF_METHOD(saturate_and_pixelate, 2);
719
+ RG_DEF_METHOD_BANG(fill, 1);
720
+
721
+ /*
722
+ * Module Interface
723
+ */
724
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0)
725
+ RG_DEF_SMETHOD(formats, 0);
726
+ RG_DEF_METHOD(set_option, 2);
727
+ #endif
728
+
729
+ Init_gdk_pixbuf_animation(mGdk);
730
+ Init_gdk_pixbuf_animation_iter(mGdk);
731
+ #if RBGDK_PIXBUF_CHECK_VERSION(2,8,0)
732
+ Init_gdk_pixbuf_simpleanim(mGdk);
733
+ #endif
734
+ Init_gdk_pixdata(mGdk);
735
+ Init_gdk_pixbuf_loader(mGdk);
736
+ Init_gdk_pixbuf_format(mGdk);
737
+ }