Go to the documentation of this file.00001
00002 #ifndef vil_bmp_file_format_h_
00003 #define vil_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
00019
00020 class vil_stream;
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <vil/vil_file_format.h>
00035 #include <vil/vil_image_resource.h>
00036 #include <vil/vil_stream.h>
00037 #include "vil_bmp_file_header.h"
00038 #include "vil_bmp_core_header.h"
00039 #include "vil_bmp_info_header.h"
00040 class vil_image_view_base;
00041
00042
00043
00044 class vil_bmp_file_format : public vil_file_format
00045 {
00046 public:
00047 virtual char const* tag() const;
00048 virtual vil_image_resource_sptr make_input_image(vil_stream* vs);
00049 virtual vil_image_resource_sptr make_output_image(vil_stream* vs,
00050 unsigned nx,
00051 unsigned ny,
00052 unsigned nplanes,
00053 vil_pixel_format format);
00054 };
00055
00056
00057 class vil_bmp_image : public vil_image_resource
00058 {
00059 public:
00060 vil_bmp_image(vil_stream* is, unsigned ni,
00061 unsigned nj, unsigned nplanes, vil_pixel_format format);
00062 vil_bmp_image(vil_stream* is);
00063 ~vil_bmp_image();
00064
00065
00066 virtual unsigned nplanes() const {
00067 return (core_hdr.bitsperpixel<24)?1:core_hdr.bitsperpixel/8; }
00068 virtual unsigned ni() const { return core_hdr.width; }
00069 virtual unsigned nj() const { return core_hdr.height; }
00070
00071 virtual enum vil_pixel_format pixel_format() const {return VIL_PIXEL_FORMAT_BYTE; }
00072
00073
00074
00075 virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00076 unsigned j0, unsigned nj) const;
00077
00078
00079 virtual bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0);
00080
00081 char const* file_format() const;
00082 bool get_property(char const *tag, void *prop = 0) const;
00083 private:
00084 vil_stream* is_;
00085
00086 bool read_header();
00087 bool write_header();
00088
00089 friend class vil_bmp_file_format;
00090
00091 vil_bmp_file_header file_hdr;
00092 vil_bmp_core_header core_hdr;
00093 vil_bmp_info_header info_hdr;
00094 vil_streampos 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 // 0
00103 };
00104
00105
00106 #endif // vil_bmp_file_format_h_