1999-10-20 21:20:49 +00:00
|
|
|
|
/* GdkPixbuf library - Main header file
|
1999-10-18 19:29:45 +00:00
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mark Crichton <crichton@gimp.org>
|
|
|
|
|
* Miguel de Icaza <miguel@gnu.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* Havoc Pennington <hp@redhat.com>
|
1999-10-18 19:29:45 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef GDK_PIXBUF_H
|
|
|
|
|
#define GDK_PIXBUF_H
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-06-21 20:47:22 +00:00
|
|
|
|
#include <glib.h>
|
2000-01-10 19:17:42 +00:00
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf-features.h>
|
2000-06-22 15:36:12 +00:00
|
|
|
|
#include <gobject/gobject.h>
|
1999-09-22 22:30:51 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Color spaces; right now only RGB is supported */
|
2000-01-02 03:59:22 +00:00
|
|
|
|
typedef enum {
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GDK_COLORSPACE_RGB
|
|
|
|
|
} GdkColorspace;
|
1999-12-10 23:15:20 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* All of these are opaque structures */
|
|
|
|
|
typedef struct _GdkPixbuf GdkPixbuf;
|
|
|
|
|
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
|
2000-06-22 15:36:12 +00:00
|
|
|
|
typedef struct _GdkPixbufFrame GdkPixbufFrame;
|
|
|
|
|
|
|
|
|
|
#define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ())
|
|
|
|
|
#define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf))
|
|
|
|
|
#define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF))
|
|
|
|
|
|
|
|
|
|
#define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ())
|
|
|
|
|
#define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation))
|
|
|
|
|
#define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION))
|
|
|
|
|
|
2000-04-03 08:59:43 +00:00
|
|
|
|
|
2000-04-13 01:18:41 +00:00
|
|
|
|
/* Handler that must free the pixel array */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
|
1999-12-10 23:15:20 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
GType gdk_pixbuf_get_type (void);
|
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
/* Reference counting */
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
2000-04-13 01:18:41 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
|
|
|
|
|
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* GdkPixbuf accessors */
|
|
|
|
|
|
|
|
|
|
GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
|
|
|
|
|
int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
|
|
|
|
|
gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
|
|
|
|
|
int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
|
|
|
|
|
guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
|
|
|
|
|
int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
|
|
|
|
|
int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
|
|
|
|
|
int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
|
|
|
|
|
|
|
|
|
|
|
1999-07-16 20:35:21 +00:00
|
|
|
|
|
1999-10-27 23:36:44 +00:00
|
|
|
|
/* Create a blank pixbuf with an optimal rowstride and a new buffer */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
|
1999-10-27 23:36:44 +00:00
|
|
|
|
int width, int height);
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Copy a pixbuf */
|
|
|
|
|
|
|
|
|
|
GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
|
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
/* Simple loading */
|
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
|
|
|
|
|
|
2000-02-14 20:06:23 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkColorspace colorspace,
|
2000-01-02 03:59:22 +00:00
|
|
|
|
gboolean has_alpha,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
int bits_per_sample,
|
2000-01-02 03:59:22 +00:00
|
|
|
|
int width, int height,
|
|
|
|
|
int rowstride,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkPixbufDestroyNotify destroy_fn,
|
|
|
|
|
gpointer destroy_fn_data);
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
|
1999-12-02 17:45:47 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
/* Adding an alpha channel */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
|
1999-12-02 17:45:47 +00:00
|
|
|
|
guchar r, guchar g, guchar b);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Copy an area of a pixbuf onto another one */
|
|
|
|
|
void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
|
|
|
|
int src_x, int src_y,
|
|
|
|
|
int width, int height,
|
|
|
|
|
GdkPixbuf *dest_pixbuf,
|
|
|
|
|
int dest_x, int dest_y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-10-27 23:36:44 +00:00
|
|
|
|
/* Rendering to a drawable */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
|
2000-01-13 07:24:49 +00:00
|
|
|
|
|
2000-01-05 21:33:58 +00:00
|
|
|
|
/* Scaling */
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Interpolation modes */
|
|
|
|
|
typedef enum {
|
|
|
|
|
GDK_INTERP_NEAREST,
|
|
|
|
|
GDK_INTERP_TILES,
|
|
|
|
|
GDK_INTERP_BILINEAR,
|
|
|
|
|
GDK_INTERP_HYPER
|
|
|
|
|
} GdkInterpType;
|
|
|
|
|
|
2000-02-03 23:36:14 +00:00
|
|
|
|
void gdk_pixbuf_scale (const GdkPixbuf *src,
|
|
|
|
|
GdkPixbuf *dest,
|
|
|
|
|
int dest_x,
|
|
|
|
|
int dest_y,
|
|
|
|
|
int dest_width,
|
|
|
|
|
int dest_height,
|
|
|
|
|
double offset_x,
|
|
|
|
|
double offset_y,
|
|
|
|
|
double scale_x,
|
|
|
|
|
double scale_y,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkInterpType interp_type);
|
2000-02-03 23:36:14 +00:00
|
|
|
|
void gdk_pixbuf_composite (const GdkPixbuf *src,
|
|
|
|
|
GdkPixbuf *dest,
|
|
|
|
|
int dest_x,
|
|
|
|
|
int dest_y,
|
|
|
|
|
int dest_width,
|
|
|
|
|
int dest_height,
|
|
|
|
|
double offset_x,
|
|
|
|
|
double offset_y,
|
|
|
|
|
double scale_x,
|
|
|
|
|
double scale_y,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkInterpType interp_type,
|
2000-02-03 23:36:14 +00:00
|
|
|
|
int overall_alpha);
|
|
|
|
|
void gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
|
|
|
|
GdkPixbuf *dest,
|
|
|
|
|
int dest_x,
|
|
|
|
|
int dest_y,
|
|
|
|
|
int dest_width,
|
|
|
|
|
int dest_height,
|
|
|
|
|
double offset_x,
|
|
|
|
|
double offset_y,
|
|
|
|
|
double scale_x,
|
|
|
|
|
double scale_y,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkInterpType interp_type,
|
2000-02-03 23:36:14 +00:00
|
|
|
|
int overall_alpha,
|
|
|
|
|
int check_x,
|
|
|
|
|
int check_y,
|
|
|
|
|
int check_size,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
guint32 color1,
|
|
|
|
|
guint32 color2);
|
2000-02-03 23:36:14 +00:00
|
|
|
|
|
|
|
|
|
GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
|
|
|
|
int dest_width,
|
|
|
|
|
int dest_height,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkInterpType interp_type);
|
|
|
|
|
|
2000-02-03 23:36:14 +00:00
|
|
|
|
GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
|
|
|
|
|
int dest_width,
|
|
|
|
|
int dest_height,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkInterpType interp_type,
|
2000-02-03 23:36:14 +00:00
|
|
|
|
int overall_alpha,
|
|
|
|
|
int check_size,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
guint32 color1,
|
|
|
|
|
guint32 color2);
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 21:33:58 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
/* Animation support */
|
1999-12-10 23:15:20 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* GIF-like animation overlay modes for frames */
|
|
|
|
|
typedef enum {
|
|
|
|
|
GDK_PIXBUF_FRAME_RETAIN,
|
|
|
|
|
GDK_PIXBUF_FRAME_DISPOSE,
|
|
|
|
|
GDK_PIXBUF_FRAME_REVERT
|
|
|
|
|
} GdkPixbufFrameAction;
|
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
GType gdk_pixbuf_animation_get_type (void);
|
|
|
|
|
|
2000-04-04 05:17:49 +00:00
|
|
|
|
GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
|
1999-12-10 23:15:20 +00:00
|
|
|
|
|
2000-04-04 05:17:49 +00:00
|
|
|
|
GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
|
|
|
|
|
void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
|
|
|
|
|
|
|
|
|
|
int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
|
|
|
|
|
int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
|
|
|
|
|
GList *gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation);
|
|
|
|
|
int gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation);
|
1999-12-11 00:21:27 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Frame accessors */
|
|
|
|
|
|
|
|
|
|
GdkPixbuf *gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame);
|
|
|
|
|
int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame);
|
|
|
|
|
int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame);
|
|
|
|
|
int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame);
|
|
|
|
|
GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame);
|
|
|
|
|
|
|
|
|
|
|
2000-01-10 19:17:42 +00:00
|
|
|
|
/* General (presently empty) initialization hooks, primarily for gnome-libs */
|
2000-02-03 23:36:14 +00:00
|
|
|
|
void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
|
|
|
|
|
void gdk_pixbuf_postinit (gpointer app, gpointer modinfo);
|
2000-06-22 15:36:12 +00:00
|
|
|
|
/* A more user-friendly init function */
|
|
|
|
|
void gdk_pixbuf_init (void);
|
2000-01-10 19:17:42 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
1999-10-08 23:01:05 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
1999-10-08 23:01:05 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
#endif
|