45 template<
typename Pixel>
59 template<
typename Pixel>
63 assert( n <= max_encodable() );
64 assert( n >= min_interesting() );
66 unsigned char key = (n-1) | 0x80;
69 order_pixel_bytes( pattern );
78 template<
typename Pixel>
79 template<
typename Iterator>
81 ( Iterator
first, Iterator last )
83 unsigned int n = std::distance(first, last);
85 unsigned int full = n / max_encodable();
86 unsigned int remaining = n % max_encodable();
88 unsigned char key = max_encodable() - 1;
90 for (
unsigned int i=0; i!=full; ++i)
94 for (
unsigned int j=0; j!=max_encodable(); ++j, ++first)
95 order_pixel_bytes( *first );
103 for (
unsigned int j=0; j!=remaining; ++j, ++first)
104 order_pixel_bytes( *first );
113 template<
typename Pixel>
124 template<
typename Pixel>
void raw(Iterator first, Iterator last)
Write raw data int the stream.
unsigned int max_encodable() const
Get the maximum number of pixel a code can encode.
Fuction object to get the first element of a std::pair.
file_output_buffer(std::ostream &os)
Constructor.
pixel_type pattern_type
The type of the patterns to encode.
unsigned int min_interesting() const
Get the minimum number of pixels needed for encoding.
void encode(unsigned int n, pattern_type pattern)
Code a pixel.