claw::graphic::targa::reader::file_input_buffer< Pixel > Class Template Reference

The type of the input buffer associated with the file when decoding RLE files. More...

Inheritance diagram for claw::graphic::targa::reader::file_input_buffer< Pixel >:
claw::buffered_istream< std::istream >

List of all members.

Public Member Functions

 file_input_buffer (std::istream &f)
 Constructor.
rgba_pixel_8 get_pixel ()
template<>
rgba_pixel_8 get_pixel ()
template<>
rgba_pixel_8 get_pixel ()
template<>
rgba_pixel_8 get_pixel ()

Private Types

typedef Pixel pixel_type
 The type of the pixels in the input buffer.

Detailed Description

template<typename Pixel>
class claw::graphic::targa::reader::file_input_buffer< Pixel >

The type of the input buffer associated with the file when decoding RLE files.

Template parameters

Definition at line 225 of file targa.hpp.


Member Typedef Documentation

template<typename Pixel>
typedef Pixel claw::graphic::targa::reader::file_input_buffer< Pixel >::pixel_type [private]

The type of the pixels in the input buffer.

Definition at line 229 of file targa.hpp.


Constructor & Destructor Documentation

template<typename Pixel >
claw::graphic::targa::reader::file_input_buffer< Pixel >::file_input_buffer ( std::istream &  f  )  [inline]

Constructor.

Parameters:
f The file to read.

Definition at line 41 of file targa_reader.tpp.

00042   : buffered_istream<std::istream>(f)
00043 {
00044   
00045 } // targa::reader::file_input_buffer::file_input_buffer


Member Function Documentation

Remarks:
This method is specialized for the pixels of type claw::graphic::targa::reader::pixel16.

Definition at line 114 of file targa_reader.cpp.

References claw::graphic::rgba_pixel::alpha, claw::graphic::rgba_pixel::blue, claw::graphic::rgba_pixel::components, claw::buffered_istream< std::istream >::get_next(), claw::graphic::rgba_pixel::green, claw::buffered_istream< std::istream >::read_more(), claw::graphic::rgba_pixel::red, and claw::buffered_istream< std::istream >::remaining().

00115     {
00116       rgba_pixel_8 result;
00117 
00118       if ( this->remaining() < 2 )
00119         this->read_more(2);
00120 
00121       assert( this->remaining() >= 2 );
00122 
00123       unsigned char second_byte  = this->get_next();
00124       unsigned char first_byte = this->get_next();
00125 
00126       unsigned char r = (first_byte & 0x7C) >> 2;
00127       unsigned char g =
00128         ((first_byte & 0x03) << 3) | ((second_byte & 0xE0) >> 5);
00129       unsigned char b = second_byte & 0x1F;
00130 
00131       result.components.blue  = b * 8;
00132       result.components.green = g * 8;
00133       result.components.red   = r * 8;
00134       result.components.alpha =
00135         std::numeric_limits<claw::graphic::rgba_pixel_8::component_type>::max();
00136 
00137       return result;
00138     } // targa::reader::file_input_buffer::get_pixel()

Remarks:
This method is specialized for the pixels of type claw::graphic::targa::reader::rgb_pixel_8.

Definition at line 82 of file targa_reader.cpp.

References claw::graphic::rgba_pixel::alpha, claw::graphic::rgba_pixel::blue, claw::graphic::rgba_pixel::components, claw::buffered_istream< std::istream >::get_next(), claw::graphic::rgba_pixel::green, claw::buffered_istream< std::istream >::read_more(), claw::graphic::rgba_pixel::red, and claw::buffered_istream< std::istream >::remaining().

00083     {
00084       rgba_pixel_8 result;
00085       
00086       if ( this->remaining() < 3 )
00087         this->read_more(3);
00088       
00089       assert( this->remaining() >= 3 );
00090       
00091       result.components.blue  = this->get_next();
00092       result.components.green = this->get_next();
00093       result.components.red   = this->get_next();
00094       result.components.alpha =
00095         std::numeric_limits<claw::graphic::rgba_pixel_8::component_type>::max();
00096       
00097       return result;
00098     } // targa::reader::file_input_buffer::get_pixel()

Remarks:
This method is specialized for the pixels of type claw::graphic::rgba_pixel_8.

Definition at line 51 of file targa_reader.cpp.

References claw::graphic::rgba_pixel::alpha, claw::graphic::rgba_pixel::blue, claw::graphic::rgba_pixel::components, claw::buffered_istream< std::istream >::get_next(), claw::graphic::rgba_pixel::green, claw::buffered_istream< std::istream >::read_more(), claw::graphic::rgba_pixel::red, and claw::buffered_istream< std::istream >::remaining().

00052     {
00053       rgba_pixel_8 result;
00054       
00055       if ( this->remaining() < 4 )
00056         this->read_more(4);
00057       
00058       assert( this->remaining() >= 4 );
00059       
00060       result.components.blue  = this->get_next();
00061       result.components.green = this->get_next();
00062       result.components.red   = this->get_next();
00063       result.components.alpha = this->get_next();
00064       
00065       return result;
00066     } // targa::reader::file_input_buffer::get_pixel()

template<typename Pixel>
rgba_pixel_8 claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel (  ) 

The documentation for this class was generated from the following files:

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1