bmp.h 2.41 KB
Newer Older
1
/*
2
 * GIMP - The GNU Image Manipulation Program
3 4
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8 9 10 11 12 13 14 15
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
Elliot Lee's avatar
Elliot Lee committed
18

19 20 21 22 23 24
#ifndef __BMP_H__
#define __BMP_H__

#define LOAD_PROC      "file-bmp-load"
#define SAVE_PROC      "file-bmp-save"
#define PLUG_IN_BINARY "file-bmp"
25
#define PLUG_IN_ROLE   "gimp-file-bmp"
26

27
#define MAXCOLORS   256
Elliot Lee's avatar
Elliot Lee committed
28

29
#define BitSet(byte, bit)        (((byte) & (bit)) == (bit))
Elliot Lee's avatar
Elliot Lee committed
30

31
#define ReadOK(file,buffer,len)  (fread(buffer, len, 1, file) != 0)
32
#define Write(file,buffer,len)   fwrite(buffer, len, 1, file)
33
#define WriteOK(file,buffer,len) (Write(buffer, len, file) != 0)
Elliot Lee's avatar
Elliot Lee committed
34

35 36 37 38 39 40 41 42

gint32             ReadBMP   (const gchar  *filename,
                              GError      **error);
GimpPDBStatusType  WriteBMP  (const gchar  *filename,
                              gint32        image,
                              gint32        drawable_ID,
                              GError      **error);

43

44
extern       gboolean  interactive;
45
extern       gboolean  lastvals;
46
extern const gchar    *filename;
Elliot Lee's avatar
Elliot Lee committed
47

48
extern struct Bitmap_File_Head_Struct
49
{
50
  gchar    zzMagic[2];  /* 00 "BM" */
51
  gulong   bfSize;      /* 02 */
52 53
  gushort  zzHotX;      /* 06 */
  gushort  zzHotY;      /* 08 */
54 55 56
  gulong   bfOffs;      /* 0A */
  gulong   biSize;      /* 0E */
} Bitmap_File_Head;
Elliot Lee's avatar
Elliot Lee committed
57

58
extern struct Bitmap_Head_Struct
59
{
60
  glong    biWidth;     /* 12 */
61
  glong    biHeight;    /* 16 */
62 63 64 65 66 67 68 69
  gushort  biPlanes;    /* 1A */
  gushort  biBitCnt;    /* 1C */
  gulong   biCompr;     /* 1E */
  gulong   biSizeIm;    /* 22 */
  gulong   biXPels;     /* 26 */
  gulong   biYPels;     /* 2A */
  gulong   biClrUsed;   /* 2E */
  gulong   biClrImp;    /* 32 */
70
  guint32  masks[4];    /* 36 */
71
} Bitmap_Head;
72 73 74 75 76

typedef struct _Bitmap_Channel
{
  guint32 mask;
  guint32 shiftin;
77
  gfloat  max_value;
78
} Bitmap_Channel;
79 80

#endif /* __BMP_H__ */