Commit 74268afd authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Arturo Espinosa
Browse files

Reindented to use the GNOME Indentation.

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

	* src/*: Reindented to use the GNOME Indentation.
parent 3b9835b5
This diff is collapsed.
1999-10-18 Federico Mena Quintero <federico@redhat.com>
* src/*: Reindented to use the GNOME Indentation.
1999-10-18 Havoc Pennington <hp@pobox.com>
* configure.in: Use AM_PATH_GLIB instead of glib-config directly
......
......@@ -4,12 +4,12 @@
/* The optional cache interface */
typedef struct {
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);
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);
#endif
/*
* 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:
* Michael Fulbright (drmike@redhat.com)
......@@ -15,10 +15,10 @@
/* This function does all the work. */
static GdkPixBuf *
static GdkPixbuf *
_pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf;
art_u8 *pixels;
......@@ -40,12 +40,10 @@ _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
}
GdkPixBuf *
gdk_pixbuf_load_image_from_rgb_d (unsigned char *data,
int rgb_width, int rgb_height)
GdkPixbuf *
gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height)
{
g_return_val_if_fail (data != NULL, NULL);
return _pixbuf_create_from_rgb_d(data, rgb_width, rgb_height);
}
......@@ -4,11 +4,7 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf.h>
GdkPixBuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window,
gint x, gint y,
gint width, gint height);
GdkPixBuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window,
gint x, gint y,
gint width, gint height);
GdkPixbuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, 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_ */
/*
* gdk-pixbuf-io.c: Code to load images into GdkPixBufs
* gdk-pixbuf-io.c: Code to load images into GdkPixbufs
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
......@@ -106,7 +106,7 @@ pixbuf_check_ppm (unsigned char *buffer, int size)
if (size < 20)
return FALSE;
if (buffer [0] == 'P'){
if (buffer [0] == 'P') {
if (buffer [1] == '1' ||
buffer [1] == '2' ||
buffer [1] == '3' ||
......@@ -122,8 +122,8 @@ static struct {
char *module_name;
gboolean (*format_check)(unsigned char *buffer, int size);
GModule *module;
GdkPixBuf *(*load)(FILE *f);
int (*save)(GdkPixBuf *p, FILE *f, ...);
GdkPixbuf *(*load)(FILE *f);
int (*save)(GdkPixbuf *p, FILE *f, ...);
} file_formats [] = {
{ "png", pixbuf_check_png, 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;
}
GdkPixBuf *
GdkPixbuf *
gdk_pixbuf_load_image (const char *file)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
gint n, i;
FILE *f;
char buffer [128];
......@@ -176,17 +176,17 @@ gdk_pixbuf_load_image (const char *file)
return NULL;
n = fread (&buffer, 1, sizeof (buffer), f);
if (n == 0){
if (n == 0) {
fclose (f);
return NULL;
}
for (i = 0; file_formats [i].module_name; i++){
if ((*file_formats [i].format_check)(buffer, n)){
for (i = 0; file_formats [i].module_name; i++) {
if ((*file_formats [i].format_check)(buffer, n)) {
if (!file_formats [i].load)
image_handler_load (i);
if (!file_formats [i].load){
if (!file_formats [i].load) {
fclose (f);
return NULL;
}
......
/*
* gdk-pixbuf.c: Resource management.
/* GdkPixbuf library
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
* Mark Crichton (crichton@gimp.org)
* 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.
*/
#include <config.h>
#include <glib.h>
#include <math.h>
#include <glib.h>
#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_pixbuf.h>
......@@ -16,96 +33,96 @@
#include <libart_lgpl/art_alphagamma.h>
#include "gdk-pixbuf.h"
void
gdk_pixbuf_destroy (GdkPixBuf *pixbuf)
gdk_pixbuf_destroy (GdkPixbuf *pixbuf)
{
art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = NULL;
g_free (pixbuf);
art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = NULL;
g_free (pixbuf);
}
GdkPixBuf *
gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
GdkPixBufUnrefFunc *unref_fn)
GdkPixbuf *
gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
if (!art_pixbuf)
return NULL;
pixbuf = g_new (GdkPixBuf, 1);
pixbuf->ref_count = 1;
pixbuf->unref_fn = unref_fn;
pixbuf = g_new (GdkPixbuf, 1);
pixbuf->ref_count = 1;
pixbuf->unref_fn = unref_fn;
pixbuf->art_pixbuf = art_pixbuf;
return pixbuf;
}
void
gdk_pixbuf_ref (GdkPixBuf *pixbuf)
gdk_pixbuf_ref (GdkPixbuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
pixbuf->ref_count++;
pixbuf->ref_count++;
}
void
gdk_pixbuf_unref (GdkPixBuf *pixbuf)
gdk_pixbuf_unref (GdkPixbuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
pixbuf->ref_count--;
pixbuf->ref_count--;
if (pixbuf->ref_count == 0)
gdk_pixbuf_destroy (pixbuf);
if (pixbuf->ref_count == 0)
gdk_pixbuf_destroy (pixbuf);
}
GdkPixBuf *
gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h)
GdkPixbuf *
gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
{
art_u8 *pixels;
gint rowstride;
double affine[6];
ArtAlphaGamma *alphagamma;
ArtPixBuf *art_pixbuf = NULL;
GdkPixBuf *copy = NULL;
art_u8 *pixels;
gint rowstride;
double affine[6];
ArtAlphaGamma *alphagamma;
ArtPixBuf *art_pixbuf = NULL;
GdkPixbuf *copy = NULL;
alphagamma = NULL;
alphagamma = NULL;
affine[1] = affine[2] = affine[4] = affine[5] = 0;
affine[1] = affine[2] = affine[4] = affine[5] = 0;
affine[0] = w / (double)(pixbuf->art_pixbuf->width);
affine[3] = h / (double)(pixbuf->art_pixbuf->height);
affine[0] = w / (double)(pixbuf->art_pixbuf->width);
affine[3] = h / (double)(pixbuf->art_pixbuf->height);
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
rowstride = w * 3;
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
rowstride = w * 3;
pixels = art_alloc (h * rowstride);
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
pixbuf->art_pixbuf,
affine, ART_FILTER_NEAREST, alphagamma);
pixels = art_alloc (h * rowstride);
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
pixbuf->art_pixbuf,
affine, ART_FILTER_NEAREST, alphagamma);
if (pixbuf->art_pixbuf->has_alpha)
/* should be rgba */
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
else
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
if (pixbuf->art_pixbuf->has_alpha)
/* should be rgba */
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
else
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
copy = gdk_pixbuf_new (art_pixbuf, NULL);
copy = gdk_pixbuf_new (art_pixbuf, NULL);
if (!copy)
art_free (pixels);
return copy;
if (!copy)
art_free (pixels);
return copy;
}
GdkPixBuf *
gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
GdkPixbuf *
gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf)
{
GdkPixBuf *copy = g_new (GdkPixBuf, 1);
GdkPixbuf *copy = g_new (GdkPixbuf, 1);
copy->ref_count = 1;
copy->unref_fn = pixbuf->unref_fn;
......@@ -114,59 +131,59 @@ gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
return copy;
}
GdkPixBuf *
gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle)
GdkPixbuf *
gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
{
art_u8 *pixels;
gint rowstride, w, h;
gdouble rad;
double rot[6], trans[6], affine[6];
ArtAlphaGamma *alphagamma = NULL;
ArtPixBuf *art_pixbuf = NULL;
w = pixbuf->art_pixbuf->width;
h = pixbuf->art_pixbuf->height;
rad = (M_PI * angle / 180.0);
rot[0] = cos(rad);
rot[1] = sin(rad);
rot[2] = -sin(rad);
rot[3] = cos(rad);
rot[4] = rot[5] = 0;
trans[0] = trans[3] = 1;
trans[1] = trans[2] = 0;
trans[4] = -(double)w / 2.0;
trans[5] = -(double)h / 2.0;
art_affine_multiply(rot, trans, rot);
trans[0] = trans[3] = 1;
trans[1] = trans[2] = 0;
trans[4] = (double)w / 2.0;
trans[5] = (double)h / 2.0;
art_affine_multiply(affine, rot, trans);
g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
affine[3], affine[4], affine[5]);
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
rowstride = w * 3;
pixels = art_alloc (h * rowstride);
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
pixbuf->art_pixbuf,
affine, ART_FILTER_NEAREST, alphagamma);
if (pixbuf->art_pixbuf->has_alpha)
/* should be rgba */
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
else
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = art_pixbuf;
return pixbuf;
art_u8 *pixels;
gint rowstride, w, h;
gdouble rad;
double rot[6], trans[6], affine[6];
ArtAlphaGamma *alphagamma = NULL;
ArtPixBuf *art_pixbuf = NULL;
w = pixbuf->art_pixbuf->width;
h = pixbuf->art_pixbuf->height;
rad = (M_PI * angle / 180.0);
rot[0] = cos(rad);
rot[1] = sin(rad);
rot[2] = -sin(rad);
rot[3] = cos(rad);
rot[4] = rot[5] = 0;
trans[0] = trans[3] = 1;
trans[1] = trans[2] = 0;
trans[4] = -(double)w / 2.0;
trans[5] = -(double)h / 2.0;
art_affine_multiply(rot, trans, rot);
trans[0] = trans[3] = 1;
trans[1] = trans[2] = 0;
trans[4] = (double)w / 2.0;
trans[5] = (double)h / 2.0;
art_affine_multiply(affine, rot, trans);
g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
affine[3], affine[4], affine[5]);
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
rowstride = w * 3;
pixels = art_alloc (h * rowstride);
art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
pixbuf->art_pixbuf,
affine, ART_FILTER_NEAREST, alphagamma);
if (pixbuf->art_pixbuf->has_alpha)
/* should be rgba */
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
else
art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = art_pixbuf;
return pixbuf;
}
#ifndef _GDK_PIXBUF_H_
#define _GDK_PIXBUF_H_
/* GdkPixbuf library
*
* 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_pixbuf.h>
#include <glib.h>
typedef struct _GdkPixBuf GdkPixBuf;
typedef void (*GdkPixBufUnrefFunc) (GdkPixBuf *pixbuf);
#ifdef __cplusplus
extern "C" {
#endif
struct _GdkPixBuf
{
int ref_count;
ArtPixBuf *art_pixbuf;
GdkPixBufUnrefFunc *unref_fn;
typedef struct _GdkPixbuf GdkPixbuf;
typedef void (* GdkPixbufUnrefFunc) (GdkPixbuf *pixbuf);
struct _GdkPixbuf {
int ref_count;
ArtPixBuf *art_pixbuf;
GdkPixbufUnrefFunc *unref_fn;
};
GdkPixBuf *gdk_pixbuf_load_image (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);
GdkPixbuf *gdk_pixbuf_load_image (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);
void gdk_pixbuf_destroy (GdkPixBuf *pixbuf);
GdkPixbuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height);
GdkPixBuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data,
int rgb_width, int rgb_height);
#ifdef __cplusplus
}
#endif
#endif /* _GDK_PIXBUF_H_ */
#endif
/*
* io-bmp.c: GdkPixBuf I/O for BMP files.
* io-bmp.c: GdkPixbuf I/O for BMP files.
*
* Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org>
......@@ -30,18 +30,18 @@
/* Loosely based off the BMP loader from The GIMP, hence it's complexity */
/* Shared library entry point */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *image_load(FILE * f)
{
art_u8 *pixels;
ArtPixBuf *art_pixbuf;
art_u8 *pixels;
ArtPixBuf *art_pixbuf;
/* Ok, now stuff the GdkPixBuf with goodies */
/* Ok, now stuff the GdkPixbuf with goodies */
if (is_trans)
art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
else
art_pixbuf = art_pixbuf_new_rgb (pixels, w, h, (w * 3));
if (is_trans)
art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
else
art_pixbuf = art_pixbuf_new_rgb (pixels, w, h, (w * 3));
/* Ok, I'm anal...shoot me */
return gdk_pixbuf_new (art_pixbuf, NULL);
/* Ok, I'm anal...shoot me */
return gdk_pixbuf_new (art_pixbuf, NULL);
}
/*
* io-gif.c: GdkPixBuf I/O for GIF files.
* io-gif.c: GdkPixbuf I/O for GIF files.
* ...second verse, same as the first...
*
* Copyright (C) 1999 Mark Crichton
......@@ -29,148 +29,149 @@
#include <gif_lib.h>
/* Shared library entry point */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *
image_load(FILE *f)
{
gint fn, is_trans = FALSE;
gint done = 0;
gint t_color = -1;
gint w, h, i, j;
art_u8 *pixels, *tmpptr;
GifFileType *gif;
GifRowType *rows;
GifRecordType rec;
ColorMapObject *cmap;
int intoffset[] =
{0, 4, 2, 1};
int intjump[] =
{8, 8, 4, 2};
GdkPixBuf *pixbuf;
ArtPixBuf *art_pixbuf;
g_return_val_if_fail(f != NULL, NULL);