core/vil1/file_formats/vil1_bmp_core_header.cxx

Go to the documentation of this file.
00001 // This is core/vil1/file_formats/vil1_bmp_core_header.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author fsm
00008 
00009 #include "vil1_bmp_core_header.h"
00010 
00011 #include <vcl_iostream.h>
00012 
00013 #include <vil1/vil1_stream.h>
00014 #include <vil1/vil1_16bit.h>
00015 #include <vil1/vil1_32bit.h>
00016 
00017 vil1_bmp_core_header::vil1_bmp_core_header()
00018 {
00019   header_size = disk_size;
00020   width = 0;
00021   height = 0;
00022   planes = 1;
00023   bitsperpixel = 8;
00024 }
00025 
00026 void vil1_bmp_core_header::read(vil1_stream *s)
00027 {
00028   header_size  = vil1_32bit_read_little_endian(s);
00029   width        = vil1_32bit_read_little_endian(s);
00030   height       = vil1_32bit_read_little_endian(s);
00031   planes       = vil1_16bit_read_little_endian(s);
00032   bitsperpixel = vil1_16bit_read_little_endian(s);
00033   // allowed values for bitsperpixel are 1 4 8 16 24 32; currently we only support 8 and 24
00034 }
00035 
00036 void vil1_bmp_core_header::write(vil1_stream *s) const
00037 {
00038   vil1_32bit_write_little_endian(s, header_size);
00039   vil1_32bit_write_little_endian(s, width);
00040   vil1_32bit_write_little_endian(s, height);
00041   vil1_16bit_write_little_endian(s, planes);
00042   vil1_16bit_write_little_endian(s, bitsperpixel);
00043 }
00044 
00045 void vil1_bmp_core_header::print(vcl_ostream &s) const
00046 {
00047   s << "vil1_bmp_core_header:\n"
00048     << "  header_size  : " << header_size  << vcl_endl
00049     << "  width        : " << width        << vcl_endl
00050     << "  height       : " << height       << vcl_endl
00051     << "  planes       : " << planes       << vcl_endl
00052     << "  bitsperpixel : " << bitsperpixel << vcl_endl << vcl_endl;
00053 }

Generated on Sat Nov 22 05:08:28 2008 for core/vil1 by  doxygen 1.5.1