Reindented to use the GNOME Indentation.

1999-10-18  Federico Mena Quintero  <federico@redhat.com>

	* src/*: Reindented to use the GNOME Indentation.
This commit is contained in:
Federico Mena Quintero
1999-10-18 19:29:45 +00:00
committed by Arturo Espinosa
parent 3b9835b5bb
commit 74268afdeb
16 changed files with 1139 additions and 1128 deletions

View File

@ -175,20 +175,19 @@ static const unsigned char default_image[] = {
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
}; };
static void static void
quit_func (GtkWidget *widget, gpointer dummy) quit_func (GtkWidget *widget, gpointer dummy)
{ {
gtk_main_quit (); gtk_main_quit ();
} }
static void
expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data) expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf"); pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
if (pixbuf->art_pixbuf->has_alpha) { if (pixbuf->art_pixbuf->has_alpha) {
gdk_draw_rgb_32_image (drawing_area->window, gdk_draw_rgb_32_image (drawing_area->window,
@ -215,11 +214,12 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
} }
} }
static void
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data) config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
{ {
GdkPixBuf *pixbuf, *spb; GdkPixbuf *pixbuf, *spb;
pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf"); pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
g_print("X:%d Y:%d\n", event->width, event->height); g_print("X:%d Y:%d\n", event->width, event->height);
@ -229,8 +229,8 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
} }
void static void
new_testrgb_window (GdkPixBuf *pixbuf) new_testrgb_window (GdkPixbuf *pixbuf)
{ {
GtkWidget *window; GtkWidget *window;
GtkWidget *vbox; GtkWidget *vbox;
@ -286,7 +286,7 @@ main (int argc, char **argv)
int i; int i;
int found_valid = FALSE; int found_valid = FALSE;
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
@ -298,24 +298,20 @@ main (int argc, char **argv)
gtk_widget_set_default_visual (gdk_rgb_get_visual ()); gtk_widget_set_default_visual (gdk_rgb_get_visual ());
i = 1; i = 1;
if (argc == 1) if (argc == 1) {
{
pixbuf = gdk_pixbuf_load_image_from_rgb_d(default_image, pixbuf = gdk_pixbuf_load_image_from_rgb_d(default_image,
DEFAULT_WIDTH, DEFAULT_WIDTH,
DEFAULT_HEIGHT); DEFAULT_HEIGHT);
if (pixbuf) if (pixbuf) {
{
new_testrgb_window (pixbuf); new_testrgb_window (pixbuf);
found_valid = TRUE; found_valid = TRUE;
} }
} else { } else {
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++) {
{
pixbuf = gdk_pixbuf_load_image (argv[i]); pixbuf = gdk_pixbuf_load_image (argv[i]);
pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0); pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
if (pixbuf) if (pixbuf) {
{
new_testrgb_window (pixbuf); new_testrgb_window (pixbuf);
found_valid = TRUE; found_valid = TRUE;
} }

View File

@ -1,3 +1,7 @@
1999-10-18 Federico Mena Quintero <federico@redhat.com>
* src/*: Reindented to use the GNOME Indentation.
1999-10-18 Havoc Pennington <hp@pobox.com> 1999-10-18 Havoc Pennington <hp@pobox.com>
* configure.in: Use AM_PATH_GLIB instead of glib-config directly * configure.in: Use AM_PATH_GLIB instead of glib-config directly

View File

@ -4,12 +4,12 @@
/* The optional cache interface */ /* The optional cache interface */
typedef struct { typedef struct {
int dummy; int dummy;
} GdkPixBufCache; } GdkPixbufCache;
GdkPixBufCache *gdk_pixbuf_cache_new (long image_cache_limit, GdkPixbufCache *gdk_pixbuf_cache_new (long image_cache_limit,
long pixmap_bitmap_cache_limit); long pixmap_bitmap_cache_limit);
void gdk_pixbuf_cache_destroy (GdkPixBufCache *cache); void gdk_pixbuf_cache_destroy (GdkPixbufCache *cache);
GdkPixBuf *gdk_pixbuf_cache_load_image (GdkPixBufCache *cache, GdkPixbuf *gdk_pixbuf_cache_load_image (GdkPixbufCache *cache,
const char *file); const char *file);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* gdk-pixbuf-data.c: Code to load images into GdkPixBufs from constant data * gdk-pixbuf-data.c: Code to load images into GdkPixbufs from constant data
* *
* Author: * Author:
* Michael Fulbright (drmike@redhat.com) * Michael Fulbright (drmike@redhat.com)
@ -15,10 +15,10 @@
/* This function does all the work. */ /* This function does all the work. */
static GdkPixBuf * static GdkPixbuf *
_pixbuf_create_from_rgb_d(unsigned char *data, int w, int h) _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
art_u8 *pixels; art_u8 *pixels;
@ -40,12 +40,10 @@ _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height)
int rgb_width, int rgb_height)
{ {
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
return _pixbuf_create_from_rgb_d(data, rgb_width, rgb_height); return _pixbuf_create_from_rgb_d(data, rgb_width, rgb_height);
} }

View File

@ -4,11 +4,7 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk-pixbuf.h> #include <gdk-pixbuf.h>
GdkPixBuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window, GdkPixbuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
gint x, gint y, GdkPixbuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
gint width, gint height);
GdkPixBuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window,
gint x, gint y,
gint width, gint height);
#endif /* _GDK_PIXBUF_DRAWABLE_H_ */ #endif /* _GDK_PIXBUF_DRAWABLE_H_ */

View File

@ -1,5 +1,5 @@
/* /*
* gdk-pixbuf-io.c: Code to load images into GdkPixBufs * gdk-pixbuf-io.c: Code to load images into GdkPixbufs
* *
* Author: * Author:
* Miguel de Icaza (miguel@gnu.org) * Miguel de Icaza (miguel@gnu.org)
@ -122,8 +122,8 @@ static struct {
char *module_name; char *module_name;
gboolean (*format_check)(unsigned char *buffer, int size); gboolean (*format_check)(unsigned char *buffer, int size);
GModule *module; GModule *module;
GdkPixBuf *(*load)(FILE *f); GdkPixbuf *(*load)(FILE *f);
int (*save)(GdkPixBuf *p, FILE *f, ...); int (*save)(GdkPixbuf *p, FILE *f, ...);
} file_formats [] = { } file_formats [] = {
{ "png", pixbuf_check_png, NULL, NULL, NULL }, { "png", pixbuf_check_png, NULL, NULL, NULL },
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL }, { "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL },
@ -163,10 +163,10 @@ image_handler_load (int idx)
file_formats [idx].save = save_sym; file_formats [idx].save = save_sym;
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_load_image (const char *file) gdk_pixbuf_load_image (const char *file)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
gint n, i; gint n, i;
FILE *f; FILE *f;
char buffer [128]; char buffer [128];

View File

@ -1,14 +1,31 @@
/* /* GdkPixbuf library
* gdk-pixbuf.c: Resource management.
* *
* Authors: * Copyright (C) 1999 The Free Software Foundation
* Miguel de Icaza (miguel@gnu.org) *
* Mark Crichton (crichton@gimp.org) * Authors: Mark Crichton <crichton@gimp.org>
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
* Carsten Haitzler <raster@rasterman.com>
*
* 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.
*/ */
#include <config.h> #include <config.h>
#include <glib.h>
#include <math.h> #include <math.h>
#include <glib.h>
#include <libart_lgpl/art_misc.h> #include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_affine.h> #include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_pixbuf.h> #include <libart_lgpl/art_pixbuf.h>
@ -16,25 +33,25 @@
#include <libart_lgpl/art_alphagamma.h> #include <libart_lgpl/art_alphagamma.h>
#include "gdk-pixbuf.h" #include "gdk-pixbuf.h"
void void
gdk_pixbuf_destroy (GdkPixBuf *pixbuf) gdk_pixbuf_destroy (GdkPixbuf *pixbuf)
{ {
art_pixbuf_free (pixbuf->art_pixbuf); art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = NULL; pixbuf->art_pixbuf = NULL;
g_free (pixbuf); g_free (pixbuf);
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_new (ArtPixBuf *art_pixbuf, gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn)
GdkPixBufUnrefFunc *unref_fn)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
if (!art_pixbuf) if (!art_pixbuf)
return NULL; return NULL;
pixbuf = g_new (GdkPixBuf, 1); pixbuf = g_new (GdkPixbuf, 1);
pixbuf->ref_count = 1; pixbuf->ref_count = 1;
pixbuf->unref_fn = unref_fn; pixbuf->unref_fn = unref_fn;
pixbuf->art_pixbuf = art_pixbuf; pixbuf->art_pixbuf = art_pixbuf;
@ -43,7 +60,7 @@ gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
} }
void void
gdk_pixbuf_ref (GdkPixBuf *pixbuf) gdk_pixbuf_ref (GdkPixbuf *pixbuf)
{ {
g_return_if_fail (pixbuf != NULL); g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0); g_return_if_fail (pixbuf->ref_count > 0);
@ -52,7 +69,7 @@ gdk_pixbuf_ref (GdkPixBuf *pixbuf)
} }
void void
gdk_pixbuf_unref (GdkPixBuf *pixbuf) gdk_pixbuf_unref (GdkPixbuf *pixbuf)
{ {
g_return_if_fail (pixbuf != NULL); g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0); g_return_if_fail (pixbuf->ref_count > 0);
@ -63,15 +80,15 @@ gdk_pixbuf_unref (GdkPixBuf *pixbuf)
gdk_pixbuf_destroy (pixbuf); gdk_pixbuf_destroy (pixbuf);
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h) gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
{ {
art_u8 *pixels; art_u8 *pixels;
gint rowstride; gint rowstride;
double affine[6]; double affine[6];
ArtAlphaGamma *alphagamma; ArtAlphaGamma *alphagamma;
ArtPixBuf *art_pixbuf = NULL; ArtPixBuf *art_pixbuf = NULL;
GdkPixBuf *copy = NULL; GdkPixbuf *copy = NULL;
alphagamma = NULL; alphagamma = NULL;
@ -102,10 +119,10 @@ gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h)
return copy; return copy;
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf) gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf)
{ {
GdkPixBuf *copy = g_new (GdkPixBuf, 1); GdkPixbuf *copy = g_new (GdkPixbuf, 1);
copy->ref_count = 1; copy->ref_count = 1;
copy->unref_fn = pixbuf->unref_fn; copy->unref_fn = pixbuf->unref_fn;
@ -114,8 +131,8 @@ gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
return copy; return copy;
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle) gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
{ {
art_u8 *pixels; art_u8 *pixels;
gint rowstride, w, h; gint rowstride, w, h;

View File

@ -1,34 +1,72 @@
#ifndef _GDK_PIXBUF_H_ /* GdkPixbuf library
#define _GDK_PIXBUF_H_ *
* 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>
* Carsten Haitzler <raster@rasterman.com>
*
* 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
#include <libart_lgpl/art_misc.h> #include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_pixbuf.h> #include <libart_lgpl/art_pixbuf.h>
#include <glib.h> #include <glib.h>
typedef struct _GdkPixBuf GdkPixBuf; #ifdef __cplusplus
typedef void (*GdkPixBufUnrefFunc) (GdkPixBuf *pixbuf); extern "C" {
#endif
struct _GdkPixBuf
{
typedef struct _GdkPixbuf GdkPixbuf;
typedef void (* GdkPixbufUnrefFunc) (GdkPixbuf *pixbuf);
struct _GdkPixbuf {
int ref_count; int ref_count;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
GdkPixBufUnrefFunc *unref_fn; GdkPixbufUnrefFunc *unref_fn;
}; };
GdkPixBuf *gdk_pixbuf_load_image (const char *file);
GdkPixbuf *gdk_pixbuf_load_image (const char *file);
void gdk_pixbuf_save_image (const char *format_id, const char *file, ...); void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
GdkPixBuf *gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
GdkPixBufUnrefFunc *unref_fn);
void gdk_pixbuf_ref (GdkPixBuf *pixbuf);
void gdk_pixbuf_unref (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h);
GdkPixBuf *gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle);
void gdk_pixbuf_destroy (GdkPixBuf *pixbuf); GdkPixbuf *gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn);
GdkPixBuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
int rgb_width, int rgb_height); void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h);
GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle);
#endif /* _GDK_PIXBUF_H_ */ void gdk_pixbuf_destroy (GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +1,5 @@
/* /*
* io-bmp.c: GdkPixBuf I/O for BMP files. * io-bmp.c: GdkPixbuf I/O for BMP files.
* *
* Copyright (C) 1999 Mark Crichton * Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org> * Author: Mark Crichton <crichton@gimp.org>
@ -30,12 +30,12 @@
/* Loosely based off the BMP loader from The GIMP, hence it's complexity */ /* Loosely based off the BMP loader from The GIMP, hence it's complexity */
/* Shared library entry point */ /* Shared library entry point */
GdkPixBuf *image_load(FILE * f) GdkPixbuf *image_load(FILE * f)
{ {
art_u8 *pixels; art_u8 *pixels;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
/* Ok, now stuff the GdkPixBuf with goodies */ /* Ok, now stuff the GdkPixbuf with goodies */
if (is_trans) if (is_trans)
art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4)); art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));

