| 62 * |
62 * |
| 63 * Returns: TRUE if the pixbuf is opaque around the edges, FALSE otherwise |
63 * Returns: TRUE if the pixbuf is opaque around the edges, FALSE otherwise |
| 64 */ |
64 */ |
| 65 gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf); |
65 gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf); |
| 66 |
66 |
| |
67 /** |
| |
68 * pidgin_pixbuf_from_data: |
| |
69 * @buf: The raw binary image data. |
| |
70 * @count: The length of buf in bytes. |
| |
71 * |
| |
72 * Create a GdkPixbuf from a chunk of image data. |
| |
73 * |
| |
74 * Returns: (transfer full): A GdkPixbuf created from the image data, or NULL if |
| |
75 * there was an error parsing the data. |
| |
76 */ |
| |
77 GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); |
| |
78 |
| |
79 /** |
| |
80 * pidgin_pixbuf_anim_from_data: |
| |
81 * @buf: The raw binary image data. |
| |
82 * @count: The length of buf in bytes. |
| |
83 * |
| |
84 * Create a GdkPixbufAnimation from a chunk of image data. |
| |
85 * |
| |
86 * Returns: (transfer full): A GdkPixbufAnimation created from the image data, or NULL if |
| |
87 * there was an error parsing the data. |
| |
88 */ |
| |
89 GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count); |
| |
90 |
| |
91 /** |
| |
92 * pidgin_pixbuf_from_image: |
| |
93 * @image: a PurpleImage. |
| |
94 * |
| |
95 * Create a GdkPixbuf from a PurpleImage. |
| |
96 * |
| |
97 * Returns: (transfer full): a GdkPixbuf created from the @image. |
| |
98 */ |
| |
99 GdkPixbuf * |
| |
100 pidgin_pixbuf_from_image(PurpleImage *image); |
| |
101 |
| |
102 /** |
| |
103 * pidgin_pixbuf_new_from_file: |
| |
104 * @filename: Name of file to load, in the GLib file name encoding |
| |
105 * |
| |
106 * Helper function that calls gdk_pixbuf_new_from_file() and checks both |
| |
107 * the return code and the GError and returns NULL if either one failed. |
| |
108 * |
| |
109 * The gdk-pixbuf documentation implies that it is sufficient to check |
| |
110 * the return value of gdk_pixbuf_new_from_file() to determine |
| |
111 * whether the image was able to be loaded. However, this is not the case |
| |
112 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some |
| |
113 * cases a GdkPixbuf object is returned that will cause some operations |
| |
114 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an |
| |
115 * infinite loop. |
| |
116 * |
| |
117 * This function shouldn't be necessary once Pidgin requires a version of |
| |
118 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be |
| |
119 * nice to keep this function around for the debug message that it logs. |
| |
120 * |
| |
121 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and |
| |
122 * a warning is logged. |
| |
123 */ |
| |
124 GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); |
| |
125 |
| |
126 /** |
| |
127 * pidgin_pixbuf_new_from_file_at_size: |
| |
128 * @filename: Name of file to load, in the GLib file name encoding |
| |
129 * @width: The width the image should have or -1 to not constrain the width |
| |
130 * @height: The height the image should have or -1 to not constrain the height |
| |
131 * |
| |
132 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks |
| |
133 * both the return code and the GError and returns NULL if either one failed. |
| |
134 * |
| |
135 * The gdk-pixbuf documentation implies that it is sufficient to check |
| |
136 * the return value of gdk_pixbuf_new_from_file_at_size() to determine |
| |
137 * whether the image was able to be loaded. However, this is not the case |
| |
138 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some |
| |
139 * cases a GdkPixbuf object is returned that will cause some operations |
| |
140 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an |
| |
141 * infinite loop. |
| |
142 * |
| |
143 * This function shouldn't be necessary once Pidgin requires a version of |
| |
144 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be |
| |
145 * nice to keep this function around for the debug message that it logs. |
| |
146 * |
| |
147 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and |
| |
148 * a warning is logged. |
| |
149 */ |
| |
150 GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height); |
| |
151 |
| |
152 /** |
| |
153 * pidgin_pixbuf_new_from_file_at_scale: |
| |
154 * @filename: Name of file to load, in the GLib file name encoding |
| |
155 * @width: The width the image should have or -1 to not constrain the width |
| |
156 * @height: The height the image should have or -1 to not constrain the height |
| |
157 * @preserve_aspect_ratio: TRUE to preserve the image's aspect ratio |
| |
158 * |
| |
159 * Helper function that calls gdk_pixbuf_new_from_file_at_scale() and checks |
| |
160 * both the return code and the GError and returns NULL if either one failed. |
| |
161 * |
| |
162 * The gdk-pixbuf documentation implies that it is sufficient to check |
| |
163 * the return value of gdk_pixbuf_new_from_file_at_scale() to determine |
| |
164 * whether the image was able to be loaded. However, this is not the case |
| |
165 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some |
| |
166 * cases a GdkPixbuf object is returned that will cause some operations |
| |
167 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an |
| |
168 * infinite loop. |
| |
169 * |
| |
170 * This function shouldn't be necessary once Pidgin requires a version of |
| |
171 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be |
| |
172 * nice to keep this function around for the debug message that it logs. |
| |
173 * |
| |
174 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and |
| |
175 * a warning is logged. |
| |
176 */ |
| |
177 GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio); |
| |
178 |
| |
179 /** |
| |
180 * pidgin_pixbuf_scale_down: |
| |
181 * @src: The source image. |
| |
182 * @max_width: Maximum width in px. |
| |
183 * @max_height: Maximum height in px. |
| |
184 * @interp_type: Interpolation method. |
| |
185 * @preserve_ratio: %TRUE to preserve image's aspect ratio. |
| |
186 * |
| |
187 * Scales the image to the desired dimensions. If image is smaller, it will be |
| |
188 * returned without modifications. |
| |
189 * |
| |
190 * If new image is created, @src reference count will be decreased and new image |
| |
191 * with a ref count of 1 will be returned. |
| |
192 * |
| |
193 * Returns: (transfer full): The image with proper sizing. %NULL in case of error. |
| |
194 */ |
| |
195 GdkPixbuf * |
| |
196 pidgin_pixbuf_scale_down(GdkPixbuf *src, guint max_width, guint max_height, |
| |
197 GdkInterpType interp_type, gboolean preserve_ratio); |
| |
198 |
| |
199 |
| |
200 |
| 67 G_END_DECLS |
201 G_END_DECLS |
| 68 |
202 |
| 69 #endif /* PIDGIN_GDK_PIXBUF_H */ |
203 #endif /* PIDGIN_GDK_PIXBUF_H */ |