| 1 | /* GdkPixbuf library - GdkPixbuf data structure |
| 2 | * |
| 3 | * Copyright (C) 2003 The Free Software Foundation |
| 4 | * |
| 5 | * Authors: Mark Crichton <crichton@gimp.org> |
| 6 | * Miguel de Icaza <miguel@gnu.org> |
| 7 | * Federico Mena-Quintero <federico@gimp.org> |
| 8 | * Havoc Pennington <hp@redhat.com> |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Lesser General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 22 | */ |
| 23 | |
| 24 | #ifndef GDK_PIXBUF_CORE_H |
| 25 | #define GDK_PIXBUF_CORE_H |
| 26 | |
| 27 | #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION) |
| 28 | #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly." |
| 29 | #endif |
| 30 | |
| 31 | #include <glib.h> |
| 32 | #include <glib-object.h> |
| 33 | #include <gio/gio.h> |
| 34 | |
| 35 | #include <gdk-pixbuf/gdk-pixbuf-macros.h> |
| 36 | |
| 37 | G_BEGIN_DECLS |
| 38 | |
| 39 | /** |
| 40 | * SECTION:gdk-pixbuf |
| 41 | * @Short_description: Information that describes an image. |
| 42 | * @Title: The GdkPixbuf Structure |
| 43 | * |
| 44 | * The #GdkPixbuf structure contains |
| 45 | * information that describes an image in memory. |
| 46 | * |
| 47 | * ## Image Data ## {#image-data} |
| 48 | * |
| 49 | * Image data in a pixbuf is stored in memory in uncompressed, |
| 50 | * packed format. Rows in the image are stored top to bottom, and |
| 51 | * in each row pixels are stored from left to right. There may be |
| 52 | * padding at the end of a row. The "rowstride" value of a pixbuf, |
| 53 | * as returned by gdk_pixbuf_get_rowstride(), indicates the number |
| 54 | * of bytes between rows. |
| 55 | * |
| 56 | * ## put_pixel() Example ## {#put-pixel} |
| 57 | * |
| 58 | * The following code illustrates a simple put_pixel() |
| 59 | * function for RGB pixbufs with 8 bits per channel with an alpha |
| 60 | * channel. It is not included in the gdk-pixbuf library for |
| 61 | * performance reasons; rather than making several function calls |
| 62 | * for each pixel, your own code can take shortcuts. |
| 63 | * |
| 64 | * |[<!-- language="C" --> |
| 65 | * static void |
| 66 | * put_pixel (GdkPixbuf *pixbuf, int x, int y, guchar red, guchar green, guchar blue, guchar alpha) |
| 67 | * { |
| 68 | * int width, height, rowstride, n_channels; |
| 69 | * guchar *pixels, *p; |
| 70 | * |
| 71 | * n_channels = gdk_pixbuf_get_n_channels (pixbuf); |
| 72 | * |
| 73 | * g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB); |
| 74 | * g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); |
| 75 | * g_assert (gdk_pixbuf_get_has_alpha (pixbuf)); |
| 76 | * g_assert (n_channels == 4); |
| 77 | * |
| 78 | * width = gdk_pixbuf_get_width (pixbuf); |
| 79 | * height = gdk_pixbuf_get_height (pixbuf); |
| 80 | * |
| 81 | * g_assert (x >= 0 && x < width); |
| 82 | * g_assert (y >= 0 && y < height); |
| 83 | * |
| 84 | * rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
| 85 | * pixels = gdk_pixbuf_get_pixels (pixbuf); |
| 86 | * |
| 87 | * p = pixels + y * rowstride + x * n_channels; |
| 88 | * p[0] = red; |
| 89 | * p[1] = green; |
| 90 | * p[2] = blue; |
| 91 | * p[3] = alpha; |
| 92 | * } |
| 93 | * ]| |
| 94 | * |
| 95 | * This function will not work for pixbufs with images that are |
| 96 | * other than 8 bits per sample or channel, but it will work for |
| 97 | * most of the pixbufs that GTK+ uses. |
| 98 | * |
| 99 | * If you are doing memcpy() of raw pixbuf data, note that the last row |
| 100 | * in the pixbuf may not be as wide as the full rowstride, but rather |
| 101 | * just as wide as the pixel data needs to be. That is, it is unsafe to |
| 102 | * do `memcpy (dest, pixels, rowstride * height)` to copy a whole pixbuf. |
| 103 | * Use gdk_pixbuf_copy() instead, or compute the width in bytes of the |
| 104 | * last row as `width * ((n_channels * bits_per_sample + 7) / 8)`. |
| 105 | */ |
| 106 | |
| 107 | |
| 108 | /** |
| 109 | * GdkPixbufAlphaMode: |
| 110 | * @GDK_PIXBUF_ALPHA_BILEVEL: A bilevel clipping mask (black and white) |
| 111 | * will be created and used to draw the image. Pixels below 0.5 opacity |
| 112 | * will be considered fully transparent, and all others will be |
| 113 | * considered fully opaque. |
| 114 | * @GDK_PIXBUF_ALPHA_FULL: For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL. |
| 115 | * In the future it will do full alpha compositing. |
| 116 | * |
| 117 | * These values can be passed to |
| 118 | * gdk_pixbuf_xlib_render_to_drawable_alpha() to control how the alpha |
| 119 | * channel of an image should be handled. This function can create a |
| 120 | * bilevel clipping mask (black and white) and use it while painting |
| 121 | * the image. In the future, when the X Window System gets an alpha |
| 122 | * channel extension, it will be possible to do full alpha |
| 123 | * compositing onto arbitrary drawables. For now both cases fall |
| 124 | * back to a bilevel clipping mask. |
| 125 | */ |
| 126 | typedef enum |
| 127 | { |
| 128 | GDK_PIXBUF_ALPHA_BILEVEL, |
| 129 | GDK_PIXBUF_ALPHA_FULL |
| 130 | } GdkPixbufAlphaMode; |
| 131 | |
| 132 | /** |
| 133 | * GdkColorspace: |
| 134 | * @GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space. |
| 135 | * |
| 136 | * This enumeration defines the color spaces that are supported by |
| 137 | * the gdk-pixbuf library. Currently only RGB is supported. |
| 138 | */ |
| 139 | /* Note that these values are encoded in inline pixbufs |
| 140 | * as ints, so don't reorder them |
| 141 | */ |
| 142 | typedef enum { |
| 143 | GDK_COLORSPACE_RGB |
| 144 | } GdkColorspace; |
| 145 | |
| 146 | /* All of these are opaque structures */ |
| 147 | |
| 148 | /** |
| 149 | * GdkPixbuf: |
| 150 | * |
| 151 | * This is the main structure in the gdk-pixbuf library. It is |
| 152 | * used to represent images. It contains information about the |
| 153 | * image's pixel data, its color space, bits per sample, width and |
| 154 | * height, and the rowstride (the number of bytes between the start of |
| 155 | * one row and the start of the next). |
| 156 | */ |
| 157 | typedef struct _GdkPixbuf GdkPixbuf; |
| 158 | |
| 159 | #define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ()) |
| 160 | #define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf)) |
| 161 | #define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF)) |
| 162 | |
| 163 | |
| 164 | /** |
| 165 | * GdkPixbufDestroyNotify: |
| 166 | * @pixels: (array) (element-type guint8): The pixel array of the pixbuf |
| 167 | * that is being finalized. |
| 168 | * @data: (closure): User closure data. |
| 169 | * |
| 170 | * A function of this type is responsible for freeing the pixel array |
| 171 | * of a pixbuf. The gdk_pixbuf_new_from_data() function lets you |
| 172 | * pass in a pre-allocated pixel array so that a pixbuf can be |
| 173 | * created from it; in this case you will need to pass in a function |
| 174 | * of #GdkPixbufDestroyNotify so that the pixel data can be freed |
| 175 | * when the pixbuf is finalized. |
| 176 | */ |
| 177 | typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data); |
| 178 | |
| 179 | /** |
| 180 | * GDK_PIXBUF_ERROR: |
| 181 | * |
| 182 | * Error domain used for pixbuf operations. Indicates that the error code |
| 183 | * will be in the #GdkPixbufError enumeration. See #GError for |
| 184 | * information on error domains and error codes. |
| 185 | */ |
| 186 | #define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark () |
| 187 | |
| 188 | /** |
| 189 | * GdkPixbufError: |
| 190 | * @GDK_PIXBUF_ERROR_CORRUPT_IMAGE: An image file was broken somehow. |
| 191 | * @GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY: Not enough memory. |
| 192 | * @GDK_PIXBUF_ERROR_BAD_OPTION: A bad option was passed to a pixbuf save module. |
| 193 | * @GDK_PIXBUF_ERROR_UNKNOWN_TYPE: Unknown image type. |
| 194 | * @GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION: Don't know how to perform the |
| 195 | * given operation on the type of image at hand. |
| 196 | * @GDK_PIXBUF_ERROR_FAILED: Generic failure code, something went wrong. |
| 197 | * @GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION: Only part of the animation was loaded. |
| 198 | * |
| 199 | * An error code in the #GDK_PIXBUF_ERROR domain. Many gdk-pixbuf |
| 200 | * operations can cause errors in this domain, or in the #G_FILE_ERROR |
| 201 | * domain. |
| 202 | */ |
| 203 | typedef enum { |
| 204 | /* image data hosed */ |
| 205 | GDK_PIXBUF_ERROR_CORRUPT_IMAGE, |
| 206 | /* no mem to load image */ |
| 207 | GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, |
| 208 | /* bad option passed to save routine */ |
| 209 | GDK_PIXBUF_ERROR_BAD_OPTION, |
| 210 | /* unsupported image type (sort of an ENOSYS) */ |
| 211 | GDK_PIXBUF_ERROR_UNKNOWN_TYPE, |
| 212 | /* unsupported operation (load, save) for image type */ |
| 213 | GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION, |
| 214 | GDK_PIXBUF_ERROR_FAILED, |
| 215 | GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION |
| 216 | } GdkPixbufError; |
| 217 | |
| 218 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 219 | GQuark gdk_pixbuf_error_quark (void); |
| 220 | |
| 221 | |
| 222 | |
| 223 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 224 | GType gdk_pixbuf_get_type (void) G_GNUC_CONST; |
| 225 | |
| 226 | /* Reference counting */ |
| 227 | |
| 228 | #ifndef GDK_PIXBUF_DISABLE_DEPRECATED |
| 229 | GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_ref) |
| 230 | GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf); |
| 231 | GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_unref) |
| 232 | void gdk_pixbuf_unref (GdkPixbuf *pixbuf); |
| 233 | #endif |
| 234 | |
| 235 | /* GdkPixbuf accessors */ |
| 236 | |
| 237 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 238 | GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf); |
| 239 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 240 | int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf); |
| 241 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 242 | gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf); |
| 243 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 244 | int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf); |
| 245 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 246 | guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf); |
| 247 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 248 | int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf); |
| 249 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 250 | int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf); |
| 251 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 252 | int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf); |
| 253 | GDK_PIXBUF_AVAILABLE_IN_2_26 |
| 254 | gsize gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf); |
| 255 | |
| 256 | GDK_PIXBUF_AVAILABLE_IN_2_26 |
| 257 | guchar *gdk_pixbuf_get_pixels_with_length (const GdkPixbuf *pixbuf, |
| 258 | guint *length); |
| 259 | |
| 260 | GDK_PIXBUF_AVAILABLE_IN_2_32 |
| 261 | const guint8* gdk_pixbuf_read_pixels (const GdkPixbuf *pixbuf); |
| 262 | GDK_PIXBUF_AVAILABLE_IN_2_32 |
| 263 | GBytes * gdk_pixbuf_read_pixel_bytes (const GdkPixbuf *pixbuf); |
| 264 | |
| 265 | |
| 266 | |
| 267 | /* Create a blank pixbuf with an optimal rowstride and a new buffer */ |
| 268 | |
| 269 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 270 | GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, |
| 271 | int width, int height); |
| 272 | |
| 273 | GDK_PIXBUF_AVAILABLE_IN_2_36 |
| 274 | gint gdk_pixbuf_calculate_rowstride (GdkColorspace colorspace, |
| 275 | gboolean has_alpha, |
| 276 | int bits_per_sample, |
| 277 | int width, |
| 278 | int height); |
| 279 | |
| 280 | /* Copy a pixbuf */ |
| 281 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 282 | GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf); |
| 283 | |
| 284 | /* Create a pixbuf which points to the pixels of another pixbuf */ |
| 285 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 286 | GdkPixbuf *gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf, |
| 287 | int src_x, |
| 288 | int src_y, |
| 289 | int width, |
| 290 | int height); |
| 291 | |
| 292 | /* Simple loading */ |
| 293 | |
| 294 | #ifdef G_OS_WIN32 |
| 295 | /* In previous versions these _utf8 variants where exported and linked to |
| 296 | * by default. Export them here for ABI (and gi API) compat. |
| 297 | */ |
| 298 | |
| 299 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 300 | GdkPixbuf *gdk_pixbuf_new_from_file_utf8 (const char *filename, |
| 301 | GError **error); |
| 302 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 303 | GdkPixbuf *gdk_pixbuf_new_from_file_at_size_utf8 (const char *filename, |
| 304 | int width, |
| 305 | int height, |
| 306 | GError **error); |
| 307 | GDK_PIXBUF_AVAILABLE_IN_2_6 |
| 308 | GdkPixbuf *gdk_pixbuf_new_from_file_at_scale_utf8 (const char *filename, |
| 309 | int width, |
| 310 | int height, |
| 311 | gboolean preserve_aspect_ratio, |
| 312 | GError **error); |
| 313 | #endif |
| 314 | |
| 315 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 316 | GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename, |
| 317 | GError **error); |
| 318 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 319 | GdkPixbuf *gdk_pixbuf_new_from_file_at_size (const char *filename, |
| 320 | int width, |
| 321 | int height, |
| 322 | GError **error); |
| 323 | GDK_PIXBUF_AVAILABLE_IN_2_6 |
| 324 | GdkPixbuf *gdk_pixbuf_new_from_file_at_scale (const char *filename, |
| 325 | int width, |
| 326 | int height, |
| 327 | gboolean preserve_aspect_ratio, |
| 328 | GError **error); |
| 329 | GDK_PIXBUF_AVAILABLE_IN_2_26 |
| 330 | GdkPixbuf *gdk_pixbuf_new_from_resource (const char *resource_path, |
| 331 | GError **error); |
| 332 | GDK_PIXBUF_AVAILABLE_IN_2_26 |
| 333 | GdkPixbuf *gdk_pixbuf_new_from_resource_at_scale (const char *resource_path, |
| 334 | int width, |
| 335 | int height, |
| 336 | gboolean preserve_aspect_ratio, |
| 337 | GError **error); |
| 338 | |
| 339 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 340 | GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data, |
| 341 | GdkColorspace colorspace, |
| 342 | gboolean has_alpha, |
| 343 | int bits_per_sample, |
| 344 | int width, int height, |
| 345 | int rowstride, |
| 346 | GdkPixbufDestroyNotify destroy_fn, |
| 347 | gpointer destroy_fn_data); |
| 348 | |
| 349 | GDK_PIXBUF_AVAILABLE_IN_2_32 |
| 350 | GdkPixbuf *gdk_pixbuf_new_from_bytes (GBytes *data, |
| 351 | GdkColorspace colorspace, |
| 352 | gboolean has_alpha, |
| 353 | int bits_per_sample, |
| 354 | int width, int height, |
| 355 | int rowstride); |
| 356 | |
| 357 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 358 | GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data); |
| 359 | |
| 360 | #ifndef GDK_PIXBUF_DISABLE_DEPRECATED |
| 361 | GDK_PIXBUF_DEPRECATED_IN_2_32 |
| 362 | GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length, |
| 363 | const guint8 *data, |
| 364 | gboolean copy_pixels, |
| 365 | GError **error); |
| 366 | #endif |
| 367 | |
| 368 | /* Mutations */ |
| 369 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 370 | void gdk_pixbuf_fill (GdkPixbuf *pixbuf, |
| 371 | guint32 pixel); |
| 372 | |
| 373 | /* Saving */ |
| 374 | |
| 375 | #ifndef __GTK_DOC_IGNORE__ |
| 376 | #ifdef G_OS_WIN32 |
| 377 | /* DLL ABI stability hack. */ |
| 378 | #define gdk_pixbuf_save gdk_pixbuf_save_utf8 |
| 379 | #endif |
| 380 | #endif |
| 381 | |
| 382 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 383 | gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf, |
| 384 | const char *filename, |
| 385 | const char *type, |
| 386 | GError **error, |
| 387 | ...) G_GNUC_NULL_TERMINATED; |
| 388 | |
| 389 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 390 | gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf, |
| 391 | const char *filename, |
| 392 | const char *type, |
| 393 | char **option_keys, |
| 394 | char **option_values, |
| 395 | GError **error); |
| 396 | |
| 397 | #ifdef G_OS_WIN32 |
| 398 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 399 | gboolean gdk_pixbuf_savev_utf8 (GdkPixbuf *pixbuf, |
| 400 | const char *filename, |
| 401 | const char *type, |
| 402 | char **option_keys, |
| 403 | char **option_values, |
| 404 | GError **error); |
| 405 | #endif |
| 406 | |
| 407 | /* Saving to a callback function */ |
| 408 | |
| 409 | |
| 410 | /** |
| 411 | * GdkPixbufSaveFunc: |
| 412 | * @buf: (array length=count) (element-type guint8): bytes to be written. |
| 413 | * @count: number of bytes in @buf. |
| 414 | * @error: (out): A location to return an error. |
| 415 | * @data: (closure): user data passed to gdk_pixbuf_save_to_callback(). |
| 416 | * |
| 417 | * Specifies the type of the function passed to |
| 418 | * gdk_pixbuf_save_to_callback(). It is called once for each block of |
| 419 | * bytes that is "written" by gdk_pixbuf_save_to_callback(). If |
| 420 | * successful it should return %TRUE. If an error occurs it should set |
| 421 | * @error and return %FALSE, in which case gdk_pixbuf_save_to_callback() |
| 422 | * will fail with the same error. |
| 423 | * |
| 424 | * Since: 2.4 |
| 425 | * Returns: %TRUE if successful, %FALSE (with @error set) if failed. |
| 426 | */ |
| 427 | |
| 428 | typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf, |
| 429 | gsize count, |
| 430 | GError **error, |
| 431 | gpointer data); |
| 432 | |
| 433 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 434 | gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, |
| 435 | GdkPixbufSaveFunc save_func, |
| 436 | gpointer user_data, |
| 437 | const char *type, |
| 438 | GError **error, |
| 439 | ...) G_GNUC_NULL_TERMINATED; |
| 440 | |
| 441 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 442 | gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, |
| 443 | GdkPixbufSaveFunc save_func, |
| 444 | gpointer user_data, |
| 445 | const char *type, |
| 446 | char **option_keys, |
| 447 | char **option_values, |
| 448 | GError **error); |
| 449 | |
| 450 | /* Saving into a newly allocated char array */ |
| 451 | |
| 452 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 453 | gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf, |
| 454 | gchar **buffer, |
| 455 | gsize *buffer_size, |
| 456 | const char *type, |
| 457 | GError **error, |
| 458 | ...) G_GNUC_NULL_TERMINATED; |
| 459 | |
| 460 | GDK_PIXBUF_AVAILABLE_IN_2_4 |
| 461 | gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf, |
| 462 | gchar **buffer, |
| 463 | gsize *buffer_size, |
| 464 | const char *type, |
| 465 | char **option_keys, |
| 466 | char **option_values, |
| 467 | GError **error); |
| 468 | |
| 469 | GDK_PIXBUF_AVAILABLE_IN_2_14 |
| 470 | GdkPixbuf *gdk_pixbuf_new_from_stream (GInputStream *stream, |
| 471 | GCancellable *cancellable, |
| 472 | GError **error); |
| 473 | |
| 474 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 475 | void gdk_pixbuf_new_from_stream_async (GInputStream *stream, |
| 476 | GCancellable *cancellable, |
| 477 | GAsyncReadyCallback callback, |
| 478 | gpointer user_data); |
| 479 | |
| 480 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 481 | GdkPixbuf *gdk_pixbuf_new_from_stream_finish (GAsyncResult *async_result, |
| 482 | GError **error); |
| 483 | |
| 484 | GDK_PIXBUF_AVAILABLE_IN_2_14 |
| 485 | GdkPixbuf *gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream, |
| 486 | gint width, |
| 487 | gint height, |
| 488 | gboolean preserve_aspect_ratio, |
| 489 | GCancellable *cancellable, |
| 490 | GError **error); |
| 491 | |
| 492 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 493 | void gdk_pixbuf_new_from_stream_at_scale_async (GInputStream *stream, |
| 494 | gint width, |
| 495 | gint height, |
| 496 | gboolean preserve_aspect_ratio, |
| 497 | GCancellable *cancellable, |
| 498 | GAsyncReadyCallback callback, |
| 499 | gpointer user_data); |
| 500 | |
| 501 | GDK_PIXBUF_AVAILABLE_IN_2_14 |
| 502 | gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf, |
| 503 | GOutputStream *stream, |
| 504 | const char *type, |
| 505 | GCancellable *cancellable, |
| 506 | GError **error, |
| 507 | ...); |
| 508 | |
| 509 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 510 | void gdk_pixbuf_save_to_stream_async (GdkPixbuf *pixbuf, |
| 511 | GOutputStream *stream, |
| 512 | const gchar *type, |
| 513 | GCancellable *cancellable, |
| 514 | GAsyncReadyCallback callback, |
| 515 | gpointer user_data, |
| 516 | ...); |
| 517 | |
| 518 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 519 | gboolean gdk_pixbuf_save_to_stream_finish (GAsyncResult *async_result, |
| 520 | GError **error); |
| 521 | |
| 522 | GDK_PIXBUF_AVAILABLE_IN_2_36 |
| 523 | void gdk_pixbuf_save_to_streamv_async (GdkPixbuf *pixbuf, |
| 524 | GOutputStream *stream, |
| 525 | const gchar *type, |
| 526 | gchar **option_keys, |
| 527 | gchar **option_values, |
| 528 | GCancellable *cancellable, |
| 529 | GAsyncReadyCallback callback, |
| 530 | gpointer user_data); |
| 531 | |
| 532 | GDK_PIXBUF_AVAILABLE_IN_2_36 |
| 533 | gboolean gdk_pixbuf_save_to_streamv (GdkPixbuf *pixbuf, |
| 534 | GOutputStream *stream, |
| 535 | const char *type, |
| 536 | char **option_keys, |
| 537 | char **option_values, |
| 538 | GCancellable *cancellable, |
| 539 | GError **error); |
| 540 | |
| 541 | /* Adding an alpha channel */ |
| 542 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 543 | GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color, |
| 544 | guchar r, guchar g, guchar b); |
| 545 | |
| 546 | /* Copy an area of a pixbuf onto another one */ |
| 547 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 548 | void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf, |
| 549 | int src_x, int src_y, |
| 550 | int width, int height, |
| 551 | GdkPixbuf *dest_pixbuf, |
| 552 | int dest_x, int dest_y); |
| 553 | |
| 554 | /* Brighten/darken and optionally make it pixelated-looking */ |
| 555 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 556 | void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src, |
| 557 | GdkPixbuf *dest, |
| 558 | gfloat saturation, |
| 559 | gboolean pixelate); |
| 560 | |
| 561 | /* Transform an image to agree with its embedded orientation option / tag */ |
| 562 | GDK_PIXBUF_AVAILABLE_IN_2_12 |
| 563 | GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src); |
| 564 | |
| 565 | /* key/value pairs that can be attached by the pixbuf loader */ |
| 566 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 567 | gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, |
| 568 | const gchar *key, |
| 569 | const gchar *value); |
| 570 | GDK_PIXBUF_AVAILABLE_IN_ALL |
| 571 | const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf, |
| 572 | const gchar *key); |
| 573 | GDK_PIXBUF_AVAILABLE_IN_2_36 |
| 574 | gboolean gdk_pixbuf_remove_option (GdkPixbuf *pixbuf, |
| 575 | const gchar *key); |
| 576 | GDK_PIXBUF_AVAILABLE_IN_2_32 |
| 577 | GHashTable * gdk_pixbuf_get_options (GdkPixbuf *pixbuf); |
| 578 | GDK_PIXBUF_AVAILABLE_IN_2_36 |
| 579 | gboolean gdk_pixbuf_copy_options (GdkPixbuf *src_pixbuf, |
| 580 | GdkPixbuf *dest_pixbuf); |
| 581 | |
| 582 | |
| 583 | G_END_DECLS |
| 584 | |
| 585 | |
| 586 | #endif /* GDK_PIXBUF_CORE_H */ |
| 587 | |