2 * io-bmp.c: GdkPixBuf I/O for BMP files.
4 * Copyright (C) 1999 Mark Crichton
5 * Author: Mark Crichton <crichton@gimp.org>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
26 #include "gdk-pixbuf.h"
27 #include "gdk-pixbuf-io.h"
30 /* Loosely based off the BMP loader from The GIMP, hence it's complexity */
32 /* Shared library entry point */
33 GdkPixBuf *image_load(FILE * f)
38 /* Ok, now stuff the GdkPixBuf with goodies */
40 pixbuf = g_new(GdkPixBuf, 1);
43 pixbuf->art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
45 pixbuf->art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3));
47 /* Ok, I'm anal...shoot me */
48 if (!(pixbuf->art_pixbuf))
50 pixbuf->ref_count = 1;
51 pixbuf->unref_func = NULL;