00001
00002 #ifndef vil1_bmp_file_format_h_
00003 #define vil1_bmp_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 class vil1_stream;
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <vil1/vil1_file_format.h>
00033 #include <vil1/vil1_image_impl.h>
00034 #include "vil1_bmp_file_header.h"
00035 #include "vil1_bmp_core_header.h"
00036 #include "vil1_bmp_info_header.h"
00037
00038
00039 class vil1_bmp_file_format : public vil1_file_format
00040 {
00041 public:
00042 virtual char const* tag() const;
00043 virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00044 virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00045 int width,
00046 int height,
00047 int components,
00048 int bits_per_component,
00049 vil1_component_format format);
00050 };
00051
00052
00053 class vil1_bmp_generic_image : public vil1_image_impl
00054 {
00055 public:
00056
00057 vil1_bmp_generic_image(vil1_stream* is);
00058 vil1_bmp_generic_image(vil1_stream* is,
00059 int planes,
00060 int width,
00061 int height,
00062 int components,
00063 int bits_per_component,
00064 vil1_component_format format);
00065
00066 ~vil1_bmp_generic_image();
00067
00068
00069 virtual int planes() const { return 1; }
00070 virtual int width() const { return core_hdr.width; }
00071 virtual int height() const { return core_hdr.height; }
00072 virtual int components() const { return (core_hdr.bitsperpixel<24)?1:core_hdr.bitsperpixel/8; }
00073 virtual int bits_per_component() const { return (core_hdr.bitsperpixel<24)?core_hdr.bitsperpixel:8; }
00074 virtual enum vil1_component_format component_format() const { return VIL1_COMPONENT_FORMAT_UNSIGNED_INT; }
00075
00076
00077 virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00078 virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00079
00080 char const* file_format() const;
00081 bool get_property(char const *tag, void *prop = 0) const;
00082
00083 private:
00084 vil1_stream* is_;
00085
00086 bool read_header();
00087 bool write_header();
00088
00089 friend class vil1_bmp_file_format;
00090
00091 vil1_bmp_file_header file_hdr;
00092 vil1_bmp_core_header core_hdr;
00093 vil1_bmp_info_header info_hdr;
00094 long bit_map_start;
00095 #if 0
00096 uchar **freds_colormap;
00097
00098 xBITMAPINFOHEADER header;
00099 xBITMAPFILEHEADER fbmp;
00100 int pixsize;
00101 int** local_color_map_;
00102 #endif
00103 };
00104
00105 #endif // vil1_bmp_file_format_h_