View File

@ -1,5 +1,5 @@
/* /*
* io-gif.c: GdkPixBuf I/O for GIF files. * io-gif.c: GdkPixbuf I/O for GIF files.
* ...second verse, same as the first... * ...second verse, same as the first...
* *
* Copyright (C) 1999 Mark Crichton * Copyright (C) 1999 Mark Crichton
@ -29,7 +29,8 @@
#include <gif_lib.h> #include <gif_lib.h>
/* Shared library entry point */ /* Shared library entry point */
GdkPixBuf *image_load(FILE * f) GdkPixbuf *
image_load(FILE *f)
{ {
gint fn, is_trans = FALSE; gint fn, is_trans = FALSE;
gint done = 0; gint done = 0;
@ -45,7 +46,7 @@ GdkPixBuf *image_load(FILE * f)
int intjump[] = int intjump[] =
{8, 8, 4, 2}; {8, 8, 4, 2};
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
g_return_val_if_fail(f != NULL, NULL); g_return_val_if_fail(f != NULL, NULL);

View File

@ -1,5 +1,5 @@
/* /*
io-jpeg.c: GdkPixBuf loader for jpeg files. io-jpeg.c: GdkPixbuf loader for jpeg files.
Based on io-jpeg from gdk_imlib, but not much. Based on io-jpeg from gdk_imlib, but not much.
@ -19,8 +19,7 @@
#include <jpeglib.h> #include <jpeglib.h>
/* error handler data */ /* error handler data */
struct iojpeg_JPEG_error_mgr struct iojpeg_JPEG_error_mgr {
{
struct jpeg_error_mgr pub; struct jpeg_error_mgr pub;
sigjmp_buf setjmp_buffer; sigjmp_buf setjmp_buffer;
}; };
@ -39,7 +38,8 @@ g_JPEGFatalErrorHandler(j_common_ptr cinfo)
return; return;
} }
GdkPixBuf *image_load(FILE *f) GdkPixbuf *
image_load(FILE *f)
{ {
int w,h,i,j; int w,h,i,j;
art_u8 *pixels=NULL, *dptr; art_u8 *pixels=NULL, *dptr;
@ -49,7 +49,7 @@ GdkPixBuf *image_load(FILE *f)
**lptr; **lptr;
struct jpeg_decompress_struct cinfo; struct jpeg_decompress_struct cinfo;
struct iojpeg_JPEG_error_mgr jerr; struct iojpeg_JPEG_error_mgr jerr;
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
/* setup error handler */ /* setup error handler */
cinfo.err = jpeg_std_error(&(jerr.pub)); cinfo.err = jpeg_std_error(&(jerr.pub));

View File

@ -1,5 +1,5 @@
/* /*
* io-png.c: GdkPixBuf I/O for PNG files. * io-png.c: GdkPixbuf I/O for PNG files.
* Copyright (C) 1999 Mark Crichton * Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org> * Author: Mark Crichton <crichton@gimp.org>
* *
@ -26,7 +26,8 @@
#include <png.h> #include <png.h>
/* Shared library entry point */ /* Shared library entry point */
GdkPixBuf *image_load(FILE * f) GdkPixbuf *
image_load (FILE *f)
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr, end_info; png_infop info_ptr, end_info;
@ -34,7 +35,7 @@ GdkPixBuf *image_load(FILE * f)
png_uint_32 w, h, x, y; png_uint_32 w, h, x, y;
png_bytepp rows; png_bytepp rows;
art_u8 *pixels, *temp, *rowdata; art_u8 *pixels, *temp, *rowdata;
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
g_return_val_if_fail (f != NULL, NULL); g_return_val_if_fail (f != NULL, NULL);
@ -162,7 +163,8 @@ GdkPixBuf *image_load(FILE * f)
return pixbuf; return pixbuf;
} }
int image_save(GdkPixBuf *pixbuf, FILE *file) int
image_save (GdkPixbuf *pixbuf, FILE *file)
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;

