|
Packit |
a4058c |
/* GdkPixbuf library - GdkPixbuf data structure
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Copyright (C) 2003 The Free Software Foundation
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Authors: Mark Crichton <crichton@gimp.org>
|
|
Packit |
a4058c |
* Miguel de Icaza <miguel@gnu.org>
|
|
Packit |
a4058c |
* Federico Mena-Quintero <federico@gimp.org>
|
|
Packit |
a4058c |
* Havoc Pennington <hp@redhat.com>
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* This library is free software; you can redistribute it and/or
|
|
Packit |
a4058c |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
a4058c |
* License as published by the Free Software Foundation; either
|
|
Packit |
a4058c |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
a4058c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
a4058c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
a4058c |
* Lesser General Public License for more details.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
a4058c |
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifndef GDK_PIXBUF_CORE_H
|
|
Packit |
a4058c |
#define GDK_PIXBUF_CORE_H
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
|
|
Packit |
a4058c |
#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#include <glib.h>
|
|
Packit |
a4058c |
#include <glib-object.h>
|
|
Packit |
a4058c |
#include <gio/gio.h>
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#include <gdk-pixbuf/gdk-pixbuf-macros.h>
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
G_BEGIN_DECLS
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* SECTION:gdk-pixbuf
|
|
Packit |
a4058c |
* @Short_description: Information that describes an image.
|
|
Packit |
a4058c |
* @Title: The GdkPixbuf Structure
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* The #GdkPixbuf structure contains
|
|
Packit |
a4058c |
* information that describes an image in memory.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* ## Image Data ## {#image-data}
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Image data in a pixbuf is stored in memory in uncompressed,
|
|
Packit |
a4058c |
* packed format. Rows in the image are stored top to bottom, and
|
|
Packit |
a4058c |
* in each row pixels are stored from left to right. There may be
|
|
Packit |
a4058c |
* padding at the end of a row. The "rowstride" value of a pixbuf,
|
|
Packit |
a4058c |
* as returned by gdk_pixbuf_get_rowstride(), indicates the number
|
|
Packit |
a4058c |
* of bytes between rows.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* ## put_pixel() Example ## {#put-pixel}
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* The following code illustrates a simple put_pixel()
|
|
Packit |
a4058c |
* function for RGB pixbufs with 8 bits per channel with an alpha
|
|
Packit |
a4058c |
* channel. It is not included in the gdk-pixbuf library for
|
|
Packit |
a4058c |
* performance reasons; rather than making several function calls
|
|
Packit |
a4058c |
* for each pixel, your own code can take shortcuts.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* |[
|
|
Packit |
a4058c |
* static void
|
|
Packit |
a4058c |
* put_pixel (GdkPixbuf *pixbuf, int x, int y, guchar red, guchar green, guchar blue, guchar alpha)
|
|
Packit |
a4058c |
* {
|
|
Packit |
a4058c |
* int width, height, rowstride, n_channels;
|
|
Packit |
a4058c |
* guchar *pixels, *p;
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
|
|
Packit |
a4058c |
* g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
|
|
Packit |
a4058c |
* g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
|
|
Packit |
a4058c |
* g_assert (n_channels == 4);
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* width = gdk_pixbuf_get_width (pixbuf);
|
|
Packit |
a4058c |
* height = gdk_pixbuf_get_height (pixbuf);
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* g_assert (x >= 0 && x < width);
|
|
Packit |
a4058c |
* g_assert (y >= 0 && y < height);
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
Packit |
a4058c |
* pixels = gdk_pixbuf_get_pixels (pixbuf);
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* p = pixels + y * rowstride + x * n_channels;
|
|
Packit |
a4058c |
* p[0] = red;
|
|
Packit |
a4058c |
* p[1] = green;
|
|
Packit |
a4058c |
* p[2] = blue;
|
|
Packit |
a4058c |
* p[3] = alpha;
|
|
Packit |
a4058c |
* }
|
|
Packit |
a4058c |
* ]|
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* This function will not work for pixbufs with images that are
|
|
Packit |
a4058c |
* other than 8 bits per sample or channel, but it will work for
|
|
Packit |
a4058c |
* most of the pixbufs that GTK+ uses.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* If you are doing memcpy() of raw pixbuf data, note that the last row
|
|
Packit |
a4058c |
* in the pixbuf may not be as wide as the full rowstride, but rather
|
|
Packit |
a4058c |
* just as wide as the pixel data needs to be. That is, it is unsafe to
|
|
Packit |
a4058c |
* do `memcpy (dest, pixels, rowstride * height)` to copy a whole pixbuf.
|
|
Packit |
a4058c |
* Use gdk_pixbuf_copy() instead, or compute the width in bytes of the
|
|
Packit |
a4058c |
* last row as `width * ((n_channels * bits_per_sample + 7) / 8)`.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkPixbufAlphaMode:
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ALPHA_BILEVEL: A bilevel clipping mask (black and white)
|
|
Packit |
a4058c |
* will be created and used to draw the image. Pixels below 0.5 opacity
|
|
Packit |
a4058c |
* will be considered fully transparent, and all others will be
|
|
Packit |
a4058c |
* considered fully opaque.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ALPHA_FULL: For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
|
|
Packit |
a4058c |
* In the future it will do full alpha compositing.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* These values can be passed to
|
|
Packit |
a4058c |
* gdk_pixbuf_xlib_render_to_drawable_alpha() to control how the alpha
|
|
Packit |
a4058c |
* channel of an image should be handled. This function can create a
|
|
Packit |
a4058c |
* bilevel clipping mask (black and white) and use it while painting
|
|
Packit |
a4058c |
* the image. In the future, when the X Window System gets an alpha
|
|
Packit |
a4058c |
* channel extension, it will be possible to do full alpha
|
|
Packit |
a4058c |
* compositing onto arbitrary drawables. For now both cases fall
|
|
Packit |
a4058c |
* back to a bilevel clipping mask.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
typedef enum
|
|
Packit |
a4058c |
{
|
|
Packit |
a4058c |
GDK_PIXBUF_ALPHA_BILEVEL,
|
|
Packit |
a4058c |
GDK_PIXBUF_ALPHA_FULL
|
|
Packit |
a4058c |
} GdkPixbufAlphaMode;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkColorspace:
|
|
Packit |
a4058c |
* @GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* This enumeration defines the color spaces that are supported by
|
|
Packit |
a4058c |
* the gdk-pixbuf library. Currently only RGB is supported.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
/* Note that these values are encoded in inline pixbufs
|
|
Packit |
a4058c |
* as ints, so don't reorder them
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
typedef enum {
|
|
Packit |
a4058c |
GDK_COLORSPACE_RGB
|
|
Packit |
a4058c |
} GdkColorspace;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* All of these are opaque structures */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkPixbuf:
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* This is the main structure in the gdk-pixbuf library. It is
|
|
Packit |
a4058c |
* used to represent images. It contains information about the
|
|
Packit |
a4058c |
* image's pixel data, its color space, bits per sample, width and
|
|
Packit |
a4058c |
* height, and the rowstride (the number of bytes between the start of
|
|
Packit |
a4058c |
* one row and the start of the next).
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
typedef struct _GdkPixbuf GdkPixbuf;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ())
|
|
Packit |
a4058c |
#define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf))
|
|
Packit |
a4058c |
#define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF))
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkPixbufDestroyNotify:
|
|
Packit |
a4058c |
* @pixels: (array) (element-type guint8): The pixel array of the pixbuf
|
|
Packit |
a4058c |
* that is being finalized.
|
|
Packit |
a4058c |
* @data: (closure): User closure data.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* A function of this type is responsible for freeing the pixel array
|
|
Packit |
a4058c |
* of a pixbuf. The gdk_pixbuf_new_from_data() function lets you
|
|
Packit |
a4058c |
* pass in a pre-allocated pixel array so that a pixbuf can be
|
|
Packit |
a4058c |
* created from it; in this case you will need to pass in a function
|
|
Packit |
a4058c |
* of #GdkPixbufDestroyNotify so that the pixel data can be freed
|
|
Packit |
a4058c |
* when the pixbuf is finalized.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GDK_PIXBUF_ERROR:
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Error domain used for pixbuf operations. Indicates that the error code
|
|
Packit |
a4058c |
* will be in the #GdkPixbufError enumeration. See #GError for
|
|
Packit |
a4058c |
* information on error domains and error codes.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
#define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkPixbufError:
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_CORRUPT_IMAGE: An image file was broken somehow.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY: Not enough memory.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_BAD_OPTION: A bad option was passed to a pixbuf save module.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_UNKNOWN_TYPE: Unknown image type.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION: Don't know how to perform the
|
|
Packit |
a4058c |
* given operation on the type of image at hand.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_FAILED: Generic failure code, something went wrong.
|
|
Packit |
a4058c |
* @GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION: Only part of the animation was loaded.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* An error code in the #GDK_PIXBUF_ERROR domain. Many gdk-pixbuf
|
|
Packit |
a4058c |
* operations can cause errors in this domain, or in the #G_FILE_ERROR
|
|
Packit |
a4058c |
* domain.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
typedef enum {
|
|
Packit |
a4058c |
/* image data hosed */
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
Packit |
a4058c |
/* no mem to load image */
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
Packit |
a4058c |
/* bad option passed to save routine */
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_BAD_OPTION,
|
|
Packit |
a4058c |
/* unsupported image type (sort of an ENOSYS) */
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
|
Packit |
a4058c |
/* unsupported operation (load, save) for image type */
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_FAILED,
|
|
Packit |
a4058c |
GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION
|
|
Packit |
a4058c |
} GdkPixbufError;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GQuark gdk_pixbuf_error_quark (void);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GType gdk_pixbuf_get_type (void) G_GNUC_CONST;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Reference counting */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
|
|
Packit |
a4058c |
GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_ref)
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_unref)
|
|
Packit |
a4058c |
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* GdkPixbuf accessors */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_26
|
|
Packit |
a4058c |
gsize gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_26
|
|
Packit |
a4058c |
guchar *gdk_pixbuf_get_pixels_with_length (const GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
guint *length);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_32
|
|
Packit |
a4058c |
const guint8* gdk_pixbuf_read_pixels (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_32
|
|
Packit |
a4058c |
GBytes * gdk_pixbuf_read_pixel_bytes (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Create a blank pixbuf with an optimal rowstride and a new buffer */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
|
|
Packit |
a4058c |
int width, int height);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_36
|
|
Packit |
a4058c |
gint gdk_pixbuf_calculate_rowstride (GdkColorspace colorspace,
|
|
Packit |
a4058c |
gboolean has_alpha,
|
|
Packit |
a4058c |
int bits_per_sample,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Copy a pixbuf */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Create a pixbuf which points to the pixels of another pixbuf */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
|
|
Packit |
a4058c |
int src_x,
|
|
Packit |
a4058c |
int src_y,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Simple loading */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifdef G_OS_WIN32
|
|
Packit |
a4058c |
/* In previous versions these _utf8 variants where exported and linked to
|
|
Packit |
a4058c |
* by default. Export them here for ABI (and gi API) compat.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file_utf8 (const char *filename,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file_at_size_utf8 (const char *filename,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_6
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file_at_scale_utf8 (const char *filename,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height,
|
|
Packit |
a4058c |
gboolean preserve_aspect_ratio,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file_at_size (const char *filename,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_6
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_file_at_scale (const char *filename,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height,
|
|
Packit |
a4058c |
gboolean preserve_aspect_ratio,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_26
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_resource (const char *resource_path,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_26
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_resource_at_scale (const char *resource_path,
|
|
Packit |
a4058c |
int width,
|
|
Packit |
a4058c |
int height,
|
|
Packit |
a4058c |
gboolean preserve_aspect_ratio,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
|
|
Packit |
a4058c |
GdkColorspace colorspace,
|
|
Packit |
a4058c |
gboolean has_alpha,
|
|
Packit |
a4058c |
int bits_per_sample,
|
|
Packit |
a4058c |
int width, int height,
|
|
Packit |
a4058c |
int rowstride,
|
|
Packit |
a4058c |
GdkPixbufDestroyNotify destroy_fn,
|
|
Packit |
a4058c |
gpointer destroy_fn_data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_32
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_bytes (GBytes *data,
|
|
Packit |
a4058c |
GdkColorspace colorspace,
|
|
Packit |
a4058c |
gboolean has_alpha,
|
|
Packit |
a4058c |
int bits_per_sample,
|
|
Packit |
a4058c |
int width, int height,
|
|
Packit |
a4058c |
int rowstride);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
|
|
Packit |
a4058c |
GDK_PIXBUF_DEPRECATED_IN_2_32
|
|
Packit |
a4058c |
GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length,
|
|
Packit |
a4058c |
const guint8 *data,
|
|
Packit |
a4058c |
gboolean copy_pixels,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Mutations */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_fill (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
guint32 pixel);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Saving */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifndef __GTK_DOC_IGNORE__
|
|
Packit |
a4058c |
#ifdef G_OS_WIN32
|
|
Packit |
a4058c |
/* DLL ABI stability hack. */
|
|
Packit |
a4058c |
#define gdk_pixbuf_save gdk_pixbuf_save_utf8
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const char *filename,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
GError **error,
|
|
Packit |
a4058c |
...) G_GNUC_NULL_TERMINATED;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const char *filename,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
char **option_keys,
|
|
Packit |
a4058c |
char **option_values,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#ifdef G_OS_WIN32
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_savev_utf8 (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const char *filename,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
char **option_keys,
|
|
Packit |
a4058c |
char **option_values,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
#endif
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Saving to a callback function */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/**
|
|
Packit |
a4058c |
* GdkPixbufSaveFunc:
|
|
Packit |
a4058c |
* @buf: (array length=count) (element-type guint8): bytes to be written.
|
|
Packit |
a4058c |
* @count: number of bytes in @buf.
|
|
Packit |
a4058c |
* @error: (out): A location to return an error.
|
|
Packit |
a4058c |
* @data: (closure): user data passed to gdk_pixbuf_save_to_callback().
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Specifies the type of the function passed to
|
|
Packit |
a4058c |
* gdk_pixbuf_save_to_callback(). It is called once for each block of
|
|
Packit |
a4058c |
* bytes that is "written" by gdk_pixbuf_save_to_callback(). If
|
|
Packit |
a4058c |
* successful it should return %TRUE. If an error occurs it should set
|
|
Packit |
a4058c |
* @error and return %FALSE, in which case gdk_pixbuf_save_to_callback()
|
|
Packit |
a4058c |
* will fail with the same error.
|
|
Packit |
a4058c |
*
|
|
Packit |
a4058c |
* Since: 2.4
|
|
Packit |
a4058c |
* Returns: %TRUE if successful, %FALSE (with @error set) if failed.
|
|
Packit |
a4058c |
*/
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf,
|
|
Packit |
a4058c |
gsize count,
|
|
Packit |
a4058c |
GError **error,
|
|
Packit |
a4058c |
gpointer data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GdkPixbufSaveFunc save_func,
|
|
Packit |
a4058c |
gpointer user_data,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
GError **error,
|
|
Packit |
a4058c |
...) G_GNUC_NULL_TERMINATED;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GdkPixbufSaveFunc save_func,
|
|
Packit |
a4058c |
gpointer user_data,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
char **option_keys,
|
|
Packit |
a4058c |
char **option_values,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Saving into a newly allocated char array */
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
gchar **buffer,
|
|
Packit |
a4058c |
gsize *buffer_size,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
GError **error,
|
|
Packit |
a4058c |
...) G_GNUC_NULL_TERMINATED;
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_4
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
gchar **buffer,
|
|
Packit |
a4058c |
gsize *buffer_size,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
char **option_keys,
|
|
Packit |
a4058c |
char **option_values,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_14
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_stream (GInputStream *stream,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_new_from_stream_async (GInputStream *stream,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GAsyncReadyCallback callback,
|
|
Packit |
a4058c |
gpointer user_data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_stream_finish (GAsyncResult *async_result,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_14
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
|
|
Packit |
a4058c |
gint width,
|
|
Packit |
a4058c |
gint height,
|
|
Packit |
a4058c |
gboolean preserve_aspect_ratio,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_new_from_stream_at_scale_async (GInputStream *stream,
|
|
Packit |
a4058c |
gint width,
|
|
Packit |
a4058c |
gint height,
|
|
Packit |
a4058c |
gboolean preserve_aspect_ratio,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GAsyncReadyCallback callback,
|
|
Packit |
a4058c |
gpointer user_data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_14
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GOutputStream *stream,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GError **error,
|
|
Packit |
a4058c |
...);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_save_to_stream_async (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GOutputStream *stream,
|
|
Packit |
a4058c |
const gchar *type,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GAsyncReadyCallback callback,
|
|
Packit |
a4058c |
gpointer user_data,
|
|
Packit |
a4058c |
...);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_stream_finish (GAsyncResult *async_result,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_36
|
|
Packit |
a4058c |
void gdk_pixbuf_save_to_streamv_async (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GOutputStream *stream,
|
|
Packit |
a4058c |
const gchar *type,
|
|
Packit |
a4058c |
gchar **option_keys,
|
|
Packit |
a4058c |
gchar **option_values,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GAsyncReadyCallback callback,
|
|
Packit |
a4058c |
gpointer user_data);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_36
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_save_to_streamv (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
GOutputStream *stream,
|
|
Packit |
a4058c |
const char *type,
|
|
Packit |
a4058c |
char **option_keys,
|
|
Packit |
a4058c |
char **option_values,
|
|
Packit |
a4058c |
GCancellable *cancellable,
|
|
Packit |
a4058c |
GError **error);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Adding an alpha channel */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
|
|
Packit |
a4058c |
guchar r, guchar g, guchar b);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Copy an area of a pixbuf onto another one */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
|
Packit |
a4058c |
int src_x, int src_y,
|
|
Packit |
a4058c |
int width, int height,
|
|
Packit |
a4058c |
GdkPixbuf *dest_pixbuf,
|
|
Packit |
a4058c |
int dest_x, int dest_y);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Brighten/darken and optionally make it pixelated-looking */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src,
|
|
Packit |
a4058c |
GdkPixbuf *dest,
|
|
Packit |
a4058c |
gfloat saturation,
|
|
Packit |
a4058c |
gboolean pixelate);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* Transform an image to agree with its embedded orientation option / tag */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_12
|
|
Packit |
a4058c |
GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
/* key/value pairs that can be attached by the pixbuf loader */
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const gchar *key,
|
|
Packit |
a4058c |
const gchar *value);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_ALL
|
|
Packit |
a4058c |
const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const gchar *key);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_36
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_remove_option (GdkPixbuf *pixbuf,
|
|
Packit |
a4058c |
const gchar *key);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_32
|
|
Packit |
a4058c |
GHashTable * gdk_pixbuf_get_options (GdkPixbuf *pixbuf);
|
|
Packit |
a4058c |
GDK_PIXBUF_AVAILABLE_IN_2_36
|
|
Packit |
a4058c |
gboolean gdk_pixbuf_copy_options (GdkPixbuf *src_pixbuf,
|
|
Packit |
a4058c |
GdkPixbuf *dest_pixbuf);
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
G_END_DECLS
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
|
|
Packit |
a4058c |
#endif /* GDK_PIXBUF_CORE_H */
|