libpurple/purplegdkpixbuf.h

Fri, 20 Oct 2023 01:09:45 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 20 Oct 2023 01:09:45 -0500
changeset 42375
8e61249e9b10
parent 42338
2548eb61acc9
child 42391
090b03385984
permissions
-rw-r--r--

Implement ProtocolFileTransfer

Testing Done:
Ran the unit tests under valgrind.

Bugs closed: PIDGIN-17833

Reviewed at https://reviews.imfreedom.org/r/2643/

41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
1 /*
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
2 * Purple - Internet Messaging Library
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
24 # error "only <purple.h> may be included directly"
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39570
diff changeset
25 #endif
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39570
diff changeset
26
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
27 #ifndef PURPLE_GDK_PIXBUF_H
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
28 #define PURPLE_GDK_PIXBUF_H
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include <glib.h>
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
31
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 #include <gdk-pixbuf/gdk-pixbuf.h>
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
42338
2548eb61acc9 Make sure all internal includes use double quotes
Gary Kramlich <grim@reaperworld.com>
parents: 41319
diff changeset
34 #include "image.h"
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 G_BEGIN_DECLS
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
39570
a6ec70c31e9e Add missing docs on pidgin_gdk_pixbuf_new_from_image
Gary Kramlich <grim@reaperworld.com>
parents: 39569
diff changeset
38 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
39 * purple_gdk_pixbuf_make_round:
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 * @pixbuf: The buddy icon to transform
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 *
39569
0f82795adcb5 Clean up a bad comment
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
42 * Rounds the corners of a GdkPixbuf in place.
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 */
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
44 void purple_gdk_pixbuf_make_round(GdkPixbuf *pixbuf);
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
47 * purple_gdk_pixbuf_is_opaque:
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * @pixbuf: The pixbuf
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 * Returns TRUE if the GdkPixbuf is opaque, as determined by no
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 * alpha at any of the edge pixels.
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 *
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * Returns: TRUE if the pixbuf is opaque around the edges, FALSE otherwise
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 */
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
55 gboolean purple_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf);
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
57 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
58 * purple_gdk_pixbuf_from_data:
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
59 * @buf: The raw binary image data.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
60 * @count: The length of buf in bytes.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
61 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
62 * Create a GdkPixbuf from a chunk of image data.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
63 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
64 * Returns: (transfer full): A GdkPixbuf created from the image data, or NULL if
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
65 * there was an error parsing the data.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
66 */
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
67 GdkPixbuf *purple_gdk_pixbuf_from_data(const guchar *buf, gsize count);
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
68
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
69 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
70 * purple_gdk_pixbuf_from_image:
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
71 * @image: a PurpleImage.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
72 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
73 * Create a GdkPixbuf from a PurpleImage.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
74 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
75 * Returns: (transfer full): a GdkPixbuf created from the @image.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
76 */
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
77 GdkPixbuf *
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
78 purple_gdk_pixbuf_from_image(PurpleImage *image);
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
79
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
80 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
81 * purple_gdk_pixbuf_new_from_file:
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
82 * @filename: Name of file to load, in the GLib file name encoding
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
83 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
84 * Helper function that calls gdk_pixbuf_new_from_file() and checks both
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
85 * the return code and the GError and returns NULL if either one failed.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
86 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
87 * The gdk-pixbuf documentation implies that it is sufficient to check
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
88 * the return value of gdk_pixbuf_new_from_file() to determine
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
89 * whether the image was able to be loaded. However, this is not the case
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
90 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
91 * cases a GdkPixbuf object is returned that will cause some operations
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
92 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
93 * infinite loop.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
94 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
95 * This function shouldn't be necessary once Pidgin requires a version of
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
96 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
97 * nice to keep this function around for the debug message that it logs.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
98 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
99 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
100 * a warning is logged.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
101 */
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
102 GdkPixbuf *purple_gdk_pixbuf_new_from_file(const char *filename);
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
103
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
104 /**
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
105 * purple_gdk_pixbuf_new_from_file_at_size:
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
106 * @filename: Name of file to load, in the GLib file name encoding
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
107 * @width: The width the image should have or -1 to not constrain the width
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
108 * @height: The height the image should have or -1 to not constrain the height
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
109 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
110 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
111 * both the return code and the GError and returns NULL if either one failed.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
112 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
113 * The gdk-pixbuf documentation implies that it is sufficient to check
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
114 * the return value of gdk_pixbuf_new_from_file_at_size() to determine
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
115 * whether the image was able to be loaded. However, this is not the case
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
116 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
117 * cases a GdkPixbuf object is returned that will cause some operations
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
118 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
119 * infinite loop.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
120 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
121 * This function shouldn't be necessary once Pidgin requires a version of
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
122 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
123 * nice to keep this function around for the debug message that it logs.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
124 *
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
125 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
126 * a warning is logged.
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
127 */
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
128 GdkPixbuf *purple_gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height);
41144
910bdda75c74 Move the pidgin_pixbuf stuff to pidgingdkpixbuf.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41124
diff changeset
129
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 G_END_DECLS
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131
41319
04d027ed3d63 Add gdk-pixbuf as a libpurple dependency and move helpers from pidgin to purple
Gary Kramlich <grim@reaperworld.com>
parents: 41144
diff changeset
132 #endif /* PURPLE_GDK_PIXBUF_H */

mercurial