View File

@ -1,5 +1,5 @@
/* /*
* io-tiff.c: GdkPixBuf I/O for TIFF files. * io-tiff.c: GdkPixbuf I/O for TIFF files.
* Copyright (C) 1999 Mark Crichton * Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org> * Author: Mark Crichton <crichton@gimp.org>
* *
@ -30,9 +30,10 @@
#include "gdk-pixbuf.h" #include "gdk-pixbuf.h"
/*#include "gdk-pixbuf-io.h" */ /*#include "gdk-pixbuf-io.h" */
GdkPixBuf *image_load(FILE * f) GdkPixbuf *
image_load (FILE *f)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
TIFF *tiff; TIFF *tiff;
art_u8 *pixels, *tmppix; art_u8 *pixels, *tmppix;
gint w, h, x, y, num_pixs, fd; gint w, h, x, y, num_pixs, fd;

View File

@ -1,5 +1,5 @@
/* /*
* io-xpm.c: GdkPixBuf I/O for XPM files. * io-xpm.c: GdkPixbuf I/O for XPM files.
* Copyright (C) 1999 Mark Crichton * Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org> * Author: Mark Crichton <crichton@gimp.org>
* *
@ -61,9 +61,7 @@ struct mem_handle {
} mem_handle; } mem_handle;
static gint static gint
xpm_seek_string(FILE * infile, xpm_seek_string(FILE *infile, const gchar *str, gint skip_comments)
const gchar * str,
gint skip_comments)
{ {
char instr[1024]; char instr[1024];
@ -83,8 +81,7 @@ static gint
} }
static gint static gint
xpm_seek_char(FILE * infile, xpm_seek_char(FILE *infile, gchar c)
gchar c)
{ {
gint b, oldb; gint b, oldb;
@ -110,9 +107,7 @@ static gint
} }
static gint static gint
xpm_read_string(FILE * infile, xpm_read_string(FILE *infile, gchar **buffer, guint *buffer_size)
gchar ** buffer,
guint * buffer_size)
{ {
gint c; gint c;
guint cnt = 0, bufsiz, ret = FALSE; guint cnt = 0, bufsiz, ret = FALSE;
@ -124,9 +119,10 @@ static gint
bufsiz = 10 * sizeof(gchar); bufsiz = 10 * sizeof(gchar);
buf = g_new(gchar, bufsiz); buf = g_new(gchar, bufsiz);
} }
do
do {
c = getc(infile); c = getc(infile);
while (c != EOF && c != '"'); } while (c != EOF && c != '"');
if (c != '"') if (c != '"')
goto out; goto out;
@ -247,7 +243,6 @@ static gchar *
return retcol; return retcol;
} }
/* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */ /* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */
static gchar * static gchar *
@ -293,9 +288,8 @@ static gchar *
/* This function does all the work. */ /* This function does all the work. */
static GdkPixBuf * static GdkPixbuf *
_pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle), _pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle), gpointer handle)
gpointer handle)
{ {
gint w, h, n_col, cpp; gint w, h, n_col, cpp;
gint cnt, xcnt, ycnt, wbytes, n, ns; gint cnt, xcnt, ycnt, wbytes, n, ns;
@ -305,7 +299,7 @@ static GdkPixBuf *
GHashTable *color_hash; GHashTable *color_hash;
_XPMColor *colors, *color, *fallbackcolor; _XPMColor *colors, *color, *fallbackcolor;
art_u8 *pixels, *pixtmp; art_u8 *pixels, *pixtmp;
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf; ArtPixBuf *art_pixbuf;
buffer = (*get_buf) (op_header, handle); buffer = (*get_buf) (op_header, handle);
@ -402,7 +396,7 @@ static GdkPixBuf *
g_free(colors); g_free(colors);
g_free(name_buf); g_free(name_buf);
/* Ok, now stuff the GdkPixBuf with goodies */ /* Ok, now stuff the GdkPixbuf with goodies */
if (is_trans) if (is_trans)
art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4)); art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
@ -418,9 +412,10 @@ static GdkPixBuf *
} }
/* Shared library entry point for file loading */ /* Shared library entry point for file loading */
GdkPixBuf *image_load(FILE * f) GdkPixbuf *
image_load (FILE *f)
{ {
GdkPixBuf *pixbuf; GdkPixbuf *pixbuf;
struct file_handle h; struct file_handle h;
g_return_val_if_fail(f != NULL, NULL); g_return_val_if_fail(f != NULL, NULL);

View File

@ -1,18 +0,0 @@
#ifndef _GDK_PIXBUF_H_
#define _GDK_PIXBUF_H_
#include <libart_lgpl/art_pixbuf.h>
typedef struct {
int ref_count;
ArtPixBuf *pixbuf;
void (*unref_func)(void *gdkpixbuf);
} GdkPixBuf;
GdkPixBuf *gdk_pixbuf_load_image (const char *file);
void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
void gdk_pixbuf_ref (GdkPixBuf *pixbuf);
void gdk_pixbuf_unref (GdkPixBuf *pixbuf);
GdkPixBuf gdk_pixbuf_duplicate (GdkPixBuf *pixbuf);
#endif /* _GDK_PIXBUF_H_ */

View File

@ -1,5 +1,5 @@
/* /*
* Creates an GdkPixBuf from a Drawable * Creates an GdkPixbuf from a Drawable
* *
* Author: * Author:
* Cody Russell <bratsche@dfw.net> * Cody Russell <bratsche@dfw.net>
@ -14,10 +14,8 @@
/* private function */ /* private function */
static GdkPixBuf * static GdkPixbuf *
gdk_pixbuf_from_drawable_core (GdkWindow *window, gdk_pixbuf_from_drawable_core (GdkWindow *window, gint x, gint y, gint width, gint height,
gint x, gint y,
gint width, gint height,
gint with_alpha) gint with_alpha)
{ {
GdkImage *image; GdkImage *image;
@ -41,24 +39,18 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
&window_width, &window_height, NULL); &window_width, &window_height, NULL);
gdk_window_get_origin(window, &window_x, &window_y); gdk_window_get_origin(window, &window_x, &window_y);
if(window_x < 0) if(window_x < 0) {
{
x = ABS(window_x); x = ABS(window_x);
width = window_width - x; width = window_width - x;
} } else {
else
{
width = CLAMP(window_x + window_width, window_x, width = CLAMP(window_x + window_width, window_x,
screen_width) - window_x; screen_width) - window_x;
} }
if(window_y < 0) if(window_y < 0) {
{
y = ABS(window_y); y = ABS(window_y);
height = window_height - y; height = window_height - y;
} } else {
else
{
height = CLAMP(window_y + window_height, window_y, height = CLAMP(window_y + window_height, window_y,
screen_height) - window_y; screen_height) - window_y;
} }
@ -72,8 +64,7 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
buff = art_alloc (rowstride * height); buff = art_alloc (rowstride * height);
pixels = buff; pixels = buff;
switch (image->depth) switch (image->depth) {
{
case 0: case 0:
case 1: case 1:
case 2: case 2:
@ -83,10 +74,8 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
case 6: case 6:
case 7: case 7:
case 8: case 8:
for (yy = 0; yy < height; yy++) for (yy = 0; yy < height; yy++) {
{ for (xx = 0; xx < width; xx++) {
for (xx = 0; xx < width; xx++)
{
pixel = gdk_image_get_pixel (image, xx, yy); pixel = gdk_image_get_pixel (image, xx, yy);
pixels[0] = colormap->colors[pixel].red; pixels[0] = colormap->colors[pixel].red;
pixels[1] = colormap->colors[pixel].green; pixels[1] = colormap->colors[pixel].green;
@ -101,10 +90,8 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
case 16: case 16:
case 15: case 15:
for (yy = 0; yy < height; yy++) for (yy = 0; yy < height; yy++) {
{ for (xx = 0; xx < width; xx++) {
for (xx = 0; xx < width; xx++)
{
pixel = gdk_image_get_pixel (image, xx, yy); pixel = gdk_image_get_pixel (image, xx, yy);
r = (pixel >> 8) & 0xf8; r = (pixel >> 8) & 0xf8;
g = (pixel >> 3) & 0xfc; g = (pixel >> 3) & 0xfc;
@ -121,10 +108,8 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
case 24: case 24:
case 32: case 32:
for (yy = 0; yy < height; yy++) for (yy = 0; yy < height; yy++) {
{ for (xx = 0; xx < width; xx++) {
for (xx = 0; xx < width; xx++)
{
pixel = gdk_image_get_pixel (image, xx, yy); pixel = gdk_image_get_pixel (image, xx, yy);
r = (pixel >> 16) & 0xff; r = (pixel >> 16) & 0xff;
g = (pixel >> 8) & 0xff; g = (pixel >> 8) & 0xff;
@ -151,18 +136,14 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
/* Public functions */ /* Public functions */
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height)
gint x, gint y,
gint width, gint height)
{ {
return gdk_pixbuf_from_drawable_core (window, x, y, width, height, 0); return gdk_pixbuf_from_drawable_core (window, x, y, width, height, 0);
} }
GdkPixBuf * GdkPixbuf *
gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height)
gint x, gint y,
gint width, gint height)
{ {
return gdk_pixbuf_from_drawable_core (window, x, y, width, height, 1); return gdk_pixbuf_from_drawable_core (window, x, y, width, height, 1);
} }