Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef __FILEBMP_INCLUDED__
Toshihiro Shimizu 890ddd
#define __FILEBMP_INCLUDED__
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
/*
Campbell Barton d869b5
#if defined(_WIN32)
Toshihiro Shimizu 890ddd
typedef struct {unsigned char b,g,r,m;}  LPIXEL;
Toshihiro Shimizu 890ddd
#elif defined(__sgi)
Toshihiro Shimizu 890ddd
typedef struct { unsigned char  m,b,g,r; } LPIXEL;
Rozhuk Ivan ac51ab
#elif defined(LINUX) || defined(FREEBSD)
Toshihiro Shimizu 890ddd
typedef struct { unsigned char  r,g,b,m; } LPIXEL;
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#error	Not yet implemented
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
enum BMP_ERROR_CODE {
Shinya Kitaoka 120a6e
  OK,
Shinya Kitaoka 120a6e
  UNSUPPORTED_BMP_FORMAT = -1,
Shinya Kitaoka 120a6e
  OUT_OF_MEMORY          = -2,
Shinya Kitaoka 120a6e
  UNEXPECTED_EOF         = -3,
Shinya Kitaoka 120a6e
  CANT_OPEN_FILE         = -4,
Shinya Kitaoka 120a6e
  WRITE_ERROR            = -5
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef const wchar_t *MYSTRING;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
int writebmp(const MYSTRING filename, int xsize, int ysize, void *buffer,
Shinya Kitaoka 120a6e
             int bpp);
Toshihiro Shimizu 890ddd
int readbmp(const MYSTRING filename, int *xsize, int *ysize, void **buffer);
Shinya Kitaoka 120a6e
int readbmpregion(const MYSTRING fname, void **pimg, int x1, int y1, int x2,
Shinya Kitaoka 120a6e
                  int y2, int scale);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int readbmp_size(const MYSTRING fname, int *lx, int *ly);
Toshihiro Shimizu 890ddd
int readbmp_bbox(const MYSTRING fname, int *x0, int *y0, int *x1, int *y1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif