core/vil/file_formats/vil_bmp_info_header.cxx
Go to the documentation of this file.
00001 // This is core/vil/file_formats/vil_bmp_info_header.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author fsm
00008 
00009 #include "vil_bmp_info_header.h"
00010 
00011 #include <vcl_iostream.h>
00012 
00013 #include <vil/vil_stream.h>
00014 #include <vil/vil_stream_read.h>
00015 #include <vil/vil_stream_write.h>
00016 
00017 vil_bmp_info_header::vil_bmp_info_header()
00018 {
00019   compression = 0;
00020   bitmap_size = 0;
00021   horiz_res = 0;
00022   verti_res = 0;
00023   colormapsize = 0;
00024   colorcount = 0;
00025 }
00026 
00027 void vil_bmp_info_header::read(vil_stream *s)
00028 {
00029   compression = vil_stream_read_little_endian_uint_32(s);
00030   bitmap_size = vil_stream_read_little_endian_uint_32(s);
00031   horiz_res   = vil_stream_read_little_endian_uint_32(s);
00032   verti_res   = vil_stream_read_little_endian_uint_32(s);
00033   colormapsize= vil_stream_read_little_endian_uint_32(s);
00034   colorcount  = vil_stream_read_little_endian_uint_32(s);
00035 }
00036 
00037 void vil_bmp_info_header::write(vil_stream *s) const
00038 {
00039   vil_stream_write_little_endian_uint_32(s, compression);
00040   vil_stream_write_little_endian_uint_32(s, bitmap_size);
00041   vil_stream_write_little_endian_uint_32(s, horiz_res);
00042   vil_stream_write_little_endian_uint_32(s, verti_res);
00043   vil_stream_write_little_endian_uint_32(s, colormapsize);
00044   vil_stream_write_little_endian_uint_32(s, colorcount);
00045 }
00046 
00047 void vil_bmp_info_header::print(vcl_ostream &s) const
00048 {
00049   s << "vil_bmp_info_header:\n"
00050     << "  compression  : " << compression << vcl_endl
00051     << "  bitmap_size  : " << bitmap_size << vcl_endl
00052     << "  horiz_res    : " << horiz_res << vcl_endl
00053     << "  verti_res    : " << verti_res << vcl_endl
00054     << "  colormapsize : " << colormapsize << vcl_endl
00055     << "  colorcount   : " << colorcount << vcl_endl << vcl_endl;
00056 }