CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
Public Member Functions | Private Types
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)

Constructor.

Parameters:
fThe file to read.

Definition at line 41 of file targa_reader.tpp.

  : buffered_istream<std::istream>(f)
{
  
} // targa::reader::file_input_buffer::file_input_buffer

Member Function Documentation

template<typename Pixel>
rgba_pixel_8 claw::graphic::targa::reader::file_input_buffer< Pixel >::get_pixel ( )
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::components.

    {
      rgba_pixel_8 result;

      if ( this->remaining() < 2 )
        this->read_more(2);

      assert( this->remaining() >= 2 );

      unsigned char second_byte  = this->get_next();
      unsigned char first_byte = this->get_next();

      unsigned char r = (first_byte & 0x7C) >> 2;
      unsigned char g =
        ((first_byte & 0x03) << 3) | ((second_byte & 0xE0) >> 5);
      unsigned char b = second_byte & 0x1F;

      result.components.blue  = b * 8;
      result.components.green = g * 8;
      result.components.red   = r * 8;
      result.components.alpha =
        std::numeric_limits<claw::graphic::rgba_pixel_8::component_type>::max();

      return result;
    } // 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::components.

    {
      rgba_pixel_8 result;
      
      if ( this->remaining() < 3 )
        this->read_more(3);
      
      assert( this->remaining() >= 3 );
      
      result.components.blue  = this->get_next();
      result.components.green = this->get_next();
      result.components.red   = this->get_next();
      result.components.alpha =
        std::numeric_limits<claw::graphic::rgba_pixel_8::component_type>::max();
      
      return result;
    } // 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::components.

    {
      rgba_pixel_8 result;
      
      if ( this->remaining() < 4 )
        this->read_more(4);
      
      assert( this->remaining() >= 4 );
      
      result.components.blue  = this->get_next();
      result.components.green = this->get_next();
      result.components.red   = this->get_next();
      result.components.alpha = this->get_next();
      
      return result;
    } // targa::reader::file_input_buffer::get_pixel()

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